do
function UpdateVetIcons(level, faction)
	local factionData = import('/lua/factions.lua')
	local bp = __blueprints[rolloverInfo.blueprintId]
	local vetLevels = {[5] = 1000,
		[4] = 500,
		[3] = 250,
		[2] = 100,
		[1] = 25,
		[0] = 0,
	}
	if bp.Veteran then
		vetLevels[5] = bp.Veteran['Level5']
		vetLevels[4] = bp.Veteran['Level4']
		vetLevels[3] = bp.Veteran['Level3']
		vetLevels[2] = bp.Veteran['Level2']
		vetLevels[1] = bp.Veteran['Level1']
	end
	local VeteranTracker = UnitData[rolloverInfo.entityId].VeteranTracker or 0
	local actualLevel = false
	if(VeteranTracker >= vetLevels[5]) then
		actualLevel = 5
	elseif(VeteranTracker >= vetLevels[4]) then
		actualLevel = 4
	elseif(VeteranTracker >= vetLevels[3]) then
		actualLevel = 3
	elseif(VeteranTracker >= vetLevels[2]) then
		actualLevel = 2
	elseif(VeteranTracker >= vetLevels[1]) then
		actualLevel = 1
	else
		actualLevel = 0
	end
	local levelProgress = false
	if actualLevel == 5 then
		levelProgress = 1
	else
		levelProgress = (VeteranTracker - (vetLevels[actualLevel]))/((vetLevels[actualLevel + 1])-(vetLevels[actualLevel]))
	end
	
	controls.vetProgBar:SetValue(levelProgress)
	
    for i = 1, 5 do
        if faction and faction != '' then
            controls.roVeteranIcons[i]:SetTexture(UIUtil.UIFile(factionData.Factions[factionData.FactionIndexMap[faction]].VeteranIcon))
        end
        controls.roVeteranIcons[i]:Hide()
    end
    for i = 1, actualLevel do
        controls.roVeteranIcons[i]:Show()
    end
end

local oldSetLayout = SetLayout
function SetLayout(layout)
	oldSetLayout(layout)
	if not controls.vetProgBar then
		controls.vetProgBar = StatusBar(controls.roBG, 0, 1, true, false, '/mods/4th_Dimension 182/textures/vet-bar_back.dds', '/mods/4th_Dimension 182/textures/textures/vet-bar.dds', true)	
		controls.vetProgBar.Top:Set(controls.roIcon.Top)
		controls.vetProgBar.Bottom:Set(controls.roIcon.Bottom)
		controls.vetProgBar.Left:Set(function() return controls.roIcon.Right() + 2 end)
	end
end
end
