 # Set Defaults
 window.champData = {}
 window.cSettings = {}
-window.riotVer = '5.7'  # This will change
-window.champGGVer = '5.8' # This will change
 window.undefinedBuilds = []
 window.progressIncr = 0
 

    $c = cheerio.load(body)
    window.champGGVer = $c(csspaths.version).text()
    updateProgressBar(1.5)
    cb()


###*
 * Function Downloads all available champs from Riot.
 * @callback {Function} Callback.
###
getChamps = (cb) ->
  cl 'Downloading Champs from Riot'
  hlp.ajaxRequest 'http://ddragon.leagueoflegends.com/cdn/'+window.riotVer+'/data/en_US/champion.json', (body) ->
    champs = Object.keys(body.data)
    cb null, champs


# TODO: This doesn't work on Windows if the files were created with admin priveleges but are trying to delete without.

 * @callback {Function} Callback.
###
downloadItemSets = (cb) ->
  async.auto {
    settings: getSettings
    champGGVer: getChampionGGVer
    riotVer: getRiotVer
    champs:  ['riotVer', getChamps]
    requestChamps: ['champs', requestChamps]
    deleteOldBuilds: ['requestChamps', deleteOldBuilds]
    saveToFile: ['deleteOldBuilds', saveToFile],
    notProcessed: ['saveToFile', notProcessed]
  }, (err, r) ->
    console.log(err) if err
    updateProgressBar(10) # Just max it.
    cl 'Looks like were all done. Login and enjoy!'
