------------------------------
-- EPEEN Widget
------------------------------
do
	local artpath = "Interface\\Addons\\TidyPlates_EPEEN\\widgets\\EPEEN\\"
	local function UpdateEpeenWidget(frame, unit)
		if GS_Data[GetRealmName()]["Players"][unit.name] then
			local size = GS_Data[GetRealmName()]["Players"][unit.name]["GearScore"]
			local height
			if size < 5000 then
				height = (size * 0.002)
			elseif size >= 5000 and size < 5500 then
				height = (((size - 5000 )* 0.13) + 10)
			elseif size >= 5500 and size < 6300 then
				height = (((size - 5500 )* 0.18) + 75)
			elseif size >=6300 then
				height = (((size - 6300)* 0.1) + 220)
			end
			-- Set Size
			frame.EPEEN:ClearAllPoints()
			frame.EPEEN:SetPoint("BOTTOM", frame.BOTTOM, "TOP")
			frame.EPEEN:SetHeight(height)
			frame.TOP:ClearAllPoints()
			frame.TOP:SetPoint("BOTTOM", frame.EPEEN, "TOP")
			frame.ICON:ClearAllPoints()
			frame.ICON:SetPoint("TOP", frame.BOTTOM, "BOTTOM", -1, 10)			
			frame.BOTTOM:SetTexture(artpath.."bottom")
			frame.TOP:SetTexture(artpath.."top")
			frame.GearScore:SetText(size)
			-- Set Fading
			frame:Show()
		else 
			frame:Hide() 
		end
	end

	local function CreateEpeenWidget(parent, showname, hangtime, art)
		local frame = CreateFrame("Frame", nil, parent)
		frame:SetWidth(30)
		frame:SetHeight(300)
		-- Set Bottom Texture
		frame.BOTTOM = frame:CreateTexture(nil, "OVERLAY")
		frame.BOTTOM:SetPoint("CENTER")
		frame.BOTTOM:SetWidth(16)
		frame.BOTTOM:SetHeight(20)
		-- Set Top Texture
		frame.TOP = frame:CreateTexture(nil, "OVERLAY")
		frame.TOP:SetWidth(16)
		frame.TOP:SetHeight(20)
		-- Set EPEEN
		frame.EPEEN = frame:CreateTexture(nil, "OVERLAY")
		frame.EPEEN:SetTexture(artpath.."middle")
		frame.EPEEN:SetWidth(16)
		frame.EPEEN:SetHeight(100)
		-- Set Epeen Icon
		frame.ICON = frame:CreateTexture(nil, "OVERLAY")
		frame.ICON:SetTexture(artpath.."icon")
		frame.ICON:SetWidth(24)
		frame.ICON:SetHeight(24)
		-- GearScore Text
		frame.GearScore = frame:CreateFontString(nil, "OVERLAY")
		frame.GearScore:SetFont("FONTS\\arialn.ttf", 9, "NONE")
		frame.GearScore:SetPoint("BOTTOMLEFT",frame.BOTTOM,"TOPRIGHT", -4, -6)
		frame.GearScore:SetShadowOffset(1, -1)
		frame.GearScore:SetShadowColor(0,0,0,1)
		frame.GearScore:SetWidth(30)
		frame.GearScore:SetHeight(10)
		-- Mechanics/Setup
		frame:Hide()
		frame.Update = UpdateEpeenWidget
		return frame
	end
	
	TidyPlatesWidgets.CreateEpeenWidget = CreateEpeenWidget
end