Scripts

Script for Guild Wars

#!/bin/bash
if [ "$PLAYONLINUX" = "" ]
then
exit 0
fi
source "$PLAYONLINUX/lib/sources"

cfg_check
maxStep=13

presentation "Guild Wars" "NCsoft" "http://www.guildwars.com" "Tinou, modifié par MulX" "GuildWars" 1 $maxStep
if [ $LANG == "fr_FR.UTF-8" ] ; then
LNG_CD="Disposez vous du CD ?"
COPY="Copie des fichiers ..."
DOWNLOAD="Patientez pendant le téléchargement des fichiers minimal pour le jeu"
EXTRACT="Patientez pendant l'extraction des fichiers minimal de Guild Wars"
CD2="Inserer le CD2"
CD1="Inserer le CD1"
SWITCHCD="Cliquez sur Suivant ou OK quand le jeu demande le CD2"
ENDCD="Quand l'installation a fini, fermer le jeu, puis cliquez sur OK"
DVD="Disposez vous du DVD ?"
else
LNG_CD="Do you have CD ?"
COPY="Copying files ..."
DOWNLOAD="Please wait during downloading minimal file for game"
EXTRACT="Please wait during unziping minimal file for game"
CD2="Please, insert CD2"
CD1="Please, insert CD1"
SWITCHCD="Press next or OK, when game ask for cd2"
ENDCD="When setup is finished, close game, and press ok or next"
DVD="Do you have the DVD ?"
fi



mkdir -p $REPERTOIRE/wineprefix/GuildWars/
rm $REPERTOIRE/tmp/GuildWars/ -R
mkdir -p $REPERTOIRE/tmp/GuildWars
cd $REPERTOIRE/tmp/GuildWars
telecharger "$DOWNLOAD" "$SITE/divers/Gw.zip" "" 2 $maxStep
select_prefixe "$HOME/.PlayOnLinux/wineprefix/GuildWars/"
creer_prefixe 3 $maxStep
#Installing minimal file
attendre "$EXTRACT" "unzip Gw.zip" "" 4 $maxStep
mkdir -p $REPERTOIRE/wineprefix/GuildWars/drive_c/GW
cp ./Gw.exe $REPERTOIRE/wineprefix/GuildWars/drive_c/GW/.
regedit ./Gw.reg

#Asking for dvd drive
reponse=$(question "$DVD" "" "5" $maxStep)
if [ $reponse == "0" ] ; then
Ask_For_cdrom
Check_cdrom "/Data/Gw/Gw.dat"
#Here is it the spet 13 because we don't support use of CD and DVD (and DVD is easier of use than CD)
attendre "$COPY" "cp $CDROM/Data/Gw/Gw.dat $REPERTOIRE/wineprefix/GuildWars/drive_c/GW/Gw.dat" "" 13 $maxStep

else #Asking for CDs
reponse=$(question "$LNG_CD" "" "6" $maxStep)
if [ $reponse == "0" ] ; then
mkdir "$REPERTOIRE/tmp/GuildWars/cd1"
mkdir "$REPERTOIRE/tmp/GuildWars/cd2"
message "$CD1" "" 7 $maxStep
Ask_For_cdrom
Check_cdrom "/Data/Gw/Gw.dat"
attendre "$COPY" "cp -ra $CDROM/* $REPERTOIRE/tmp/GuildWars/cd1" "" 8 $maxStep
message "$CD2" "" 9 $maxStep
Ask_For_cdrom
Check_cdrom "/Data/Gw/Gw2.dat"
attendre "$COPY" "cp -ar $CDROM/* $REPERTOIRE/tmp/GuildWars/cd2" "" 10 $maxStep
chmod +rwx $REPERTOIRE/tmp/GuildWars/ -R
mv $REPERTOIRE/tmp/GuildWars/cd1 $REPERTOIRE/tmp/GuildWars/current
#We need to use wine :'(
wine "$REPERTOIRE/tmp/GuildWars/current/Setup.exe"
message "$SWITCHCD" "" 11 $maxStep
mv $REPERTOIRE/tmp/GuildWars/current $REPERTOIRE/tmp/GuildWars/cd1
mv $REPERTOIRE/tmp/GuildWars/cd2 $REPERTOIRE/tmp/GuildWars/current
message "$ENDCD" "" 12 $maxStep
fi
fi
#fix a bug of the next command when answer is no.
touch "$REPERTOIRE/wineprefix/GuildWars/drive_c/GW/Gw.dat"
#fix a bug when file created is not rw
chmod +rw "$REPERTOIRE/wineprefix/GuildWars/drive_c/GW/Gw.dat"

creer_lanceur "GuildWars" "GW/" "Gw.exe" "GuildWars.xpm" "Guild Wars" "" "-dsound"
#ATI Chipset need wine 0.9.46, can work with other wine release but no sure.
#So we do a basic check : if fglrx is loaded we set Wine to version 0.9.46
#Else we use the installed release of Wine.
if [ $(lsmod | grep -q "fglrx") ] ; then
Set_WineVersion_Assign "0.9.46" "Guild Wars"
else
Set_WineVersion_Assign "0.9.58" "Guild Wars"
fi

rm $REPERTOIRE/tmp/GuildWars/ -R
exit