The forum

Blizzard's Battle.net App

RFC

Author Replies
Cromrots Thursday 3 July 2014 at 13:53
Cromrots

Had this one on the shelve for a while and requested authentication a while ago, but I'll just put it public by means of this forum.

Allows for multiple versions of the Battle.net app in several wine prefixies, so you can install the hosted games seperately if you wish to do so.

 

---- >8 ---- >8 ----

 

#!/bin/bash
# Date : (2014-01-02 21:45)
# Last revision : (2014-01-10 13:37)
# Wine version used : 1.7.11
# Distribution used to test : Linux Mint 16
# Author : Cromrots 
# 
# Based on 'Starcraft II' pol script found on PoL forums
# by shark711 - 2013-05-28
#

##
# http://appdb.winehq.org/objectManager.php?sClass=application&iId=15365
#
# This installer is for the Battle.net App, which is a lancher/installer/updater tool in one
# Having just this app installed gives access to all modern games connected to battle.net in one
#
# Sometimes these seperate games require specific settings to run, which may conflict with other games.
# To allow such flexiblity, the user is given the option to choose a different prefix, if so required.
#

[ "$PLAYONLINUX" == "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
  
TITLE="Blizzard's Battle.net desktop app"
DEVELOPER="Activision / Blizzard Entertainment"
PREFIX="Battle.net" # sane default
NAME="$PREFIX"
WINEVERSION="1.7.11"
WINEOS="winxp"
GAME_VMS="1024"
DLURLBASE="http://dist.blizzard.com/downloads/bna-installers/322d5bb9ae0318de3d4cde7641c96425/beta.3"
ICONPATH="$SITE/setups/battle.net/"
if [[ -f "$HOME/battle.net.top.png" ]]
then
    ICONPATH="$HOME"
fi

cfg_check
POL_SetupWindow_Init "$ICONPATH/battle.net.top.png" "$ICONPATH/battle.net.left.jpg"
POL_Debug_Init

##

POL_SetupWindow_presentation "$TITLE" "$DEVELOPER" "http://us.battle.net" "Cromrots" "$PREFIX"


POL_SetupWindow_menu "$(eval_gettext 'Please select your preferred prefix.')\n$(eval_gettext 'Some games may require specific settings and may not run from the same installation.')" "$TITLE" "Battle.net~World Of Warcraft~Diablo III~Starcraft II~Hearthstone~Heroes of the Storm" "~"
case "$APP_ANSWER" in
    "Battle.net")           PREFIX="Battle.net" ;;
    "World Of Warcraft")    PREFIX="World_Of_Warcraft" ;;
    "Diablo III")           PREFIX="Diablo_III" ;;
    "Starcraft II")         PREFIX="Starcraft_II" ;;
    "Hearthstone")          PREFIX="Hearthstone" ;;
    "Heroes of the Storm")  PREFIX="Heroes_of_the_Storm" ;;
esac
NAME=$APP_ANSWER

POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"

LOCALE="enUS"
INSTALLER=""
INSTALLER_PATH=""
DLURL=""
case "$INSTALL_METHOD" in
    "LOCAL")
        cd "$HOME"
        POL_SetupWindow_browse "$(eval_gettext 'Please select the installation file to run.')"
        INSTALLER_PATH="$APP_ANSWER"
        LOCALE="$($(Battle.net-Beta-Setup-enUS.exe/.*-/)/.exe/)"
    ;;
    "DOWNLOAD")

        POL_SetupWindow_menu "$(eval_gettext 'Please select the game language.')" "$TITLE" "English (US)~Español (AL)~Português (BR)~English (EU)~English (SG)~Español (EU)~Deutsch~Français~Italiano~Polski~Русский~한국어~繁體中文~简体中文" "~"
        case "$APP_ANSWER" in
            "English (US)")     LOCALE="enUS" ;;
            "Español (AL)")     LOCALE="esMX" ;;
            "Português (BR)")   LOCALE="ptBR" ;;
            "English (EU)")     LOCALE="enGB" ;;
            "English (SG)")     LOCALE="enSG" ;;
            "Español (EU)")     LOCALE="esES" ;;
            "Deutsch")          LOCALE="deDE" ;;
            "Français")         LOCALE="frFR" ;;
            "Italiano")         LOCALE="itIT" ;;
            "Polski")           LOCALE="plPL" ;;
            "Русский")          LOCALE="ruRU" ;;
            "한국어")           LOCALE="koKR" ;;
            "繁體中文")         LOCALE="zhTW" ;;
            "简体中文")         LOCALE="zhCN" ;;
        esac

        INSTALLER="Battle.net-Beta-Setup-$LOCALE.exe"
        DLURL="$DLURLBASE/$INSTALLER"
      ;;
esac

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"
Set_OS "$WINEOS"
POL_System_TmpCreate "$PREFIX"

POL_Call POL_Internal_InstallFonts

# After this point the installer does not require much interaction anymore

if [[ "$DLURL" ]]
then
    cd "$POL_System_TmpDir"
    POL_Download "$DLURL"
    INSTALLER_PATH="$POL_System_TmpDir/$INSTALLER"
fi

POL_Wine_OverrideDLL "disabled" "dbghelp"
POL_Wine_OverrideDLL "builtin" "dnsapi"
POL_Wine_OverrideDLL "native,builtin" "mshtml"
POL_Wine_OverrideDLL "native,builtin" "msvcr80"
POL_Wine_OverrideDLL "native,builtin" "msvcp100"

POL_Wine_WaitBefore "winhttp"
POL_Download "http://www.depannagedisquedur.fr/dll/winhttp.dll"
mv "winhttp.dll" "$WINEPREFIX/drive_c/windows/system32/"
POL_Wine_OverrideDLL "native,builtin" "winhttp"

POL_Call POL_Install_vcrun2010
POL_Call POL_Install_corefonts

# POL_Wine_WaitBefore "$TITLE"
POL_Wine "$INSTALLER_PATH"
POL_Wine_WaitExit "$TITLE" --allow-kill

# The installer failed, because Agent.exe got updated and it can't handle the truth!
# So jerry righ the Agent, and retry
#
if [[ ! -e "$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe" ]]
then
    killall -15 Agent.exe

    latest_agent=($(find "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/" -name Agent\* -type d -exec basename {} \; | sort -Vr))
    if (( ${#latest_agent[@]} > 0 ))
    then
        cp "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/${latest_agent[0]}/Agent.exe" "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/"

        POL_SetupWindow_pulsebar "Cannot find '$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe', restarting ${latest_agent[0]} to retry"
        for (( step=0; step<100; step=step+10 ))
        do
            if (( $step==50 ))
            then
                POL_Wine "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/Agent.exe" --nohttpauth --switcherall --locale="$LOCALE" &
            fi
            sleep 1;
            POL_SetupWindow_pulse $step
        done

#         POL_Wine_WaitBefore "$TITLE"
        POL_Wine "$INSTALLER_PATH"
        POL_Wine_WaitExit "$TITLE" --allow-kill
   fi
fi

POL_Shortcut "Battle.net.exe" "$NAME"

POL_System_TmpDelete
POL_SetupWindow_VMS $GAME_VMS
POL_Wine_SetVideoDriver
 
POL_SetupWindow_Close
exit

battle.net.left.jpg : http://bit.ly/VHwfXb

battle.net.top.png : http://bit.ly/1khLOKu

Battle.net.pol : http://bit.ly/1qAZQhP

 

Edited by Cromrots

plazma Thursday 28 May 2015 at 17:24
plazma

is it working now ?


An utter, total failure. | There 's no place like ~ | There are 10 types of people in the world : Those who understand binary, and those who don't.
Cromrots Friday 29 May 2015 at 12:48
Cromrots

I've installed and reinstalled succesfully with this script myself. I have installed setups for Starcraft II, Heartstone, and most recently the Heroes of the Storm when I got invited to the beta.

Only just checked and the battle.net app is now officially available in retail instead of beta, but the link still works and will automatically update once installed. If you want to download the latest version yourself, just get 'http://dist.blizzard.com/downloads/bna-installers/322d5bb9ae0318de3d4cde7641c96425/retail.1/Battle.net-Setup-enUS.exe' and use the pre-downloaded option in the installer.

 

I'll see if I can commit an change for it, but I haven't had much luck communicating with the PoL team to get my installer approved officially, even in test mode :(

Cromrots Friday 29 May 2015 at 16:31
Cromrots

I've updated the script to install the retail version.

Don't forget to close the installer immediately, and not sign in :)

 

#!/bin/bash
# Date : (2014-01-02 21:45)
# Last revision : (2015-05-29 13:37)
# Wine version used : 1.7.11
# Distribution used to test : Linux Mint 16
# Author : Cromrots 
# 
# Originally based on 'Starcraft II' pol script found on PoL forums
# by shark711 - 2013-05-28
#

##
# http://appdb.winehq.org/objectManager.php?sClass=application&iId=15365
#
# This installer is for the Battle.net App, which is a lancher/installer/updater tool in one
# Having just this app installed gives access to all modern games connected to battle.net in one
#
# Sometimes these seperate games require specific settings to run, which may conflict with other games.
# To allow such flexiblity, the user is given the option to choose a different prefix, if so required.
#

[ "$PLAYONLINUX" == "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
  
TITLE="Blizzard's Battle.net desktop app"
DEVELOPER="Activision / Blizzard Entertainment"
PREFIX="Battle.net" # sane default
NAME="$PREFIX"
WINEVERSION="1.7.11"
WINEOS="winxp"
GAME_VMS="1024"
DLURLBASE="http://dist.blizzard.com/downloads/bna-installers/322d5bb9ae0318de3d4cde7641c96425/retail.1"
ICONPATH="$SITE/setups/battle.net/"
if [[ -f "$HOME/battle.net.top.png" ]]
then
    ICONPATH="$HOME"
fi

POL_SetupWindow_Init "$ICONPATH/battle.net.top.png" "$ICONPATH/battle.net.left.jpg"
POL_Debug_Init

##

POL_SetupWindow_menu "$(eval_gettext 'Please select your preferred prefix.')\n$(eval_gettext 'Some games may require specific settings and may not run from the same installation.')" "$TITLE" "Battle.net~World Of Warcraft~Diablo III~Starcraft II~Hearthstone~Heroes of the Storm" "~"
case "$APP_ANSWER" in
    "Battle.net")           PREFIX="Battle.net" ;;
    "World Of Warcraft")    PREFIX="World_Of_Warcraft" ;;
    "Diablo III")           PREFIX="Diablo_III" ;;
    "Starcraft II")         PREFIX="Starcraft_II" ;;
    "Hearthstone")          PREFIX="Hearthstone" ;;
    "Heroes of the Storm")  PREFIX="Heroes_of_the_Storm" ;;
esac
NAME=$APP_ANSWER

POL_SetupWindow_presentation "$TITLE" "$DEVELOPER" "http://us.battle.net" "Cromrots" "$PREFIX"

POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"

LOCALE="enUS"
INSTALLER=""
INSTALLER_PATH=""
DLURL=""
case "$INSTALL_METHOD" in
    "LOCAL")
        cd "$HOME"
        POL_SetupWindow_browse "$(eval_gettext 'Please select the installation file to run.')"
        INSTALLER_PATH="$APP_ANSWER"
        LOCALE=${INSTALLER_PATH/*Setup-}
        LOCALE=${LOCALE/.exe}
    ;;
    "DOWNLOAD")

        POL_SetupWindow_menu "$(eval_gettext 'Please select the game language.')" "$TITLE" "English (US)~Español (AL)~Português (BR)~English (EU)~English (SG)~Español (EU)~Deutsch~Français~Italiano~Polski~Русский~한국어~繁體中文~简体中文" "~"
        case "$APP_ANSWER" in
            "English (US)")     LOCALE="enUS" ;;
            "Español (AL)")     LOCALE="esMX" ;;
            "Português (BR)")   LOCALE="ptBR" ;;
            "English (EU)")     LOCALE="enGB" ;;
            "English (SG)")     LOCALE="enSG" ;;
            "Español (EU)")     LOCALE="esES" ;;
            "Deutsch")          LOCALE="deDE" ;;
            "Français")         LOCALE="frFR" ;;
            "Italiano")         LOCALE="itIT" ;;
            "Polski")           LOCALE="plPL" ;;
            "Русский")          LOCALE="ruRU" ;;
            "한국어")           LOCALE="koKR" ;;
            "繁體中文")         LOCALE="zhTW" ;;
            "简体中文")         LOCALE="zhCN" ;;
        esac

        INSTALLER="Battle.net-Setup-$LOCALE.exe"
        DLURL="$DLURLBASE/$INSTALLER"
      ;;
esac

# After this point the installer does not require much interaction anymore

POL_System_TmpCreate "$PREFIX"

if [[ "$DLURL" ]]
then
    cd "$POL_System_TmpDir"
    POL_Download "$DLURL"
    INSTALLER_PATH="$POL_System_TmpDir/$INSTALLER"
fi

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"
Set_OS "$WINEOS"

POL_Call POL_Internal_InstallFonts
POL_CALL POL_Wine_InstallFonts

POL_Wine_OverrideDLL "builtin" "dnsapi"
POL_Wine_OverrideDLL "native,builtin" "mshtml"
POL_Wine_OverrideDLL "native,builtin" "msvcr80"
POL_Wine_OverrideDLL "native,builtin" "msvcr100"
POL_Wine_OverrideDLL "native,builtin" "msvcp100"

POL_Call POL_Install_vcrun2010
POL_Call POL_Install_corefonts

POL_Wine "$INSTALLER_PATH"
POL_Wine_WaitExit "$TITLE" --allow-kill

# The installer failed, because Agent.exe got updated and it can't handle the truth!
# So jerry righ the Agent, and retry
#
if [[ ! -e "$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe" ]]
then
    killall -15 Agent.exe

    latest_agent=($(find "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/" -name Agent\* -type d -exec basename {} \; | sort -Vr))
    if (( ${#latest_agent[@]} > 0 ))
    then
        cp "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/${latest_agent[0]}/Agent.exe" "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/"

        POL_SetupWindow_pulsebar "Cannot find '$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe', restarting ${latest_agent[0]} to retry"
        for (( step=0; step<100; step=step+10 ))
        do
            if (( $step==50 ))
            then
                POL_Wine "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/Agent.exe" --nohttpauth --switcherall --locale="$LOCALE" &
            fi
            sleep 1;
            POL_SetupWindow_pulse $step
        done

#         POL_Wine_WaitBefore "$TITLE"
        POL_Wine "$INSTALLER_PATH"
        POL_Wine_WaitExit "$TITLE" --allow-kill
   fi
fi

POL_Shortcut "Battle.net.exe" "$NAME"

POL_System_TmpDelete
POL_SetupWindow_VMS $GAME_VMS
POL_Wine_SetVideoDriver
 
POL_SetupWindow_Close
exit

 

Tutul Thursday 4 June 2015 at 19:23
Tutul

It's a really good idea but I think it's better to make a Steam-script like, a function you can use in game script to install Battle.net first.

- You must concidere the intelHD Graphic error (check on WineHQ for informations)

- The wine version is not good for some of the game in the Battle.net menu (so it's for that I think it's better to make a function-script like Steam)

If you like, I can help you for some part (or test for the intelHD graphic error) but not before july.


Gentils modérateur dans mes bon jours - Attention, à tenir hors de portée des enfants. En cas de contact, veuillez immédiatement rincer à l'eau clair. Peut provoquer des sueurs froide !
Cromrots Thursday 4 June 2015 at 20:14
Cromrots

I've added the "-opengl" option as suggested for the IntelHD graphics. OpenGL is the preferred rendering engine for linux anyway, as DirectX gets translated to OpenGL anyway.

I've updated the wine version to 1.7.39 - which got platinum rating on winehq.

I don't understand the steam installer suggestion. At from what I understand it makes a prefix for each game it supports. That's exactly what this installer allows for. The battle.net app does not have an option to immediately start the installation of a game afterwards. That's something the user can do after installation...

 

#!/bin/bash
# Date : (2014-01-02 21:45)
# Last revision : (2015-06-04 13:37)
# Wine version used : 1.7.39
# Distribution used to test : Linux Mint 16
# Author : Cromrots 
# 
# Originally based on 'Starcraft II' pol script found on PoL forums
# by shark711 - 2013-05-28
#

##
# http://appdb.winehq.org/objectManager.php?sClass=application&iId=15365
#
# This installer is for the Battle.net App, which is a lancher/installer/updater tool in one
# Having just this app installed gives access to all modern games connected to battle.net in one
#
# Sometimes these seperate games require specific settings to run, which may conflict with other games.
# To allow such flexiblity, the user is given the option to choose a different prefix, if so required.
#

[ "$PLAYONLINUX" == "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
  
TITLE="Blizzard's Battle.net desktop app"
DEVELOPER="Activision / Blizzard Entertainment"
PREFIX="Battle.net" # sane default
NAME="$PREFIX"
WINEVERSION="1.7.39"
WINEOS="winxp"
GAME_VMS="1024"
DLURLBASE="http://dist.blizzard.com/downloads/bna-installers/322d5bb9ae0318de3d4cde7641c96425/retail.1"
ICONPATH="$SITE/setups/battle.net/"
if [[ -f "$HOME/battle.net.top.png" ]]
then
    ICONPATH="$HOME"
fi

POL_SetupWindow_Init "$ICONPATH/battle.net.top.png" "$ICONPATH/battle.net.left.jpg"
POL_Debug_Init

##

POL_SetupWindow_menu "$(eval_gettext 'Please select your preferred prefix.')\n$(eval_gettext 'Some games may require specific settings and may not run from the same installation.')" "$TITLE" "Battle.net~World Of Warcraft~Diablo III~Starcraft II~Hearthstone~Heroes of the Storm" "~"
case "$APP_ANSWER" in
    "Battle.net")           PREFIX="Battle.net" ;;
    "World Of Warcraft")    PREFIX="World_Of_Warcraft" ;;
    "Diablo III")           PREFIX="Diablo_III" ;;
    "Starcraft II")         PREFIX="Starcraft_II" ;;
    "Hearthstone")          PREFIX="Hearthstone" ;;
    "Heroes of the Storm")  PREFIX="Heroes_of_the_Storm" ;;
esac
NAME=$APP_ANSWER

POL_SetupWindow_presentation "$TITLE" "$DEVELOPER" "http://us.battle.net" "Cromrots" "$PREFIX"

POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"

LOCALE="enUS"
INSTALLER=""
INSTALLER_PATH=""
DLURL=""
case "$INSTALL_METHOD" in
    "LOCAL")
        cd "$HOME"
        POL_SetupWindow_browse "$(eval_gettext 'Please select the installation file to run.')"
        INSTALLER_PATH="$APP_ANSWER"
        LOCALE=${INSTALLER_PATH/*Setup-}
        LOCALE=${LOCALE/.exe}
    ;;
    "DOWNLOAD")

        POL_SetupWindow_menu "$(eval_gettext 'Please select the game language.')" "$TITLE" "English (US)~Español (AL)~Português (BR)~English (EU)~English (SG)~Español (EU)~Deutsch~Français~Italiano~Polski~Русский~한국어~繁體中文~简体中文" "~"
        case "$APP_ANSWER" in
            "English (US)")     LOCALE="enUS" ;;
            "Español (AL)")     LOCALE="esMX" ;;
            "Português (BR)")   LOCALE="ptBR" ;;
            "English (EU)")     LOCALE="enGB" ;;
            "English (SG)")     LOCALE="enSG" ;;
            "Español (EU)")     LOCALE="esES" ;;
            "Deutsch")          LOCALE="deDE" ;;
            "Français")         LOCALE="frFR" ;;
            "Italiano")         LOCALE="itIT" ;;
            "Polski")           LOCALE="plPL" ;;
            "Русский")          LOCALE="ruRU" ;;
            "한국어")           LOCALE="koKR" ;;
            "繁體中文")         LOCALE="zhTW" ;;
            "简体中文")         LOCALE="zhCN" ;;
        esac

        INSTALLER="Battle.net-Setup-$LOCALE.exe"
        DLURL="$DLURLBASE/$INSTALLER"
      ;;
esac

# After this point the installer does not require much interaction anymore

POL_System_TmpCreate "$PREFIX"

if [[ "$DLURL" ]]
then
    cd "$POL_System_TmpDir"
    POL_Download "$DLURL"
    INSTALLER_PATH="$POL_System_TmpDir/$INSTALLER"
fi

POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WINEVERSION"
Set_OS "$WINEOS"

POL_Call POL_Internal_InstallFonts
POL_CALL POL_Wine_InstallFonts

POL_Wine_OverrideDLL "builtin" "dnsapi"
POL_Wine_OverrideDLL "native,builtin" "mshtml"
POL_Wine_OverrideDLL "native,builtin" "msvcr80"
POL_Wine_OverrideDLL "native,builtin" "msvcr100"
POL_Wine_OverrideDLL "native,builtin" "msvcp100"

POL_Call POL_Install_vcrun2010
POL_Call POL_Install_corefonts

POL_Wine "$INSTALLER_PATH"
POL_Wine_WaitExit "$TITLE" --allow-kill

# The installer failed, because Agent.exe got updated and it can't handle the truth!
# So jerry righ the Agent, and retry
#
if [[ ! -e "$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe" ]]
then
    killall -15 Agent.exe

    latest_agent=($(find "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/" -name Agent\* -type d -exec basename {} \; | sort -Vr))
    if (( ${#latest_agent[@]} > 0 ))
    then
        cp "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/${latest_agent[0]}/Agent.exe" "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/"

        POL_SetupWindow_pulsebar "Cannot find '$WINEPREFIX/drive_c/Program Files/Battle.net/Battle.net.exe', restarting ${latest_agent[0]} to retry"
        for (( step=0; step<100; step=step+10 ))
        do
            if (( $step==50 ))
            then
                POL_Wine "$WINEPREFIX/drive_c/users/Public/Application Data/Battle.net/Agent/Agent.exe" --nohttpauth --switcherall --locale="$LOCALE" &
            fi
            sleep 1;
            POL_SetupWindow_pulse $step
        done

#         POL_Wine_WaitBefore "$TITLE"
        POL_Wine "$INSTALLER_PATH"
        POL_Wine_WaitExit "$TITLE" --allow-kill
   fi
fi

POL_Shortcut "Battle.net.exe" "$NAME" "" "-opengl"

POL_System_TmpDelete
POL_SetupWindow_VMS $GAME_VMS
POL_Wine_SetVideoDriver
 
POL_SetupWindow_Close
exit


Edited by Cromrots

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com