Forums

[script] AgeOfEmpires III Add-ons

Auteur Réponses
NSLW Mercredi 2 Décembre 2009 à 16:17
NSLW

Hello,
I wrote script which installs add-ons for AgeOfEmpires III. Game can be patched after installation.
Wine version : 1.1.33
Distribution : Fedora
Distribution Version : 12 (32 bit)
Graphics card : Nvidia, GeForce 9xxx
Drivers of the graphics card : 195.22

AgeOfEmpires III - The WarChiefs
Icon for the game:


#!/bin/bash
# Date : (2009-12-02 15-30)
# Last revision : (2009-12-02 15-30)
# Wine version used : 1.1.33
# Distribution used to test : Fedora 12
# Author : NSLW
# Licence : Retail
# Depend : -

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TYTUL="Age of Empires III - The WarChiefs"
PREFIX="AOE3"
PATCHVERSION="105"
 
#procedure for patching Age of Empires III
patch_aoe3()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine $APP_ANSWER
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}

Get_Latest_Wine_Version()
{
wget http://mulx.playonlinux.com/wine/linux-i386/LIST --output-document="$REPERTOIRE/tmp/LIST"
xyz=`cat "$REPERTOIRE/tmp/LIST" | sed -e 's/\\.//g' | cut -d';' -f2 | sort -n | tail -n1`
echo "$(echo $xyz | cut -c1-1).$(echo $xyz | cut -c2-2).$(echo $xyz | cut -c3-4)"
}

POL_SetupWindow_make_icon_for_shortcut()
{
convert "$HOME/.local/share/icons/$2" -geometry 32X32 "$REPERTOIRE/icones/32/$1"
}

wget http://upload.wikimedia.org/wikipedia/en/8/83/AgeIIITheWarChiefs.jpg --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"

POL_SetupWindow_presentation "$TYTUL" "Ensemble Studios" "www.ageofempires3.com" "NSLW" "$PREFIX" 
 
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TYTUL" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Patch game" "~"

if [ "$APP_ANSWER" == "Patch game" ]; then
	patch_aoe3
fi

POL_SetupWindow_Close
exit
fi

cd "$REPERTOIRE/ressources/"
#determining which Version is the latest
LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"

POL_SetupWindow_install_wine "$CHOSENWINEVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

POL_SetupWindow_message "Please insert $TYTUL media into your disk drive."
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Age of Empires III - The WarChiefs.msi"

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
CHECK=$(find . -iwholename ./setup.exe)

if [ "$CHECK" == "" ]; then
wine "instalar.exe"
else
wine "setup.exe"
fi

POL_SetupWindow_detect_exit

cd "$WINEPREFIX/drive_c/windows/temp/"

#making shortcut
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Microsoft Games/Age of Empires III" "age3x.exe" "" "$TYTUL" "" ""
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_make_icon_for_shortcut "$TYTUL" "*_age3x.0.png"

#cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *

POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

killall IDriver.exe
killall setup.exe

#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ]; then

POL_SetupWindow_menu "What installer should do?" "Actions" "Let me choose patch manually~Download patch automatically" "~"

if [ "$APP_ANSWER" == "Let me choose patch manually" ]; then
patch_aoe3
elif [ "$APP_ANSWER" == "Download patch automatically" ]
	then
	POL_SetupWindow_menu "What is your language version?" "Languages" "english~french~italian~german~spanish~brazilian~polish~japanese~korean~chinese~czech~hungarian~russian" "~"
	LANGUAGEVERSION=$APP_ANSWER
	if [ "$APP_ANSWER" == "english" ]; then
	LANGUAGEVERSIONSHRT="EN"
	elif [ "$APP_ANSWER" == "french" ]
	then
	LANGUAGEVERSIONSHRT="FR"
	elif [ "$APP_ANSWER" == "italian" ]
	then
	LANGUAGEVERSIONSHRT="IT"
	elif [ "$APP_ANSWER" == "german" ]
	then
	LANGUAGEVERSIONSHRT="DE"
	elif [ "$APP_ANSWER" == "spanish" ]
	then
	LANGUAGEVERSIONSHRT="ES"
	elif [ "$APP_ANSWER" == "brazilian" ]
	then
	LANGUAGEVERSIONSHRT="BP"
	elif [ "$APP_ANSWER" == "polish" ]
	then
	LANGUAGEVERSIONSHRT="PL"
	elif [ "$APP_ANSWER" == "japanese" ]
	then
	LANGUAGEVERSIONSHRT="JP"
	elif [ "$APP_ANSWER" == "korean" ]
	then
	LANGUAGEVERSIONSHRT="KOR"
	elif [ "$APP_ANSWER" == "chinese" ]
	then
	LANGUAGEVERSIONSHRT="CHT"
	elif [ "$APP_ANSWER" == "czech" ]
	then
	LANGUAGEVERSIONSHRT="CZE"
	elif [ "$APP_ANSWER" == "hungarian" ]
	then
	LANGUAGEVERSIONSHRT="HU"
	elif [ "$APP_ANSWER" == "russian" ]
	then
	LANGUAGEVERSIONSHRT="RU"
	fi

	cd "$REPERTOIRE/ressources"
	#downloading patch
	if [ ! -e "aoe3x-$PATCHVERSION-${LANGUAGEVERSION}.exe" ]; then
	POL_SetupWindow_download "PlayOnLinux is downloading aoe3-$PATCHVERSION-${LANGUAGEVERSION}.exe" "Downloading patch" "http://aom.zone.com/MGS/ES/loc/patchx$PATCHVERSION/$LANGUAGEVERSIONSHRT/aoe3x-$PATCHVERSION-${LANGUAGEVERSION}.exe"
	fi
	POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
	wine "aoe3x-$PATCHVERSION-${LANGUAGEVERSION}.exe"
	POL_SetupWindow_detect_exit
	POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"	
fi

fi

POL_SetupWindow_message_image "Enable V-Sync in game\\notherwise you won't be able to run game second time\\n(tip by Oisin O Malley)" "Note about V-sync" "$PLAYONLINUX/themes/tango/warning.png"

POL_SetupWindow_message_image "Please note that this game has a copy protection system\\nand sadly, it prevents Wine from running the game.\\n\\nPlayOnLinux will not provide any help concerning any illegal\\nstuff." "Note about copy protection" "$PLAYONLINUX/themes/tango/warning.png"

POL_SetupWindow_Close
exit


Age of Empires III - The Asian Dynasties

Icon for the game:


#!/bin/bash
# Date : (2009-12-02 15-30)
# Last revision : (2009-12-02 15-30)
# Wine version used : 1.1.33
# Distribution used to test : Fedora 12
# Author : NSLW
# Licence : Retail
# Depend : -

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

TYTUL="Age of Empires III - The Asian Dynasties"
PREFIX="AOE3"
PATCHVERSION="102"
 
#procedure for patching Age of Empires III
patch_aoe3()
{
POL_SetupWindow_browse "Select patch file" "$TYTUL" ""
wine $APP_ANSWER
POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"
}

Get_Latest_Wine_Version()
{
wget http://mulx.playonlinux.com/wine/linux-i386/LIST --output-document="$REPERTOIRE/tmp/LIST"
xyz=`cat "$REPERTOIRE/tmp/LIST" | sed -e 's/\\.//g' | cut -d';' -f2 | sort -n | tail -n1`
echo "$(echo $xyz | cut -c1-1).$(echo $xyz | cut -c2-2).$(echo $xyz | cut -c3-4)"
}

POL_SetupWindow_make_icon_for_shortcut()
{
convert "$HOME/.local/share/icons/$2" -geometry 32X32 "$REPERTOIRE/icones/32/$1"
}

wget http://upload.wikimedia.org/wikipedia/en/c/c7/Tad_box.jpg --output-document="$REPERTOIRE/tmp/leftnotscaled.jpeg"
convert "$REPERTOIRE/tmp/leftnotscaled.jpeg" -scale 150x356\\! "$REPERTOIRE/tmp/left.jpeg"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.jpeg"

POL_SetupWindow_presentation "$TYTUL" "Ensemble Studios" "www.ageofempires3.com" "NSLW" "$PREFIX" 
 
select_prefix "$REPERTOIRE/wineprefix/$PREFIX"

#asking about patching or updating Wine version
if [ -e "$REPERTOIRE/configurations/installed/$TYTUL" ]; then
POL_SetupWindow_menu "What do you want to do?" "Actions" "Patch game" "~"

if [ "$APP_ANSWER" == "Patch game" ]; then
	patch_aoe3
fi

POL_SetupWindow_Close
exit
fi

cd "$REPERTOIRE/ressources/"
#determining which Version is the latest
LATESTVERSION=$(Get_Latest_Wine_Version)
CHOSENWINEVERSION="$LATESTVERSION"

POL_SetupWindow_install_wine "$CHOSENWINEVERSION"
Use_WineVersion "$CHOSENWINEVERSION"

#fetching PROGRAMFILES environmental variable
PROGRAMFILES=`wine cmd /c echo "%ProgramFiles%"`
PROGRAMFILES=${PROGRAMFILES:3}

POL_SetupWindow_message "Please insert $TYTUL media into your disk drive."
POL_SetupWindow_cdrom
POL_SetupWindow_check_cdrom "Age of Empires III - The Asian Dynasties.msi"

#starting installation
POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
cd "$CDROM"
CHECK=$(find . -iwholename ./setup.exe)

if [ "$CHECK" == "" ]; then
wine "instalar.exe"
else
wine "setup.exe"
fi

POL_SetupWindow_detect_exit

cd "$WINEPREFIX/drive_c/windows/temp/"

#making shortcut
POL_SetupWindow_make_shortcut "$PREFIX" "$PROGRAMFILES/Microsoft Games/Age of Empires III" "age3y.exe" "" "$TYTUL" "" ""
Set_WineVersion_Assign "$CHOSENWINEVERSION" "$TYTUL"
POL_SetupWindow_make_icon_for_shortcut "$TYTUL" "*_age3y.0.png"

#cleaning temp
cd "$WINEPREFIX/drive_c/windows/temp/"
rm -rf *

POL_SetupWindow_message "$TYTUL has been installed successfully" "$TYTUL"

killall IDriver.exe
killall setup.exe

#asking about patching
POL_SetupWindow_question "Do you want to patch your game?" "$TYTUL" 
if [ "$APP_ANSWER" == "TRUE" ]; then

POL_SetupWindow_menu "What installer should do?" "Actions" "Let me choose patch manually~Download patch automatically" "~"

if [ "$APP_ANSWER" == "Let me choose patch manually" ]; then
patch_aoe3
elif [ "$APP_ANSWER" == "Download patch automatically" ]
	then
	POL_SetupWindow_menu "What is your language version?" "Languages" "english~french~italian~german~spanish~brazilian~polish~japanese~korean~chinese~czech~hungarian~russian" "~"
	LANGUAGEVERSION=$APP_ANSWER
	if [ "$APP_ANSWER" == "english" ]; then
	LANGUAGEVERSIONSHRT="EN"
	elif [ "$APP_ANSWER" == "french" ]
	then
	LANGUAGEVERSIONSHRT="FR"
	elif [ "$APP_ANSWER" == "italian" ]
	then
	LANGUAGEVERSIONSHRT="IT"
	elif [ "$APP_ANSWER" == "german" ]
	then
	LANGUAGEVERSIONSHRT="DE"
	elif [ "$APP_ANSWER" == "spanish" ]
	then
	LANGUAGEVERSIONSHRT="ES"
	elif [ "$APP_ANSWER" == "brazilian" ]
	then
	LANGUAGEVERSIONSHRT="BP"
	elif [ "$APP_ANSWER" == "polish" ]
	then
	LANGUAGEVERSIONSHRT="PL"
	elif [ "$APP_ANSWER" == "japanese" ]
	then
	LANGUAGEVERSIONSHRT="JP"
	elif [ "$APP_ANSWER" == "korean" ]
	then
	LANGUAGEVERSIONSHRT="KOR"
	elif [ "$APP_ANSWER" == "chinese" ]
	then
	LANGUAGEVERSIONSHRT="CHT"
	elif [ "$APP_ANSWER" == "czech" ]
	then
	LANGUAGEVERSIONSHRT="CZE"
	elif [ "$APP_ANSWER" == "hungarian" ]
	then
	LANGUAGEVERSIONSHRT="HU"
	elif [ "$APP_ANSWER" == "russian" ]
	then
	LANGUAGEVERSIONSHRT="RU"
	fi

	cd "$REPERTOIRE/ressources"
	#downloading patch
	if [ ! -e "aoe3y-$PATCHVERSION-${LANGUAGEVERSION}.exe" ]; then
	POL_SetupWindow_download "PlayOnLinux is downloading aoe3-$PATCHVERSION-${LANGUAGEVERSION}.exe" "Downloading patch" "http://aom.zone.com/MGS/ES/loc/patchy$PATCHVERSION/$LANGUAGEVERSIONSHRT/aoe3y-$PATCHVERSION-${LANGUAGEVERSION}.exe"
	fi
	POL_SetupWindow_wait_next_signal "Installation in progress..." "$TYTUL"
	wine "aoe3y-$PATCHVERSION-${LANGUAGEVERSION}.exe"
	POL_SetupWindow_detect_exit
	POL_SetupWindow_message "Patch for $TYTUL has been installed successfully" "$TYTUL"	
fi

fi

POL_SetupWindow_message_image "Enable V-Sync in game\\notherwise you won't be able to run game second time\\n(tip by Oisin O Malley)" "Note about V-sync" "$PLAYONLINUX/themes/tango/warning.png"

POL_SetupWindow_message_image "Please note that this game has a copy protection system\\nand sadly, it prevents Wine from running the game.\\n\\nPlayOnLinux will not provide any help concerning any illegal\\nstuff." "Note about copy protection" "$PLAYONLINUX/themes/tango/warning.png"

POL_SetupWindow_Close
exit