if not dsc then return end

--[[
--------------------------------------------------------------
------- You may change colors of LEVEL as wish here
--------------------------------------------------------------

differenceLevel = -5...5 --- difference of level between you and unit - разница в уровнях меж вами и юнитом

FONT parameters:
        ["outline"] = 1, ---- 0, 1, 2
        ["shadow"] = 0, --- 0, 1, 2
        ["color"] = {
             ["a"] = 1,        ---- 'alfa' chanel
             ["b"] = 0.253906, ----- blue
             ["g"] = 0.722656, ----- green
             ["r"] = 0.742188, ----- red
          },
        ["shadowcolor"] = {
             ["a"] = 1,
             ["b"] = 1,
             ["g"] = 1,
             ["r"] = 1,
          },
        ["alignx"] = "center", ---{string}  "left", "center", "right"
         ["aligny"] = "meddle", ---{string}   "top", "meddle", "bottom"
        ["fontsize"] = 28,       --- 9 ... 99
        ["fontname"] = "AllodWest", ---{string}   "AllodWest", "AllodSystem"
        ["outlinecolor"] = {
             ["a"] = 1,  
             ["b"] = 0,
             ["g"] = 0,
             ["r"] = 0,
         },


--------- TYPES of UNITS ------------
typeUnit = 
	"me_" --- myself
	"epf_" --- enemy from friendly faction --враг сейчас - но наша фракция
	"ep_" --- enemy played --- чисто враги игроки
	"gp_" --- group
	"rd_" --- raid
	"fp_" --- friend player
	"np_" --- neutral player (from enemy faction )
	"en_" --- aggressive mob|NPC
	"fn_" --- frienfly mob|NPC
	"nn_" --- neutral mob|NPC
сюда не приходят но есть в типах как расширение:
	ext["sp_"] = 1 --- spouse - супруг
	ext["qu_"] = relative quest - связан с квестом

]]
local function reverseColor(clr)
	clr.r = 1 - clr.r
	clr.g = 1 - clr.g
	clr.b = 1 - clr.b
end

local function 	var1(typeUnit, differenceLevel, coeff, tabFormat, FONTS)
	if false then
	elseif differenceLevel > 2 then
		tabFormat["color"] = { a=1, r=1.0+coeff*0.0, g=1.7-coeff*1.5, b= 0.0-coeff*0.0 }

		tabFormat["shadowcolor"] = { a=1, r=0.0, g=0.0, b=0.0 }
		tabFormat["outlinecolor"] = { a=1, r=0.0, g=0.0, b=0.0 }
	elseif differenceLevel < -2 then
		tabFormat["color"] = { a=1, r=0.0-coeff*0.0, g=0.0, b=0.0-coeff*0.0 }

		tabFormat["shadowcolor"] = { a=1, r=1.2+coeff*0.5, g=1.2+coeff*0.5, b=1.2+coeff*0.5 }
		tabFormat["outlinecolor"] = { a=1, r=1.2+coeff*0.5, g=1.2+coeff*0.5, b=1.2+coeff*0.5 }
	else
		if false then
		elseif differenceLevel == -2 then
			tabFormat["color"] = { a=1, r=0.1, g=0.9, b=0.0 }
		elseif differenceLevel == -1 then
			tabFormat["color"] = { a=1, r=0.5, g=0.7, b=0.3 }
		elseif differenceLevel == 0 then
			tabFormat["color"] = { a=1, r=0.8, g=0.8, b=0.8 }
		elseif differenceLevel == 1 then
			tabFormat["color"] = { a=1, r=0.5, g=0.5, b=0.9 }
		elseif differenceLevel == 2 then
			tabFormat["color"] = { a=1, r=0.9, g=0.9, b=0.0 }
		end
		tabFormat["shadowcolor"] = { a=1, r=1, g=1, b=1 }
		tabFormat["outlinecolor"] = { a=1, r=0, g=0, b=0 }
	end
end

local function 	var2(typeUnit, differenceLevel, coeff, tabFormat, FONTS)
--	tabFormat.color = FONTS[typeUnit.."name"].color
--	exObj2("tabFormat.color", tabFormat.color )

	tabFormat["shadow"] = 2
	tabFormat["outline"] = 2
	tabFormat["shadowcolor"] = { a=1., r=0.0, g=0.0, b=0.0 }
	tabFormat["outlinecolor"] = { a=1., r=0.0, g=0.0, b=0.0 }

	if false then
	elseif differenceLevel > 3 then
		tabFormat["color"] = { a=1., r=.80, g=0.20, b=1.00 }
	elseif differenceLevel > 1 then
		tabFormat["color"] = { a=1., r=0.40, g=0.60, b=1.0 }
		tabFormat["shadow"] = 0
		tabFormat["outline"] = 2
	elseif differenceLevel > -2 then
		tabFormat["color"] = { a=1., r=0.5, g=1.0, b=0.50 }
	elseif differenceLevel > -4 then
		tabFormat["color"] = { a=1., r=1.0, g=1.0, b=1.00 }
	else
		tabFormat["color"] = { a=1., r=.60, g=.6, b=.60 }
	end
end


local test
function setDifferenceLevelStyle( typeUnit, differenceLevel, tabFormat, FONTS )
--- a,g,r,b = 0...1
	-- LogInfo( typeUnit ) --- write types of units into mods.txt
	--differenceLevel = test or 0
	tabFormat["fontsize"] = tabFormat["fontsize"] + differenceLevel*1
	var2(typeUnit, differenceLevel, differenceLevel/5, tabFormat, FONTS)
end

function set_Test( t )
	test = t
end