From 81fa3d5681d9f59f1b1ad0a5c7db4443aee7d361 Mon Sep 17 00:00:00 2001
From: Alexander Hurd <hurdad@gmail.com>
Date: Mon, 17 Oct 2016 00:49:39 -0400
Subject: [PATCH] adding Call of Duty: World at War

---
 CallOfDutyWorldAtWar/cfg/lgsm-default.cfg |   3 +
 CallOfDutyWorldAtWar/codwawserver         | 145 +++++
 lgsm/functions/command_install.sh         |   2 +-
 lgsm/functions/install_config.sh          | 718 ++++++++++++----------
 lgsm/functions/install_server_files.sh    |   2 +
 5 files changed, 554 insertions(+), 316 deletions(-)
 create mode 100644 CallOfDutyWorldAtWar/cfg/lgsm-default.cfg
 create mode 100644 CallOfDutyWorldAtWar/codwawserver

diff --git a/CallOfDutyWorldAtWar/cfg/lgsm-default.cfg b/CallOfDutyWorldAtWar/cfg/lgsm-default.cfg
new file mode 100644
index 000000000..63766b13c
--- /dev/null
+++ b/CallOfDutyWorldAtWar/cfg/lgsm-default.cfg
@@ -0,0 +1,3 @@
+set sv_hostname "<hostname>"
+set scr_motd "LGSM CODWAW Server"
+set rconpassword "<rconpassword>"
diff --git a/CallOfDutyWorldAtWar/codwawserver b/CallOfDutyWorldAtWar/codwawserver
new file mode 100644
index 000000000..ee561ffc8
--- /dev/null
+++ b/CallOfDutyWorldAtWar/codwawserver
@@ -0,0 +1,145 @@
+#!/bin/bash
+# Call of Duty: World at War
+# Server Management Script
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+if [ -f ".dev-debug" ]; then
+	exec 5>dev-debug.log
+	BASH_XTRACEFD="5"
+	set -x
+fi
+
+version="210516"
+
+#### Variables ####
+
+# Notification Alerts
+# (on|off)
+
+# Email
+emailalert="off"
+email="email@example.com"
+
+# Pushbullet
+# https://www.pushbullet.com/#settings
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+
+# Start Variables
+defaultmap="mp_castle"
+maxclients="20"
+ip="0.0.0.0"
+port="28960"
+
+fn_parms(){
+parms="+set sv_punkbuster 0 +set fs_basepath ${filesdir} +set dedicated 1 +set net_ip ${ip} +set net_port ${port} +set sv_maxclients ${maxclients} +exec ${servercfg} +map ${defaultmap}"
+}
+
+#### Advanced Variables ####
+
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="GameServerManagers"
+githubrepo="LinuxGSM"
+githubbranch="codwaw"
+
+# Server Details
+servicename="codwaw-server"
+gamename="Call of Duty: World at War"
+engine="idtech3"
+
+# Directories
+rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
+libdir="${lgsmdir}/lib"
+filesdir="${rootdir}/serverfiles"
+systemdir="${filesdir}"
+executabledir="${filesdir}"
+executable="./codwaw_lnxded"
+servercfg="${servicename}.cfg"
+servercfgdir="${systemdir}/uo"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+servercfgdefault="${servercfgdir}/lgsm-default.cfg"
+backupdir="${rootdir}/backups"
+
+# Logging
+logdays="7"
+gamelogdir="${filesdir}/Logs"
+scriptlogdir="${rootdir}/log/script"
+consolelogdir="${rootdir}/log/console"
+consolelogging="on"
+
+scriptlog="${scriptlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+emaillog="${scriptlogdir}/${servicename}-email.log"
+
+scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
+
+##### Script #####
+# Do not edit
+
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="lgsm/functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	echo -e "    fetching ${filename}...\c"
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi
+	else
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
+}
+
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_functions.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
+core_dl.sh
+core_functions.sh
+
+getopt=$1
+core_getopt.sh
\ No newline at end of file
diff --git a/lgsm/functions/command_install.sh b/lgsm/functions/command_install.sh
index 5b741a126..ae1574f39 100644
--- a/lgsm/functions/command_install.sh
+++ b/lgsm/functions/command_install.sh
@@ -18,7 +18,7 @@ check_deps.sh
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 	install_server_files.sh
 	install_ut2k4_key.sh
-elif [ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Mumble" ]; then
+elif [ "${gamename}" == "Unreal Tournament 3" ]||[ "${gamename}" == "Battlefield: 1942" ]||[ "${gamename}" == "Wolfenstein: Enemy Territory" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament" ]||[ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Minecraft" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Call of Duty: World at War" ]; then
 	installer=1
 	install_server_files.sh
 elif [ -n "${appid}" ]; then
diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh
index 997bc4cc2..dd983ddf1 100644
--- a/lgsm/functions/install_config.sh
+++ b/lgsm/functions/install_config.sh
@@ -8,372 +8,460 @@ local commandname="INSTALL"
 local commandaction="Install"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
-fn_fetch_default_config(){
-	mkdir -pv "${lgsmdir}/default-configs"
-	githuburl="https://github.com/GameServerManagers/Game-Server-Configs/master"
-
-	for config in "${array_configs[@]}"
-	do
-		fileurl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master/${gamedirname}/${config}"; filedir="${lgsmdir}/default-configs"; filename="${config}";  executecmd="noexecute" run="norun"; force="noforce"
-		fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
-	done
+fn_defaultconfig(){
+	echo "creating ${servercfg} config file."
+	fn_script_log_info "creating ${servercfg} config file."
+	cp -v "${servercfgdefault}" "${servercfgfullpath}"
+	sleep 1
 }
 
-# Changes some variables within the default configs
-# SERVERNAME to LinuxGSM
-# PASSWORD to random password
-fn_set_config_vars(){
-	random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
-	servername="LinuxGSM"
-	rconpass="admin$random"
+fn_userinputconfig(){
+	# allow user to input server name and password
+	if [ -z "${autoinstall}" ]; then
+		echo ""
+		echo "Configuring ${gamename} Server"
+		echo "================================="
+		sleep 1
+		read -p "Enter server name: " servername
+		read -p "Enter rcon password: " rconpass
+	else
+		servername="${servicename}"
+		rconpass="rconpassword"
+	fi
 	echo "changing hostname."
 	fn_script_log_info "changing hostname."
+	sed -i "s/\"<hostname>\"/\"${servername}\"/g" "${servercfgfullpath}"
 	sleep 1
-	sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
 	echo "changing rconpassword."
-	fn_script_log_info "changing RCON/ADMIN password."
-	sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
+	fn_script_log_info "changing rconpassword."
+	sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgfullpath}"
+	sleep 1
+}
+
+fn_arma3config(){
+	fn_defaultconfig
+	echo "creating ${networkcfg} config file."
+	fn_script_log_info "creating ${networkcfg} config file."
+	cp -v "${networkcfgdefault}" "${networkcfgfullpath}"
+	sleep 1
+	echo ""
+}
+
+fn_goldsourceconfig(){
+	fn_defaultconfig
+
+	# server.cfg redirects to ${servercfg} for added security
+	echo "creating server.cfg."
+	fn_script_log_info "creating server.cfg."
+	touch "server.cfg"
+	sleep 1
+	echo "creating redirect."
+	fn_script_log_info "creating redirect."
+	echo "server.cfg > ${servercfg}."
+	echo "exec ${servercfg}" > "server.cfg"
+	sleep 1
+
+	# creating other files required
+	echo "creating listip.cfg."
+	fn_script_log_info "creating listip.cfg."
+	touch "${systemdir}/listip.cfg"
+	sleep 1
+	echo "creating banned.cfg."
+	fn_script_log_info "creating banned.cfg."
+	touch "${systemdir}/banned.cfg"
+	sleep 1
+
+	fn_userinputconfig
+	echo ""
+}
+
+fn_serious3config(){
+	fn_defaultconfig
+	echo ""
+	echo "To edit ${gamename} server config use SS3 Server GUI 3 tool"
+	echo "http://mrag.nl/sgui3/"
+	fn_script_log_info "To edit ${gamename} server config use SS3 Server GUI 3 tool"
+	fn_script_log_info "http://mrag.nl/sgui3/"
+	sleep 1
+	echo ""
+}
+
+fn_sourceconfig(){
+	fn_defaultconfig
+
+	# server.cfg redirects to ${servercfg} for added security
+	echo "creating server.cfg."
+	fn_script_log_info "creating server.cfg."
+	touch "server.cfg"
 	sleep 1
+	echo "creating redirect."
+	fn_script_log_info "creating redirect."
+	echo "server.cfg > ${servercfg}."
+	echo "exec ${servercfg}" > "server.cfg"
+	sleep 1
+
+	fn_userinputconfig
+	echo ""
 }
 
-# Copys the default configs from Game-Server-Configs repo to the
-# correct location
-fn_default_config_remote(){
-	for config in "${array_configs[@]}"
-	do
-		# every config is copied
-		echo "copying ${servercfg} config file."
-		fn_script_log_info "copying ${servercfg} config file."
-		if [ "${config}" == "${servercfgdefault}" ]; then
-			cp -v "${lgsmdir}/default-configs/${config}" "${servercfgfullpath}"
-		elif [ "${config}" == "${networkcfgdefault}" ]; then
-			# ARMA 3
-			cp -v "${lgsmdir}/default-configs/${config}" "${networkcfgfullpath}"
-		else
-			cp -v "${lgsmdir}/default-configs/${config}" "${servercfgdir}/${config}"
-		fi
-	done
+fn_teeworldsconfig(){
+	fn_defaultconfig
+
+	echo "adding logfile location to config."
+	fn_script_log_info "adding logfile location to config."
+	sed -i "s@\"<logfile>\"@\"${gamelog}\"@g" "${servercfgfullpath}"
+	sleep 1
+	echo "removing password holder."
+	fn_script_log_info "removing password holder."
+	sed -i "s/<password>//" "${servercfgfullpath}"
 	sleep 1
+
+	fn_userinputconfig
+	echo ""
+}
+
+fn_ut99config(){
+	echo "creating ${servercfg} config file."
+	fn_script_log_info "creating ${servercfg} config file."
+	echo "${servercfgdefault} > ${servercfgfullpath}"
+	tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
+	sleep 1
+	echo ""
+	echo "Configuring ${gamename} Server"
+	echo "================================="
+	sleep 1
+	echo "enabling WebAdmin."
+	fn_script_log_info "enabling WebAdmin."
+	sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
+	sleep 1
+	echo "setting WebAdmin port to 8076."
+	fn_script_log_info "setting WebAdmin port to 8076."
+	sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
+	sleep 1
+	echo ""
+}
+
+fn_unreal2config(){
+	fn_defaultconfig
+	echo ""
+	echo "Configuring ${gamename} Server"
+	echo "================================="
+	sleep 1
+	echo "setting WebAdmin username and password."
+	fn_script_log_info "setting WebAdmin username and password."
+	sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
+	sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
+	sleep 1
+	echo "enabling WebAdmin."
+	fn_script_log_info "enabling WebAdmin."
+	sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
+	if [ "${gamename}" == "Unreal Tournament 2004" ]; then
+		sleep 1
+		echo "setting WebAdmin port to 8075."
+		fn_script_log_info "setting WebAdmin port to 8075."
+		sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
+	fi
+	sleep 1
+	echo ""
+}
+
+fn_ut3config(){
+	echo ""
+	echo "Configuring ${gamename} Server"
+	echo "================================="
+	sleep 1
+	echo "setting ServerName to 'LinuxGSM UT3 Server'."
+	fn_script_log_info "setting ServerName to 'LinuxGSM UT3 Server'."
+	sleep 1
+	sed -i 's/ServerName=/ServerName=LinuxGSM UT3 Server/g' "${servercfgdir}/DefaultGame.ini"
+	echo "setting WebAdmin password to admin."
+	fn_script_log_info "setting WebAdmin password to admin."
+	echo '[Engine.AccessControl]' >> "${servercfgdir}/DefaultGame.ini"
+	echo 'AdminPassword=admin' >> "${servercfgdir}/DefaultGame.ini"
+	sleep 1
+	echo "enabling WebAdmin."
+	fn_script_log_info "enabling WebAdmin."
+	sed -i 's/bEnabled=false/bEnabled=True/g' "${servercfgdir}/DefaultWeb.ini"
+	if [ "${gamename}" == "Unreal Tournament 3" ]; then
+		sleep 1
+		echo "setting WebAdmin port to 8081."
+		fn_script_log_info "setting WebAdmin port to 8081."
+		sed -i 's/ListenPort=80/ListenPort=8081/g' "${servercfgdir}/DefaultWeb.ini"
+	fi
+	sleep 1
+	echo ""
+}
+
+fn_unrealtournament(){
+	# allow user to input server name and password
+	if [ -z "${autoinstall}" ]; then
+		echo ""
+		echo "Configuring ${gamename} Server"
+		echo "================================="
+		sleep 1
+		read -p "Enter server name: " servername
+		read -p "Enter rcon password: " rconpass
+	else
+		servername="${servicename}"
+		rconpass="rconpassword"
+	fi
+	echo "changing hostname."
+	fn_script_log_info "changing hostname."
+	sed -i "s/\"<hostname>\"/\"${servername}\"/g" "${servercfgdir}/Game.ini"
+	sleep 1
+	echo "changing rconpassword."
+	fn_script_log_info "changing rconpassword."
+	sed -i "s/\"<rconpassword>\"/\"${rconpass}\"/g" "${servercfgdir}/Engine.ini"
+	sleep 1
+
 }
 
 echo ""
-echo "Downloading ${gamename} Config"
+if [ "${gamename}" != "Hurtworld" ]; then
+echo "Creating Configs"
 echo "================================="
-echo "default configs from https://github.com/GameServerManagers/Game-Server-Configs"
-sleep 2
+sleep 1
+	mkdir -pv "${servercfgdir}"
+	cd "${servercfgdir}"
+	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}"
+fi
+
 if [ "${gamename}" == "7 Days To Die" ]; then
-	gamedirname="7DaysToDie"
-	array_configs+=( serverconfig.xml )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	fn_defaultconfig
 elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
-	gamedirname="ARKSurvivalEvolved"
-	array_configs+=( GameUserSettings.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	wget -N /dev/null ${githuburl}/ARKSurvivalEvolved/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	echo -e "downloading lgsm-default.ini...\c"
+	fn_defaultconfig
 elif [ "${gamename}" == "ARMA 3" ]; then
-	gamedirname="Arma3"
-	array_configs+=( server.cfg network.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Battlefield: 1942" ]; then
-	gamedirname="Battlefield1942"
-	array_configs+=( serversettings.con )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Blade Symphony" ]; then
-	gamedirname="BladeSymphony"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.server.cfg...\c"
+	wget -N /dev/null ${githuburl}/Arma3/cfg/lgsm-default.server.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	echo -e "downloading lgsm-default.network.cfg...\c"
+	wget -N /dev/null ${githuburl}/Arma3/cfg/lgsm-default.network.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_arma3config
 elif [ "${gamename}" == "BrainBread 2" ]; then
-	gamedirname="BrainBread2"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/BrainBread2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Black Mesa: Deathmatch" ]; then
-	gamedirname="BlackMesa"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/BlackMesa/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
+elif [ "${gamename}" == "Blade Symphony" ]; then
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
+elif [ "${gamename}" == "Call of Duty: World at War" ]; then
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CallOfDutyWorldAtWar/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
+	fn_userinputconfig
 elif [ "${gamename}" == "Codename CURE" ]; then
-	gamedirname="CodenameCURE"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CodenameCURE/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Counter-Strike 1.6" ]; then
-	gamedirname="CounterStrike"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
 elif [ "${gamename}" == "Counter-Strike: Condition Zero" ]; then
-	gamedirname="CounterStrikeConditionZero"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CounterStrikeConditionZero/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
 elif [ "${gamename}" == "Counter-Strike: Global Offensive" ]; then
-	gamedirname="CounterStrikeGlobalOffensive"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Counter-Strike: Source" ]; then
-	gamedirname="CounterStrikeSource"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/CounterStrikeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Day of Defeat" ]; then
-	gamedirname="DayOfDefeat"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/DayOfDefeat/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
 elif [ "${gamename}" == "Day of Defeat: Source" ]; then
-	gamedirname="DayOfDefeatSource"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/DayOfDefeatSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Day of Infamy" ]; then
-	gamedirname="DayOfInfamy"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Deathmatch Classic" ]; then
-	gamedirname="DeathmatchClassic"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/DayOfInfamy/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Don't Starve Together" ]; then
-	gamedirname="DontStarveTogether"
-	array_configs+=( Settings.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.ini...\c"
+	wget -N /dev/null ${githuburl}/DontStarveTogether/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "Double Action: Boogaloo" ]; then
-	gamedirname="DoubleActionBoogaloo"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/DoubleActionBoogaloo/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
+elif [ "${gamename}" == "Empires Mod" ]; then
+	fn_defaultconfig
+elif [ "${gamename}" == "Enemy Territory" ]; then
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/EnemyTerritory/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
+	fn_userinputconfig
+	echo ""
 elif [ "${gamename}" == "Fistful of Frags" ]; then
-	gamedirname="FistfulofFrags"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/FistfulOfFrags/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Garry's Mod" ]; then
-	gamedirname="GarrysMod"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/GarrysMod/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "GoldenEye: Source" ]; then
-	gamedirname="GoldenEyeSource"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Half Life: Deathmatch" ]; then
-	gamedirname="HalfLifeDeathmatch"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Half-Life Deathmatch: Source" ]; then
-	gamedirname="HalfLifeDeathmatchSource"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Half-Life: Opposing Force" ]; then
-	gamedirname="OpposingForce"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/GoldenEyeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
-	gamedirname="HalfLife2Deathmatch"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/HalfLife2Deathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
+elif [ "${gamename}" == "Half Life: Deathmatch" ]; then
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/HalfLifeDeathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
 elif [ "${gamename}" == "Insurgency" ]; then
-	gamedirname="Insurgency"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/Insurgency/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Just Cause 2" ]; then
-	gamedirname="JustCause2"
-	array_configs+=( config.lua )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	fn_defaultconfig
 elif [ "${gamename}" == "Killing Floor" ]; then
-	gamedirname="KillingFloor"
-	array_configs+=( Default.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Left 4 Dead" ]; then
-	gamedirname="Left4Dead"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	fn_unreal2config
 elif [ "${gamename}" == "Left 4 Dead" ]; then
-	gamedirname="Left4Dead"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/Left4Dead/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Left 4 Dead 2" ]; then
-	gamedirname="Left4Dead2"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/Left4Dead2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Minecraft" ]; then
-	gamedirname="Minecraft"
-	array_configs+=( server.properties )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.ini...\c"
+	wget -N /dev/null ${githuburl}/Minecraft/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "No More Room in Hell" ]; then
-	gamedirname="NoMoreRoominHell"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Mumble" ]; then
-	:
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/NoMoreRoomInHell/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Natural Selection 2" ]; then
-	:
-elif [ "${gamename}" == "NS2: Combat" ]; then
-	:
+	echo -e "no configs required."
+	sleep 1
+	echo ""
 elif [ "${gamename}" == "Pirates, Vikings, and Knights II" ]; then
-	gamedirname="PiratesVikingandKnightsII"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/PiratesVikingandKnightsII/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Project Zomboid" ]; then
-	gamedirname="ProjectZomboid"
-	array_configs+=( server.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.ini...\c"
+	wget -N /dev/null ${githuburl}/ProjectZomboid/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "Quake Live" ]; then
-	gamedirname="QuakeLive"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/QuakeLive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
+	fn_userinputconfig
 elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
-	:
-elif [ "${gamename}" == "Ricochet" ]; then
-	gamedirname="Ricochet"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Rust" ]; then
-	gamedirname="Rust"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	fn_unreal2config
 elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
-	gamedirname="SeriousSam3BFE"
-	array_configs+=( server.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Starbound" ]; then
-	gamedirname="Starbound"
-	array_configs+=( starbound.config )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.ini...\c"
+	wget -N /dev/null ${githuburl}/SeriousSam3BFE/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_serious3config
+elif [ "${gamename}" == "Rust" ]; then
+	echo -e "downloading server.cfg...\c"
+	wget -N /dev/null  ${githuburl}/Rust/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "Sven Co-op" ]; then
-	gamedirname="SvenCoop"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/SvenCoop/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
+elif [ "${gamename}" == "Starbound" ]; then
+	echo -e "downloading lgsm-default.config...\c"
+	wget -N /dev/null ${githuburl}/Starbound/cfg/lgsm-default.config 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
+	fn_userinputconfig
+elif [ "${gamename}" == "TeamSpeak 3" ]; then
+	echo -e "downloading lgsm-default.ini...\c"
+	wget -N /dev/null ${githuburl}/TeamSpeak3/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "Team Fortress 2" ]; then
-	gamedirname="TeamFortress2"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/TeamFortress2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_sourceconfig
 elif [ "${gamename}" == "Team Fortress Classic" ]; then
-	gamedirname="TeamFortressClassic"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "TeamSpeak 3" ]; then
-	gamedirname="TeamSpeak3"
-	array_configs+=( ts3server.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_goldsourceconfig
 elif [ "${gamename}" == "Teeworlds" ]; then
-	gamedirname="Teeworlds"
-	array_configs+=( server.cfg ctf.cfg dm.cfg duel.cfg tdm.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading ctf.cfg...\c"
+	wget -N /dev/null ${githuburl}/Teeworlds/cfg/ctf.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading dm.cfg...\c"
+	wget -N /dev/null ${githuburl}/Teeworlds/cfg/dm.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading duel.cfg...\c"
+	wget -N /dev/null ${githuburl}/Teeworlds/cfg/duel.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading tdm.cfg...\c"
+	wget -N /dev/null ${githuburl}/Teeworlds/cfg/tdm.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading lgsm-default.cfg...\c"
+	wget -N /dev/null ${githuburl}/Teeworlds/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_teeworldsconfig
 elif [ "${gamename}" == "Terraria" ]; then
-	gamedirname="Terraria"
-	array_configs+=( serverconfig.txt )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading lgsm-default.txt...\c"
+	wget -N /dev/null ${githuburl}/Terraria/cfg/lgsm-default.txt 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_defaultconfig
 elif [ "${gamename}" == "Unreal Tournament" ]; then
-	gamedirname="UnrealTournament"
-	array_configs+=( Game.ini Engine.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
-	gamedirname="UnrealTournament2004"
-	array_configs+=( UT2004.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	echo -e "downloading Engine.ini...\c"
+	wget -N /dev/null ${githuburl}/UnrealTournament/cfg/Engine.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	echo -e "downloading Game.ini...\c"
+	wget -N /dev/null ${githuburl}/UnrealTournament/cfg/Game.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
+	sleep 1
+	fn_unrealtournament
 elif [ "${gamename}" == "Unreal Tournament 3" ]; then
-	gamedirname="UnrealTournament3"
-	array_configs+=( UTGame.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
+	fn_ut3config
+elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
+	fn_unreal2config
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then
-	gamedirname="UnrealTournament99"
-	array_configs+=( Default.ini )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
-	gamedirname="WolfensteinEnemyTerritory"
-	array_configs+=( server.cfg )
-	fn_fetch_default_config
-	fn_default_config_remote
-	fn_set_config_vars
-fi
-
+	fn_ut99config
+fi
\ No newline at end of file
diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh
index e2778ae64..663275490 100644
--- a/lgsm/functions/install_server_files.sh
+++ b/lgsm/functions/install_server_files.sh
@@ -23,6 +23,8 @@ fn_install_server_files(){
 		fileurl="http://files.gameservermanagers.com/UnrealTournament/UnrealTournament-Server-XAN-3045522-Linux.zip"; filedir="${tmpdir}"; filename="UnrealTournament-Server-XAN-3045522-Linux.zip";  executecmd="noexecute" run="norun"; force="noforce"; md5="553fed5645a9fc623e92563049bf79f6"
 	elif [ "${gamename}" == "GoldenEye: Source" ]; then
 		fileurl="http://files.gameservermanagers.com/GoldenEyeSource/GoldenEye_Source_v5.0.1_full_server_linux.tar.bz2"; filedir="${tmpdir}"; filename="GoldenEye_Source_v5.0.1_server_full_Linux.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="ea227a150300abe346e757380325f84c"
+	elif [ "${gamename}" == "Call of Duty: World at War" ]; then
+		fileurl="https://s3.amazonaws.com/linuxgsm/codwaw-lnxded-1.7-full.tar.bz2"; filedir="${tmpdir}"; filename="codwaw-lnxded-1.7-full.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="0489697ff3bf678c109bfb377d1b7895"
 	fi
 	fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
 	fn_dl_extract "${filedir}" "${filename}" "${filesdir}"