zebscripts/AFK-Daily

Create flag to not check restart ADB and check for device

Closed this issue · 1 comments

Currently, the -d dev flag already does this, but it should be its own flag, like for example -b. Running this flag would simply run the script with the current adb configuration. This means not restarting adb and simply connecting to the device that is available.

Mmh, it's not much, just set default to false at the begining:

devMode=false

Update the getopts loop:

while getopts ":ab:cd:e:fhi:no:rs:tv:w" option; do
    case $option in
    a)
        tempFile="account-info/acc-${OPTARG}.ini"
        ;;
    b)
        devMode=true
        ;;

Update run():

# ##############################################################################
# Function Name : run
# ##############################################################################
run() {
    check_all
    getLatestPatch

    if [ "$devMode" = false ]; then
        restartAdb
    fi

    if [ "$device" == "Bluestacks" ]; then
        checkDevice "Bluestacks"
        deploy "Bluestacks" "$bluestacksDirectory"
    elif [ "$device" == "Memu" ]; then
        checkDevice "Memu"
        deploy "Memu" "$memuDirectory"
    elif [ "$device" == "Nox" ]; then
        checkDevice "Nox"
        deploy "Nox" "$noxDirectory"
    else
        restartAdb
        checkDevice
    fi
}

And the -h:

# ##############################################################################
# Function Name : show_help
# ##############################################################################
show_help() {
    echo -e "${cWhite}"
    echo -e "    _     ___   _  __        ___           _   _         "
    echo -e "   /_\   | __| | |/ /  ___  |   \   __ _  (_) | |  _  _  "
    echo -e "  / _ \  | _|  | ' <  |___| | |) | / _\` | | | | | | || | "
    echo -e " /_/ \_\ |_|   |_|\_\       |___/  \__,_| |_| |_|  \_, | "
    echo -e "                                                   |__/  "
    echo -e
    echo -e "USAGE: ${cYellow}deploy.sh${cWhite} ${cCyan}[OPTIONS]${cWhite}"
    echo -e
    echo -e "DESCRIPTION"
    echo -e "   Automate daily activities within the AFK Arena game."
    echo -e "   More info: https://github.com/zebscripts/AFK-Daily"
    echo -e
    echo -e "OPTIONS"
    echo -e "   ${cCyan}-h${cWhite}, ${cCyan}--help${cWhite}"
    echo -e "      Show help"
    echo -e
    echo -e "   ${cCyan}-a${cWhite}, ${cCyan}--account${cWhite} ${cGreen}[ACCOUNT]${cWhite}"
    echo -e "      Specify account: \"acc-${cGreen}[ACCOUNT]${cWhite}.ini\""
    echo -e "      Remark: Please don't use spaces!"
    echo -e
    echo -e "   ${cCyan}-d${cWhite}, ${cCyan}--device${cWhite} ${cGreen}[DEVICE]${cWhite}"
    echo -e "      Specify target device."
    echo -e "      Values for ${cGreen}[DEVICE]${cWhite}: bs (default), nox, memu"
    echo -e
    echo -e "   ${cCyan}-e${cWhite}, ${cCyan}--event${cWhite} ${cGreen}[EVENT]${cWhite}"
    echo -e "      Specify active event."
    echo -e "      Values for ${cGreen}[EVENT]${cWhite}: hoe"
    echo -e
    echo -e "   ${cCyan}-f${cWhite}, ${cCyan}--fight${cWhite}"
    echo -e "      Force campaign battle (ignore 3 day optimisation)."
    echo -e
    echo -e "   ${cCyan}-i${cWhite}, ${cCyan}--ini${cWhite} ${cGreen}[CONFIG]${cWhite}"
    echo -e "      Specify config: \"config-${cGreen}[CONFIG]${cWhite}.ini\""
    echo -e "      Remark: Please don't use spaces!"
    echo -e
    echo -e "   ${cCyan}-n${cWhite}"
    echo -e "      Disable heads up notifications."
    echo -e
    echo -e "   ${cCyan}-r${cWhite}"
    echo -e "      Ignore resolution warning. Use this at your own risk."
    echo -e
    echo -e "   ${cCyan}-t${cWhite}, ${cCyan}--test${cWhite}"
    echo -e "      Launch on test server (experimental)."
    echo -e
    echo -e "   ${cCyan}-w${cWhite}, ${cCyan}--weekly${cWhite}"
    echo -e "      Force weekly."
    echo -e
    echo -e "DEV OPTIONS"
    echo -e
    echo -e "   ${cCyan}-b${cWhite}"
    echo -e "      Dev mode: do not restart adb."
    echo -e

But need to be tested ;)
deploy.txt