mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
1
This commit is contained in:
@@ -69,7 +69,7 @@ function A:UpdateTime(elapsed)
|
|||||||
self.timeLeft = 0
|
self.timeLeft = 0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self.timeLeft = self.timeLeft - elapsed
|
self.timeLeft = GetPlayerBuffTimeLeft(self.index)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.nextUpdate > 0 then
|
if self.nextUpdate > 0 then
|
||||||
@@ -79,8 +79,7 @@ function A:UpdateTime(elapsed)
|
|||||||
|
|
||||||
local timerValue, formatID
|
local timerValue, formatID
|
||||||
timerValue, formatID, self.nextUpdate = E:GetTimeInfo(self.timeLeft, A.db.fadeThreshold)
|
timerValue, formatID, self.nextUpdate = E:GetTimeInfo(self.timeLeft, A.db.fadeThreshold)
|
||||||
--print(timervalue)
|
self.time:SetText(format("%s%s|r", E.TimeColors[formatID], format(E.TimeFormats[formatID][2], timerValue)))
|
||||||
--self.time:SetText(format("%s%s|r", E.TimeColors[formatID], format(E.TimeFormats[formatID][2], timervalue)))
|
|
||||||
|
|
||||||
if self.timeLeft > E.db.auras.fadeThreshold then
|
if self.timeLeft > E.db.auras.fadeThreshold then
|
||||||
-- E:StopFlash(self)
|
-- E:StopFlash(self)
|
||||||
@@ -89,34 +88,28 @@ function A:UpdateTime(elapsed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local UpdateTooltip = function(self)
|
local function UpdateTooltip()
|
||||||
if self.offset then
|
if this.offset then
|
||||||
GameTooltip:SetInventoryItem("player", self.offset == 2 and 16 or 17)
|
GameTooltip:SetInventoryItem("player", this.offset == 2 and 16 or 17)
|
||||||
else
|
else
|
||||||
GameTooltip:SetUnitAura("player", self:GetID(), self:GetParent().filter)
|
GameTooltip:SetPlayerBuff(this.index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local OnEnter = function(self)
|
local function OnEnter()
|
||||||
if not self:IsVisible() then return end
|
if not this:IsVisible() then return end
|
||||||
|
|
||||||
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", -5, -5)
|
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT", -5, -5)
|
||||||
self:UpdateTooltip()
|
this:UpdateTooltip()
|
||||||
end
|
end
|
||||||
|
|
||||||
local OnLeave = function()
|
local function OnLeave()
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
local OnClick = function(self)
|
local function OnClick()
|
||||||
if self.offset then
|
if this.index and this.index > 0 then
|
||||||
if self.offset == 2 then
|
CancelPlayerBuff(this.index)
|
||||||
CancelPlayerBuff(17)
|
|
||||||
elseif self.offset == 5 then
|
|
||||||
CancelPlayerBuff(16)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
CancelUnitBuff("player", self:GetID(), self:GetParent().filter)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -141,9 +134,9 @@ function A:CreateIcon(button)
|
|||||||
E:SetInside(button.highlight)
|
E:SetInside(button.highlight)
|
||||||
|
|
||||||
button.UpdateTooltip = UpdateTooltip
|
button.UpdateTooltip = UpdateTooltip
|
||||||
button:SetScript("OnEnter",function() OnEnter(this) end)
|
button:SetScript("OnEnter", OnEnter)
|
||||||
button:SetScript("OnLeave", function() OnLeave(this) end)
|
button:SetScript("OnLeave", OnLeave)
|
||||||
button:SetScript("OnClick", function() OnClick(this) end)
|
button:SetScript("OnClick", OnClick)
|
||||||
|
|
||||||
E:SetTemplate(button, "Default")
|
E:SetTemplate(button, "Default")
|
||||||
end
|
end
|
||||||
@@ -191,6 +184,51 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
|
|||||||
|
|
||||||
wipe(buttons)
|
wipe(buttons)
|
||||||
local button
|
local button
|
||||||
|
local numWeapon = 0
|
||||||
|
if weaponPosition then
|
||||||
|
local hasMainHandEnchant, mainHandExpiration, _, hasOffHandEnchant, offHandExpiration = GetWeaponEnchantInfo()
|
||||||
|
for weapon = 2, 1, -1 do
|
||||||
|
button = _G["ElvUIPlayerBuffsTempEnchant"..weapon]
|
||||||
|
if select(weapon, hasMainHandEnchant, hasOffHandEnchant) then
|
||||||
|
numWeapon = numWeapon + 1
|
||||||
|
if not button then
|
||||||
|
button = CreateFrame("Button", "$parentTempEnchant"..weapon, header)
|
||||||
|
self:CreateIcon(button)
|
||||||
|
end
|
||||||
|
if button then
|
||||||
|
if button:IsShown() then button:Hide() end
|
||||||
|
|
||||||
|
local index = enchantableSlots[weapon]
|
||||||
|
local quality = GetInventoryItemQuality("player", index)
|
||||||
|
button.texture:SetTexture(GetInventoryItemTexture("player", index))
|
||||||
|
|
||||||
|
if quality then
|
||||||
|
button:SetBackdropBorderColor(GetItemQualityColor(quality))
|
||||||
|
end
|
||||||
|
|
||||||
|
local expirationTime = select(weapon, mainHandExpiration, offHandExpiration)
|
||||||
|
if expirationTime then
|
||||||
|
button.offset = select(weapon, 2, 5)
|
||||||
|
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
|
||||||
|
button.nextUpdate = -1
|
||||||
|
A.UpdateTime(button, 0)
|
||||||
|
else
|
||||||
|
button.timeLeft = nil
|
||||||
|
button.offset = nil
|
||||||
|
button:SetScript("OnUpdate", nil)
|
||||||
|
button.time:SetText("")
|
||||||
|
end
|
||||||
|
buttons[weapon] = button
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if button and type(button.Hide) == "function" then
|
||||||
|
button.offset = nil
|
||||||
|
button:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, getn(auraTable) do
|
for i = 1, getn(auraTable) do
|
||||||
button = _G[headerName.."AuraButton"..i]
|
button = _G[headerName.."AuraButton"..i]
|
||||||
if button then
|
if button then
|
||||||
@@ -200,10 +238,10 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
|
|||||||
self:CreateIcon(button)
|
self:CreateIcon(button)
|
||||||
end
|
end
|
||||||
local buffInfo = auraTable[i]
|
local buffInfo = auraTable[i]
|
||||||
button:SetID(buffInfo.index)
|
button.index = buffInfo.index
|
||||||
|
|
||||||
if buffInfo.duration > 0 and buffInfo.expires then
|
if buffInfo.expires and buffInfo.expires > 0 then
|
||||||
local timeLeft = buffInfo.expires - GetTime()
|
local timeLeft = buffInfo.expires
|
||||||
if not button.timeLeft then
|
if not button.timeLeft then
|
||||||
button.timeLeft = timeLeft
|
button.timeLeft = timeLeft
|
||||||
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
|
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
|
||||||
@@ -234,51 +272,7 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
|
|||||||
|
|
||||||
button.texture:SetTexture(buffInfo.icon)
|
button.texture:SetTexture(buffInfo.icon)
|
||||||
|
|
||||||
buttons[i] = button
|
buttons[i+1] = button
|
||||||
end
|
|
||||||
|
|
||||||
if weaponPosition then
|
|
||||||
local hasMainHandEnchant, mainHandExpiration, _, hasOffHandEnchant, offHandExpiration = GetWeaponEnchantInfo()
|
|
||||||
for weapon = 2, 1, -1 do
|
|
||||||
button = _G["ElvUIPlayerBuffsTempEnchant"..weapon]
|
|
||||||
if select(weapon, hasMainHandEnchant, hasOffHandEnchant) then
|
|
||||||
if not button then
|
|
||||||
button = CreateFrame("Button", "$parentTempEnchant"..weapon, header)
|
|
||||||
self:CreateIcon(button)
|
|
||||||
end
|
|
||||||
if button then
|
|
||||||
if button:IsShown() then button:Hide() end
|
|
||||||
|
|
||||||
local index = enchantableSlots[weapon]
|
|
||||||
local quality = GetInventoryItemQuality("player", index)
|
|
||||||
button.texture:SetTexture(GetInventoryItemTexture("player", index))
|
|
||||||
|
|
||||||
if quality then
|
|
||||||
button:SetBackdropBorderColor(GetItemQualityColor(quality))
|
|
||||||
end
|
|
||||||
|
|
||||||
local expirationTime = select(weapon, mainHandExpiration, offHandExpiration)
|
|
||||||
if expirationTime then
|
|
||||||
button.offset = select(weapon, 2, 5)
|
|
||||||
button:SetScript("OnUpdate", function() self.UpdateTime(this, arg1) end)
|
|
||||||
button.nextUpdate = -1
|
|
||||||
A.UpdateTime(button, 0)
|
|
||||||
else
|
|
||||||
button.timeLeft = nil
|
|
||||||
button.offset = nil
|
|
||||||
button:SetScript("OnUpdate", nil)
|
|
||||||
button.time:SetText("")
|
|
||||||
end
|
|
||||||
|
|
||||||
buttons[getn(buttons)+1] = button
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if button and type(button.Hide) == "function" then
|
|
||||||
button.offset = nil
|
|
||||||
button:Hide()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local display = getn(buttons)
|
local display = getn(buttons)
|
||||||
@@ -313,7 +307,7 @@ function A:ConfigureAuras(header, auraTable, weaponPosition)
|
|||||||
top = max(top, button:GetTop() or -huge)
|
top = max(top, button:GetTop() or -huge)
|
||||||
bottom = min(bottom, button:GetBottom() or huge)
|
bottom = min(bottom, button:GetBottom() or huge)
|
||||||
end
|
end
|
||||||
local deadIndex = getn(auraTable) + 1
|
local deadIndex = (getn(auraTable) + numWeapon) + 1
|
||||||
button = _G[headerName.."AuraButton"..deadIndex]
|
button = _G[headerName.."AuraButton"..deadIndex]
|
||||||
while button do
|
while button do
|
||||||
if button:IsShown() then button:Hide() end
|
if button:IsShown() then button:Hide() end
|
||||||
@@ -393,7 +387,7 @@ local function sortFactory(key, separateOwn, reverse)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local sorters = {}
|
local sorters = {}
|
||||||
for _, key in ipairs{"index", "name", "expires"} do
|
for _, key in ipairs{"index", "expires"} do
|
||||||
local label = string.upper(key)
|
local label = string.upper(key)
|
||||||
sorters[label] = {}
|
sorters[label] = {}
|
||||||
for bool in pairs{[true] = true, [false] = false} do
|
for bool in pairs{[true] = true, [false] = false} do
|
||||||
@@ -415,30 +409,27 @@ function A:UpdateHeader(header)
|
|||||||
local weaponPosition
|
local weaponPosition
|
||||||
if filter == "HELPFUL" then
|
if filter == "HELPFUL" then
|
||||||
db = self.db.buffs
|
db = self.db.buffs
|
||||||
weaponPosition = 0
|
weaponPosition = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local aura, _
|
for i = 0, 23 do
|
||||||
for i = 1, 16 do
|
local aura, _ = freshTable()
|
||||||
aura, _ = freshTable()
|
aura.index, aura.untilCancelled = GetPlayerBuff(i, filter)
|
||||||
aura.buffIndex, aura.untilCancelled = GetPlayerBuff(i, filter)
|
if aura.index < 0 then
|
||||||
if aura.buffIndex > 0 then
|
|
||||||
aura.icon, aura.count, aura.dispelType, aura.duration = GetPlayerBuffTexture(aura.buffIndex), GetPlayerBuffApplications(aura.buffIndex), GetPlayerBuffDispelType(aura.buffIndex), GetPlayerBuffTimeLeft(aura.buffIndex)
|
|
||||||
aura.filter = filter
|
|
||||||
aura.index = i
|
|
||||||
|
|
||||||
tinsert(sortingTable, aura)
|
|
||||||
else
|
|
||||||
releaseTable(aura)
|
releaseTable(aura)
|
||||||
|
else
|
||||||
|
aura.icon, aura.count, aura.dispelType, aura.expires = GetPlayerBuffTexture(aura.index), GetPlayerBuffApplications(aura.index), GetPlayerBuffDispelType(aura.index), GetPlayerBuffTimeLeft(aura.index)
|
||||||
|
aura.filter = filter
|
||||||
|
sortingTable[i+1] = aura
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sortMethod = (sorters[db.sortMethod] or sorters["INDEX"])[db.sortDir == "-"][db.seperateOwn]
|
local sortMethod = (sorters[db.sortMethod] or sorters["INDEX"])[db.sortDir == "-"][db.seperateOwn]
|
||||||
--tsort(sortingTable, sortMethod)
|
tsort(sortingTable, sortMethod)
|
||||||
|
|
||||||
self:ConfigureAuras(header, sortingTable, weaponPosition)
|
self:ConfigureAuras(header, sortingTable, weaponPosition)
|
||||||
while sortingTable[1] do
|
while sortingTable[1] do
|
||||||
releaseTable(tremove(sortingTable))
|
releaseTable(wipe(sortingTable))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user