mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
update
This commit is contained in:
+31
-21
@@ -68,7 +68,7 @@ function E:ToggleConfigMode(override, configType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
ElvUIMoverPopupWindow:Show()
|
ElvUIMoverPopupWindow:Show()
|
||||||
if(IsAddOnLoaded("ElvUI_Config")) then
|
if IsAddOnLoaded("ElvUI_Config") then
|
||||||
LibStub("AceConfigDialog-3.0"):Close("ElvUI")
|
LibStub("AceConfigDialog-3.0"):Close("ElvUI")
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
end
|
end
|
||||||
@@ -162,18 +162,18 @@ end
|
|||||||
|
|
||||||
function E:NudgeMover(nudgeX, nudgeY)
|
function E:NudgeMover(nudgeX, nudgeY)
|
||||||
local mover = ElvUIMoverNudgeWindow.child
|
local mover = ElvUIMoverNudgeWindow.child
|
||||||
|
|
||||||
local x, y, point = E:CalculateMoverPoints(mover, nudgeX, nudgeY)
|
local x, y, point = E:CalculateMoverPoints(mover, nudgeX, nudgeY)
|
||||||
|
|
||||||
mover:ClearAllPoints()
|
mover:ClearAllPoints()
|
||||||
E:Point(mover, mover.positionOverride or point, E.UIParent, mover.positionOverride and "BOTTOMLEFT" or point, x, y)
|
E:Point(mover, mover.positionOverride or point, E.UIParent, mover.positionOverride and "BOTTOMLEFT" or point, x, y)
|
||||||
E:SaveMoverPosition(mover.name)
|
E:SaveMoverPosition(mover.name)
|
||||||
|
|
||||||
|
--Update coordinates in Nudge Window
|
||||||
E:UpdateNudgeFrame(mover, x, y)
|
E:UpdateNudgeFrame(mover, x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function E:UpdateNudgeFrame(mover, x, y)
|
function E:UpdateNudgeFrame(mover, x, y)
|
||||||
if not(x and y) then
|
if not (x and y) then
|
||||||
x, y = E:CalculateMoverPoints(mover)
|
x, y = E:CalculateMoverPoints(mover)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -200,7 +200,8 @@ function E:CreateMoverPopup()
|
|||||||
f:SetMovable(true)
|
f:SetMovable(true)
|
||||||
f:SetFrameLevel(99)
|
f:SetFrameLevel(99)
|
||||||
f:SetClampedToScreen(true)
|
f:SetClampedToScreen(true)
|
||||||
E:Size(f, 360, 170)
|
E:Width(f, 360)
|
||||||
|
E:Height(f, 185)
|
||||||
E:SetTemplate(f, "Transparent")
|
E:SetTemplate(f, "Transparent")
|
||||||
E:Point(f, "BOTTOM", UIParent, "CENTER", 0, 100)
|
E:Point(f, "BOTTOM", UIParent, "CENTER", 0, 100)
|
||||||
f:SetScript("OnHide", function()
|
f:SetScript("OnHide", function()
|
||||||
@@ -214,8 +215,9 @@ function E:CreateMoverPopup()
|
|||||||
|
|
||||||
local header = CreateFrame("Button", nil, f)
|
local header = CreateFrame("Button", nil, f)
|
||||||
E:SetTemplate(header, "Default", true)
|
E:SetTemplate(header, "Default", true)
|
||||||
E:Size(header, 100, 25)
|
E:Width(header, 100)
|
||||||
header:SetPoint("CENTER", f, "TOP")
|
E:Height(header, 25)
|
||||||
|
E:Point(header, "CENTER", f, "TOP")
|
||||||
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
||||||
header:EnableMouse(true)
|
header:EnableMouse(true)
|
||||||
header:RegisterForClicks("AnyUp", "AnyDown")
|
header:RegisterForClicks("AnyUp", "AnyDown")
|
||||||
@@ -224,7 +226,7 @@ function E:CreateMoverPopup()
|
|||||||
|
|
||||||
local title = header:CreateFontString("OVERLAY")
|
local title = header:CreateFontString("OVERLAY")
|
||||||
E:FontTemplate(title)
|
E:FontTemplate(title)
|
||||||
title:SetPoint("CENTER", header, "CENTER")
|
E:Point(title, "CENTER", header, "CENTER")
|
||||||
title:SetText("ElvUI")
|
title:SetText("ElvUI")
|
||||||
|
|
||||||
local desc = f:CreateFontString("ARTWORK")
|
local desc = f:CreateFontString("ARTWORK")
|
||||||
@@ -252,7 +254,7 @@ function E:CreateMoverPopup()
|
|||||||
lock:SetScript("OnClick", function()
|
lock:SetScript("OnClick", function()
|
||||||
E:ToggleConfigMode(true)
|
E:ToggleConfigMode(true)
|
||||||
|
|
||||||
if(IsAddOnLoaded("ElvUI_Config")) then
|
if IsAddOnLoaded("ElvUI_Config") then
|
||||||
LibStub("AceConfigDialog-3.0"):Open("ElvUI")
|
LibStub("AceConfigDialog-3.0"):Open("ElvUI")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -261,7 +263,8 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local align = CreateFrame("EditBox", f:GetName().."EditBox", f, "InputBoxTemplate")
|
local align = CreateFrame("EditBox", f:GetName().."EditBox", f, "InputBoxTemplate")
|
||||||
E:Size(align, 32, 17)
|
E:Width(align, 24)
|
||||||
|
E:Height(align, 17)
|
||||||
align:SetAutoFocus(false)
|
align:SetAutoFocus(false)
|
||||||
align:SetScript("OnEscapePressed", function()
|
align:SetScript("OnEscapePressed", function()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
@@ -284,6 +287,7 @@ function E:CreateMoverPopup()
|
|||||||
align:SetScript("OnEditFocusLost", function()
|
align:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
end)
|
end)
|
||||||
|
align:SetScript("OnEditFocusGained", align.HighlightText)
|
||||||
align:SetScript("OnShow", function()
|
align:SetScript("OnShow", function()
|
||||||
this:ClearFocus()
|
this:ClearFocus()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
@@ -322,7 +326,8 @@ function E:CreateMoverPopup()
|
|||||||
|
|
||||||
local nudgeFrame = CreateFrame("Frame", "ElvUIMoverNudgeWindow", E.UIParent)
|
local nudgeFrame = CreateFrame("Frame", "ElvUIMoverNudgeWindow", E.UIParent)
|
||||||
nudgeFrame:SetFrameStrata("DIALOG")
|
nudgeFrame:SetFrameStrata("DIALOG")
|
||||||
E:Size(nudgeFrame, 200, 110)
|
E:Width(nudgeFrame, 200)
|
||||||
|
E:Height(nudgeFrame, 110)
|
||||||
E:SetTemplate(nudgeFrame, "Transparent")
|
E:SetTemplate(nudgeFrame, "Transparent")
|
||||||
E:Point(nudgeFrame, "TOP", ElvUIMoverPopupWindow, "BOTTOM", 0, -15)
|
E:Point(nudgeFrame, "TOP", ElvUIMoverPopupWindow, "BOTTOM", 0, -15)
|
||||||
nudgeFrame:SetFrameLevel(100)
|
nudgeFrame:SetFrameLevel(100)
|
||||||
@@ -333,18 +338,20 @@ function E:CreateMoverPopup()
|
|||||||
|
|
||||||
header = CreateFrame("Button", "ElvUIMoverNudgeWindowHeader", nudgeFrame)
|
header = CreateFrame("Button", "ElvUIMoverNudgeWindowHeader", nudgeFrame)
|
||||||
E:SetTemplate(header, "Default", true)
|
E:SetTemplate(header, "Default", true)
|
||||||
E:Size(header, 100, 25)
|
E:Width(header, 100)
|
||||||
header:SetPoint("CENTER", nudgeFrame, "TOP")
|
E:Height(header, 25)
|
||||||
|
E:Point(header, "CENTER", nudgeFrame, "TOP")
|
||||||
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
header:SetFrameLevel(header:GetFrameLevel() + 2)
|
||||||
|
|
||||||
title = header:CreateFontString("OVERLAY")
|
title = header:CreateFontString("OVERLAY")
|
||||||
E:FontTemplate(title)
|
E:FontTemplate(title)
|
||||||
title:SetPoint("CENTER", header, "CENTER")
|
E:Point(title, "CENTER", header, "CENTER")
|
||||||
title:SetText(L["Nudge"])
|
title:SetText(L["Nudge"])
|
||||||
header.title = title
|
header.title = title
|
||||||
|
|
||||||
local xOffset = CreateFrame("EditBox", nudgeFrame:GetName().."XEditBox", nudgeFrame, "InputBoxTemplate")
|
local xOffset = CreateFrame("EditBox", nudgeFrame:GetName().."XEditBox", nudgeFrame, "InputBoxTemplate")
|
||||||
E:Size(xOffset, 50, 17)
|
E:Width(xOffset, 50)
|
||||||
|
E:Height(xOffset, 17)
|
||||||
xOffset:SetAutoFocus(false)
|
xOffset:SetAutoFocus(false)
|
||||||
xOffset.currentValue = 0
|
xOffset.currentValue = 0
|
||||||
xOffset:SetScript("OnEscapePressed", function()
|
xOffset:SetScript("OnEscapePressed", function()
|
||||||
@@ -353,7 +360,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
xOffset:SetScript("OnEnterPressed", function()
|
xOffset:SetScript("OnEnterPressed", function()
|
||||||
local num = this:GetText()
|
local num = this:GetText()
|
||||||
if(tonumber(num)) then
|
if tonumber(num) then
|
||||||
local diff = num - xOffset.currentValue
|
local diff = num - xOffset.currentValue
|
||||||
xOffset.currentValue = num
|
xOffset.currentValue = num
|
||||||
E:NudgeMover(diff)
|
E:NudgeMover(diff)
|
||||||
@@ -364,6 +371,7 @@ function E:CreateMoverPopup()
|
|||||||
xOffset:SetScript("OnEditFocusLost", function()
|
xOffset:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
|
xOffset:SetScript("OnEditFocusGained", xOffset.HighlightText)
|
||||||
xOffset:SetScript("OnShow", function()
|
xOffset:SetScript("OnShow", function()
|
||||||
this:ClearFocus()
|
this:ClearFocus()
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
@@ -377,7 +385,8 @@ function E:CreateMoverPopup()
|
|||||||
S:HandleEditBox(xOffset)
|
S:HandleEditBox(xOffset)
|
||||||
|
|
||||||
local yOffset = CreateFrame("EditBox", nudgeFrame:GetName().."YEditBox", nudgeFrame, "InputBoxTemplate")
|
local yOffset = CreateFrame("EditBox", nudgeFrame:GetName().."YEditBox", nudgeFrame, "InputBoxTemplate")
|
||||||
E:Size(yOffset, 50, 17)
|
E:Width(yOffset, 50)
|
||||||
|
E:Height(yOffset, 17)
|
||||||
yOffset:SetAutoFocus(false)
|
yOffset:SetAutoFocus(false)
|
||||||
yOffset.currentValue = 0
|
yOffset.currentValue = 0
|
||||||
yOffset:SetScript("OnEscapePressed", function()
|
yOffset:SetScript("OnEscapePressed", function()
|
||||||
@@ -386,7 +395,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
yOffset:SetScript("OnEnterPressed", function()
|
yOffset:SetScript("OnEnterPressed", function()
|
||||||
local num = this:GetText()
|
local num = this:GetText()
|
||||||
if(tonumber(num)) then
|
if tonumber(num) then
|
||||||
local diff = num - yOffset.currentValue
|
local diff = num - yOffset.currentValue
|
||||||
yOffset.currentValue = num
|
yOffset.currentValue = num
|
||||||
E:NudgeMover(nil, diff)
|
E:NudgeMover(nil, diff)
|
||||||
@@ -397,6 +406,7 @@ function E:CreateMoverPopup()
|
|||||||
yOffset:SetScript("OnEditFocusLost", function()
|
yOffset:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
|
yOffset:SetScript("OnEditFocusGained", yOffset.HighlightText)
|
||||||
yOffset:SetScript("OnShow", function()
|
yOffset:SetScript("OnShow", function()
|
||||||
this:ClearFocus()
|
this:ClearFocus()
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
@@ -429,7 +439,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
upButton.icon = upButton:CreateTexture(nil, "ARTWORK")
|
upButton.icon = upButton:CreateTexture(nil, "ARTWORK")
|
||||||
E:Size(upButton.icon, 13)
|
E:Size(upButton.icon, 13)
|
||||||
upButton.icon:SetPoint("CENTER", 0, 0)
|
E:Point(upButton.icon, "CENTER", 0)
|
||||||
upButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
upButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||||
upButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
upButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||||
|
|
||||||
@@ -444,7 +454,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
downButton.icon = downButton:CreateTexture(nil, "ARTWORK")
|
downButton.icon = downButton:CreateTexture(nil, "ARTWORK")
|
||||||
E:Size(downButton.icon, 13)
|
E:Size(downButton.icon, 13)
|
||||||
downButton.icon:SetPoint("CENTER", 0, 0)
|
E:Point(downButton.icon, "CENTER", 0)
|
||||||
downButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
downButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||||
downButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
downButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||||
|
|
||||||
@@ -459,7 +469,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
leftButton.icon = leftButton:CreateTexture(nil, "ARTWORK")
|
leftButton.icon = leftButton:CreateTexture(nil, "ARTWORK")
|
||||||
E:Size(leftButton.icon, 13)
|
E:Size(leftButton.icon, 13)
|
||||||
leftButton.icon:SetPoint("CENTER", 0, 0)
|
E:Point(leftButton.icon, "CENTER", 0)
|
||||||
leftButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
leftButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||||
leftButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
leftButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||||
|
|
||||||
@@ -474,7 +484,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
rightButton.icon = rightButton:CreateTexture(nil, "ARTWORK")
|
rightButton.icon = rightButton:CreateTexture(nil, "ARTWORK")
|
||||||
E:Size(rightButton.icon, 13)
|
E:Size(rightButton.icon, 13)
|
||||||
rightButton.icon:SetPoint("CENTER", 0, 0)
|
E:Point(rightButton.icon, "CENTER", 0)
|
||||||
rightButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
rightButton.icon:SetTexture([[Interface\AddOns\ElvUI\Media\Textures\SquareButtonTextures.blp]])
|
||||||
rightButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
rightButton.icon:SetTexCoord(0.01562500, 0.20312500, 0.01562500, 0.20312500)
|
||||||
|
|
||||||
|
|||||||
+61
-32
@@ -11,56 +11,63 @@ local GetScreenWidth, GetScreenHeight = GetScreenWidth, GetScreenHeight
|
|||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
|
|
||||||
--Return short value of a number
|
--Return short value of a number
|
||||||
local shortValueDec
|
local shortValueDec, value
|
||||||
function E:ShortValue(v)
|
function E:ShortValue(v)
|
||||||
shortValueDec = format("%%.%df", E.db.general.decimalLength or 1)
|
shortValueDec = format("%%.%df", E.db.general.decimalLength or 1)
|
||||||
|
value = abs(v)
|
||||||
if E.db.general.numberPrefixStyle == "METRIC" then
|
if E.db.general.numberPrefixStyle == "METRIC" then
|
||||||
if abs(v) >= 1e9 then
|
if value >= 1e12 then
|
||||||
|
return format(shortValueDec.."T", v / 1e12)
|
||||||
|
elseif value >= 1e9 then
|
||||||
return format(shortValueDec.."G", v / 1e9)
|
return format(shortValueDec.."G", v / 1e9)
|
||||||
elseif abs(v) >= 1e6 then
|
elseif value >= 1e6 then
|
||||||
return format(shortValueDec.."M", v / 1e6)
|
return format(shortValueDec.."M", v / 1e6)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif value >= 1e3 then
|
||||||
return format(shortValueDec.."k", v / 1e3)
|
return format(shortValueDec.."k", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%s", v)
|
return format("%.0f", v)
|
||||||
end
|
end
|
||||||
elseif E.db.general.numberPrefixStyle == "CHINESE" then
|
elseif E.db.general.numberPrefixStyle == "CHINESE" then
|
||||||
if abs(v) >= 1e8 then
|
if value >= 1e8 then
|
||||||
return format(shortValueDec.."Y", v / 1e8)
|
return format(shortValueDec.."Y", v / 1e8)
|
||||||
elseif abs(v) >= 1e4 then
|
elseif value >= 1e4 then
|
||||||
return format(shortValueDec.."W", v / 1e4)
|
return format(shortValueDec.."W", v / 1e4)
|
||||||
else
|
else
|
||||||
return format("%s", v)
|
return format("%.0f", v)
|
||||||
end
|
end
|
||||||
elseif E.db.general.numberPrefixStyle == "KOREAN" then
|
elseif E.db.general.numberPrefixStyle == "KOREAN" then
|
||||||
if abs(v) >= 1e8 then
|
if value >= 1e8 then
|
||||||
return format(shortValueDec.."억", v / 1e8)
|
return format(shortValueDec.."억", v / 1e8)
|
||||||
elseif abs(v) >= 1e4 then
|
elseif value >= 1e4 then
|
||||||
return format(shortValueDec.."만", v / 1e4)
|
return format(shortValueDec.."만", v / 1e4)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif value >= 1e3 then
|
||||||
return format(shortValueDec.."천", v / 1e3)
|
return format(shortValueDec.."천", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%s", v)
|
return format("%.0f", v)
|
||||||
end
|
end
|
||||||
elseif E.db.general.numberPrefixStyle == "GERMAN" then
|
elseif E.db.general.numberPrefixStyle == "GERMAN" then
|
||||||
if abs(v) >= 1e9 then
|
if value >= 1e12 then
|
||||||
|
return format(shortValueDec.."Bio", v / 1e12)
|
||||||
|
elseif value >= 1e9 then
|
||||||
return format(shortValueDec.."Mrd", v / 1e9)
|
return format(shortValueDec.."Mrd", v / 1e9)
|
||||||
elseif abs(v) >= 1e6 then
|
elseif value >= 1e6 then
|
||||||
return format(shortValueDec.."Mio", v / 1e6)
|
return format(shortValueDec.."Mio", v / 1e6)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif value >= 1e3 then
|
||||||
return format(shortValueDec.."Tsd", v / 1e3)
|
return format(shortValueDec.."Tsd", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%s", v)
|
return format("%.0f", v)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if abs(v) >= 1e9 then
|
if value >= 1e12 then
|
||||||
|
return format(shortValueDec.."T", v / 1e12)
|
||||||
|
elseif value >= 1e9 then
|
||||||
return format(shortValueDec.."B", v / 1e9)
|
return format(shortValueDec.."B", v / 1e9)
|
||||||
elseif abs(v) >= 1e6 then
|
elseif value >= 1e6 then
|
||||||
return format(shortValueDec.."M", v / 1e6)
|
return format(shortValueDec.."M", v / 1e6)
|
||||||
elseif abs(v) >= 1e3 then
|
elseif value >= 1e3 then
|
||||||
return format(shortValueDec.."K", v / 1e3)
|
return format(shortValueDec.."K", v / 1e3)
|
||||||
else
|
else
|
||||||
return format("%s", v)
|
return format("%.0f", v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -97,9 +104,9 @@ function E:Truncate(v, decimals)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function E:RGBToHex(r, g, b)
|
function E:RGBToHex(r, g, b)
|
||||||
r = r <= 1 and r >= 0 and r or 0
|
r = r <= 1 and r >= 0 and r or 1
|
||||||
g = g <= 1 and g >= 0 and g or 0
|
g = g <= 1 and g >= 0 and g or 1
|
||||||
b = b <= 1 and b >= 0 and b or 0
|
b = b <= 1 and b >= 0 and b or 1
|
||||||
return format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
return format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,6 +169,7 @@ function E:GetScreenQuadrant(frame)
|
|||||||
else
|
else
|
||||||
point = "CENTER"
|
point = "CENTER"
|
||||||
end
|
end
|
||||||
|
|
||||||
return point
|
return point
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -177,7 +185,7 @@ function E:GetXYOffset(position, override)
|
|||||||
return -x, y
|
return -x, y
|
||||||
elseif position == "BOTTOM" then
|
elseif position == "BOTTOM" then
|
||||||
return 0, -y
|
return 0, -y
|
||||||
elseif(position == "BOTTOMLEFT") then
|
elseif position == "BOTTOMLEFT" then
|
||||||
return x, -y
|
return x, -y
|
||||||
elseif position == "BOTTOMRIGHT" then
|
elseif position == "BOTTOMRIGHT" then
|
||||||
return -x, -y
|
return -x, -y
|
||||||
@@ -201,6 +209,7 @@ local styles = {
|
|||||||
["DEFICIT"] = "-%s"
|
["DEFICIT"] = "-%s"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local gftDec, gftUseStyle, gftDeficit
|
||||||
function E:GetFormattedText(style, min, max)
|
function E:GetFormattedText(style, min, max)
|
||||||
assert(styles[style], "Invalid format style: "..style)
|
assert(styles[style], "Invalid format style: "..style)
|
||||||
assert(min, "You need to provide a current value. Usage: E:GetFormattedText(style, min, max)")
|
assert(min, "You need to provide a current value. Usage: E:GetFormattedText(style, min, max)")
|
||||||
@@ -208,16 +217,15 @@ function E:GetFormattedText(style, min, max)
|
|||||||
|
|
||||||
if max == 0 then max = 1 end
|
if max == 0 then max = 1 end
|
||||||
|
|
||||||
local gftUseStyle
|
gftDec = (E.db.general.decimalLength or 1)
|
||||||
local gftDec = E.db.general.decimalLength or 1
|
if (gftDec ~= 1) and find(style, "PERCENT") then
|
||||||
if gftDec ~= 1 and find(style, "PERCENT") then
|
|
||||||
gftUseStyle = gsub(styles[style], "%%%.1f%%%%", "%%."..gftDec.."f%%%%")
|
gftUseStyle = gsub(styles[style], "%%%.1f%%%%", "%%."..gftDec.."f%%%%")
|
||||||
else
|
else
|
||||||
gftUseStyle = styles[style]
|
gftUseStyle = styles[style]
|
||||||
end
|
end
|
||||||
|
|
||||||
if style == "DEFICIT" then
|
if style == "DEFICIT" then
|
||||||
local gftDeficit = max - min
|
gftDeficit = max - min
|
||||||
return ((gftDeficit > 0) and format(gftUseStyle, E:ShortValue(gftDeficit))) or ""
|
return ((gftDeficit > 0) and format(gftUseStyle, E:ShortValue(gftDeficit))) or ""
|
||||||
elseif style == "PERCENT" then
|
elseif style == "PERCENT" then
|
||||||
return format(gftUseStyle, min / max * 100)
|
return format(gftUseStyle, min / max * 100)
|
||||||
@@ -237,7 +245,7 @@ function E:AbbreviateString(string, allUpper)
|
|||||||
local words = {split(" ", string)}
|
local words = {split(" ", string)}
|
||||||
for _, word in pairs(words) do
|
for _, word in pairs(words) do
|
||||||
word = utf8sub(word, 1, 1)
|
word = utf8sub(word, 1, 1)
|
||||||
if(allUpper) then
|
if allUpper then
|
||||||
word = upper(word)
|
word = upper(word)
|
||||||
end
|
end
|
||||||
newString = newString..word
|
newString = newString..word
|
||||||
@@ -309,12 +317,16 @@ function E:StringTitle(str)
|
|||||||
return gsub(str, "(.)", upper, 1)
|
return gsub(str, "(.)", upper, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
E.TimeThreshold = 3
|
||||||
|
|
||||||
E.TimeColors = {
|
E.TimeColors = {
|
||||||
[0] = "|cffeeeeee",
|
[0] = "|cffeeeeee",
|
||||||
[1] = "|cffeeeeee",
|
[1] = "|cffeeeeee",
|
||||||
[2] = "|cffeeeeee",
|
[2] = "|cffeeeeee",
|
||||||
[3] = "|cffeeeeee",
|
[3] = "|cffeeeeee",
|
||||||
[4] = "|cfffe0000"
|
[4] = "|cfffe0000",
|
||||||
|
[5] = "|cff909090", --mmss
|
||||||
|
[6] = "|cff707070", --hhmm
|
||||||
}
|
}
|
||||||
|
|
||||||
E.TimeFormats = {
|
E.TimeFormats = {
|
||||||
@@ -322,14 +334,16 @@ E.TimeFormats = {
|
|||||||
[1] = {"%dh", "%dh"},
|
[1] = {"%dh", "%dh"},
|
||||||
[2] = {"%dm", "%dm"},
|
[2] = {"%dm", "%dm"},
|
||||||
[3] = {"%ds", "%d"},
|
[3] = {"%ds", "%d"},
|
||||||
[4] = {"%.1fs", "%.1f"}
|
[4] = {"%.1fs", "%.1f"},
|
||||||
|
[5] = {"%d:%02d", "%d:%02d"}, --mmss
|
||||||
|
[6] = {"%d:%02d", "%d:%02d"}, --hhmm
|
||||||
}
|
}
|
||||||
|
|
||||||
local DAY, HOUR, MINUTE = 86400, 3600, 60
|
local DAY, HOUR, MINUTE = 86400, 3600, 60
|
||||||
local DAYISH, HOURISH, MINUTEISH = HOUR * 23.5, MINUTE * 59.5, 59.5
|
local DAYISH, HOURISH, MINUTEISH = HOUR * 23.5, MINUTE * 59.5, 59.5
|
||||||
local HALFDAYISH, HALFHOURISH, HALFMINUTEISH = DAY/2 + 0.5, HOUR/2 + 0.5, MINUTE/2 + 0.5
|
local HALFDAYISH, HALFHOURISH, HALFMINUTEISH = DAY/2 + 0.5, HOUR/2 + 0.5, MINUTE/2 + 0.5
|
||||||
|
|
||||||
function E:GetTimeInfo(s, threshhold)
|
function E:GetTimeInfo(s, threshhold, hhmm, mmss)
|
||||||
if s < MINUTE then
|
if s < MINUTE then
|
||||||
if s >= threshhold then
|
if s >= threshhold then
|
||||||
return floor(s), 3, 0.51
|
return floor(s), 3, 0.51
|
||||||
@@ -337,11 +351,26 @@ function E:GetTimeInfo(s, threshhold)
|
|||||||
return s, 4, 0.051
|
return s, 4, 0.051
|
||||||
end
|
end
|
||||||
elseif s < HOUR then
|
elseif s < HOUR then
|
||||||
|
if mmss and s < mmss then
|
||||||
|
return s/MINUTE, 5, 0.51, mod(s, MINUTE)
|
||||||
|
else
|
||||||
local minutes = floor((s/MINUTE)+.5)
|
local minutes = floor((s/MINUTE)+.5)
|
||||||
|
if hhmm and s < (hhmm * MINUTE) then
|
||||||
|
return s/HOUR, 6, minutes > 1 and (s - (minutes*MINUTE - HALFMINUTEISH)) or (s - MINUTEISH), mod(minutes, MINUTE)
|
||||||
|
else
|
||||||
return ceil(s / MINUTE), 2, minutes > 1 and (s - (minutes*MINUTE - HALFMINUTEISH)) or (s - MINUTEISH)
|
return ceil(s / MINUTE), 2, minutes > 1 and (s - (minutes*MINUTE - HALFMINUTEISH)) or (s - MINUTEISH)
|
||||||
|
end
|
||||||
|
end
|
||||||
elseif s < DAY then
|
elseif s < DAY then
|
||||||
|
if mmss and s < mmss then
|
||||||
|
return s/MINUTE, 5, 0.51, mod(s, MINUTE)
|
||||||
|
elseif hhmm and s < (hhmm * MINUTE) then
|
||||||
|
local minutes = floor((s/MINUTE)+.5)
|
||||||
|
return s/HOUR, 6, minutes > 1 and (s - (minutes*MINUTE - HALFMINUTEISH)) or (s - MINUTEISH), mod(minutes, MINUTE)
|
||||||
|
else
|
||||||
local hours = floor((s/HOUR)+.5)
|
local hours = floor((s/HOUR)+.5)
|
||||||
return ceil(s / HOUR), 1, hours > 1 and (s - (hours*HOUR - HALFHOURISH)) or (s - HOURISH)
|
return ceil(s / HOUR), 1, hours > 1 and (s - (hours*HOUR - HALFHOURISH)) or (s - HOURISH)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local days = floor((s/DAY)+.5)
|
local days = floor((s/DAY)+.5)
|
||||||
return ceil(s / DAY), 0, days > 1 and (s - (days*DAY - HALFDAYISH)) or (s - DAYISH)
|
return ceil(s / DAY), 0, days > 1 and (s - (days*DAY - HALFDAYISH)) or (s - DAYISH)
|
||||||
|
|||||||
Reference in New Issue
Block a user