Quantcast

-- Grab a copy of the local data
local addonName, addonData = ...
local Translate = addonData.Translate
local expansionLevel = GetExpansionLevel()

addonData.HideTooltip = function(self)
	GameTooltip:Hide()
end

addonData.ShowTooltip = function(self,button)
	local spellName = button:GetAttribute("spell")
	local spellID = button.spellID
	local spellKnown = ( GetSpellInfo(spellName) ~= nil )
	GameTooltip:SetOwner(button,"ANCHOR_CURSOR")
	GameTooltip:SetSpellByID(spellID)
	GameTooltip:AddLine(string.format(LEVEL_REQUIRED,button.levelRequired),1.0,1.0,1.0,1.0)
	GameTooltip:AddLine(addonData.ExpansionDB[button.expansionRequired],1.0,1.0,0.0,1.0)
	if ( button.questReward ) then
		GameTooltip:AddLine(Translate["QUEST_REWARD"],1.0,1.0,1.0)
	end
	if ( button.dropItem ) then
		GameTooltip:AddLine(Translate["DROP_ITEM"],1.0,1.0,1.0)
	end
	if ( not spellKnown ) then
		GameTooltip:AddLine(SPELL_FAILED_NOT_KNOWN,1.0,1.0,1.0)
	elseif ( cdDuration == 0 ) then
		GameTooltip:AddLine(AVAILABLE,1.0,1.0,1.0)
	elseif ( cdEnabled and cdDuration ~= 0 ) then
		GameTooltip:AddLine(ON_COOLDOWN,1.0,1.0,1.0)
	end
	GameTooltip:Show()
end