SlashCmdList["SPELLACTIVATIONTEXT"] = function(msg)
	if type(tonumber(msg)) == "number" then
		AddUIDB.SAT = tonumber(msg)
		print("SAT:已设置小于|cFF00FF55"..AddUIDB.SAT.."秒|r显示小数点")
	else
		print("SAT:输入|cFF00FF55/SAT 数字|r设置小于|cFF00FF55数字|r秒时显示小数点,当前|cFF00FF55"..AddUIDB.SAT.."|r秒")
	end
end
SLASH_SPELLACTIVATIONTEXT1 = "/SAT"
SLASH_SPELLACTIVATIONTEXT2 = "/SpellActivationText"

local topid,topid2,leftid,leftid1,leftid2,rightid,rightid1,rightid2
local width, height = SpellActivationOverlayFrame:GetSize(),SpellActivationOverlayFrame:GetSize()/2
local function AddTextFrame(size1,size2,name,point1,point2,x,y,fontsize)
	local SATFrame = CreateFrame("Frame", nil, SpellActivationOverlayFrame)
    SATFrame:SetSize(size1,size2)
	SATFrame:SetPoint(point1, SpellActivationOverlayFrame, point2, 0, 0)
	local SATCooldown = CreateFrame("Cooldown",name,SATFrame)
	SATCooldown:Hide()
	local SATText = SATFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
	SATText:SetFont("fonts\\ARHei.ttf", fontsize, "OUTLINE")
	SATText:SetPoint("CENTER", SATFrame, "CENTER", x, y)
	SATText:SetVertexColor(1,1,1)
	local function UpdateText()
		SATFrame:SetScale(SATCooldown:GetScale())
		local StarTime,durationTime = SATCooldown:GetCooldownTimes()
		local durationText = (StarTime+durationTime)/1000-GetTime()
		if durationText > AddUIDB.SAT then
			SATText:SetText(format("%d", durationText))
		elseif durationText > 0 then
			SATText:SetText(format("%.1f", durationText))
		else
			SATText:SetText("")
		end
	end
	SATCooldown:HookScript("OnUpdate", UpdateText)
	return SATCooldown
end
local toptext = AddTextFrame(width,height,"toptext","BOTTOM","TOP",0,0,30)
local toptext2 = AddTextFrame(width,height,"toptext2","BOTTOM","TOP",0,0,30)
local lefttext = AddTextFrame(height,width,"lefttext","RIGHT","LEFT",-15,0,30)
local lefttext1 = AddTextFrame(height,width,"lefttext1","RIGHT","LEFT",-10,0,30)
local lefttext2 = AddTextFrame(height,width,"lefttext2","RIGHT","LEFT",-10,0,45)
local righttext = AddTextFrame(height,width,"toptext","LEFT","RIGHT",15,0,30)
local righttext1 = AddTextFrame(height,width,"toptext1","LEFT","RIGHT",10,0,30)
local righttext2 = AddTextFrame(height,width,"toptext2","LEFT","RIGHT",10,0,45)

hooksecurefunc("SpellActivationOverlay_ShowAllOverlays", function(self, spellID, texture, positions, scale, r, g, b)
if AddUIDB.jbtext ~= true then return end
if spellID == 126084 then spellID = 44544 end	--寒冰指2层id不一致
if not C_UnitAuras.GetPlayerAuraBySpellID(spellID) then return end
local expirationTime = C_UnitAuras.GetPlayerAuraBySpellID(spellID).expirationTime
local duration = C_UnitAuras.GetPlayerAuraBySpellID(spellID).duration
if not duration or not expirationTime then return end
if positions == "Top" and scale >= 1 then
toptext:SetCooldown(expirationTime-duration,duration)
toptext:SetScale(scale)
topid = spellID
end
if positions == "Top" and scale < 1 then
toptext2:SetCooldown(expirationTime-duration,duration)
toptext2:SetScale(scale)
topid2 = spellID
end
if (positions == "Left" or positions == "Left + Right (Flipped)") and scale > 1 then
lefttext:SetCooldown(expirationTime-duration,duration)
lefttext:SetScale(scale)
leftid = spellID
end
if (positions == "Left" or positions == "Left + Right (Flipped)") and scale == 1 then
lefttext1:SetCooldown(expirationTime-duration,duration)
lefttext1:SetScale(scale)
leftid1 = spellID
end
if (positions == "Left" or positions == "Left + Right (Flipped)") and scale < 1 then
lefttext2:SetCooldown(expirationTime-duration,duration)
lefttext2:SetScale(scale)
leftid2 = spellID
end
if (positions == "Right (Flipped)" or positions == "Left + Right (Flipped)") and scale > 1 then
righttext:SetCooldown(expirationTime-duration,duration)
righttext:SetScale(scale)
rightid = spellID
end
if (positions == "Right (Flipped)" or positions == "Left + Right (Flipped)") and scale == 1 then
righttext1:SetCooldown(expirationTime-duration,duration)
righttext1:SetScale(scale)
rightid1 = spellID
end
if (positions == "Right (Flipped)" or positions == "Left + Right (Flipped)") and scale < 1 then
righttext2:SetCooldown(expirationTime-duration,duration)
righttext2:SetScale(scale)
rightid2 = spellID
end
end)

hooksecurefunc("SpellActivationOverlay_HideOverlays", function(self, spellID)
if AddUIDB.jbtext ~= true then return end
if spellID == topid then
toptext:SetCooldown(0,0)
end
if spellID == topid2 then
toptext2:SetCooldown(0,0)
end
if spellID == leftid then
lefttext:SetCooldown(0,0)
end
if spellID == leftid1 then
lefttext1:SetCooldown(0,0)
end
if spellID == leftid2 then
lefttext2:SetCooldown(0,0)
end
if spellID == rightid or spellID == 126084 then
righttext:SetCooldown(0,0)
end
if spellID == rightid1 or spellID == 126084 then
righttext1:SetCooldown(0,0)
end
if spellID == rightid2 then
righttext2:SetCooldown(0,0)
end
end)