local c, r = GetChampionshipsByIndexes, GetRacesByIndexes
local function calc_avg_income(campaigns, races)
    local total, bonus = 0, 0
    for i = 1, #campaigns do
        total = total + campaigns[i].MoneyBonusEach.PlaceMult*MONEY_PLACE_BONUS*2*#campaigns[i].Levels
        bonus = bonus + campaigns[i].MoneyBonusEach.Star*2*#campaigns[i].Levels
    end
    for i = 1, #races do
        total = total + races[i].MoneyBonusEach.PlaceMult*MONEY_PLACE_BONUS*2*#races[i].Levels
        bonus = bonus + races[i].MoneyBonusEach.Star*2*#races[i].Levels
    end
    return total, bonus, total+bonus
end

AVG_HR1_PROGRESS = {c(AVG_HR1_CHAMPS), r(AVG_HR1_RACES)}
AVG_HR2_PROGRESS = {c(AVG_HR2_CHAMPS), r(AVG_HR2_RACES)}
AVG_HR3_PROGRESS = {c(AVG_HR3_CHAMPS), r(AVG_HR3_RACES)}
AVG_INCOME_HR1, AVG_INCOME_HR1_BONUS, AVG_INCOME_HR1_SUM = calc_avg_income(unpack(AVG_HR1_PROGRESS))
AVG_INCOME_HR2, AVG_INCOME_HR2_BONUS, AVG_INCOME_HR2_SUM = calc_avg_income(unpack(AVG_HR2_PROGRESS))
AVG_INCOME_HR3, AVG_INCOME_HR3_BONUS, AVG_INCOME_HR3_SUM = calc_avg_income(unpack(AVG_HR3_PROGRESS))
