Skip to content

Commit

Permalink
Merge branch 'ElvUI-WotLK:master' into ImprovedTooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
eTzmNcbkrng committed Jun 12, 2021
2 parents 5619107 + ead0b71 commit a558520
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 85 deletions.
9 changes: 8 additions & 1 deletion ElvUI/Core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ function E:UpdateAll(ignoreInstall)
Chat:UpdateAnchors()
end

DataBars:EnableDisable_ExperienceBar()
DataBars:ExperienceBar_Toggle()
DataBars:EnableDisable_ReputationBar()
DataBars:UpdateDataBarDimensions()

Expand Down Expand Up @@ -1231,6 +1231,13 @@ function E:DBConversions()
if E.private.skins.blizzard.greeting ~= nil then
E.private.skins.blizzard.greeting = nil
end

--Rename GameTooltip Mover
if E.db.movers and E.db.movers.TooltipMover then
E.db.movers.ElvTooltipMover = E.db.movers.TooltipMover

E.db.movers.TooltipMover = nil
end
end

function E:RefreshModulesDB()
Expand Down
2 changes: 1 addition & 1 deletion ElvUI/Libraries/Ace3/AceTimer-3.0/AceTimer-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ end
function AceTimer:TimeLeft(id)
local timer = activeTimers[id]
if not timer then
return 0
return
else
return timer.ends - GetTime()
end
Expand Down
2 changes: 1 addition & 1 deletion ElvUI/Libraries/oUF/elements/castbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ local function Enable(self, unit)

local safeZone = element.SafeZone
if(safeZone and safeZone:IsObjectType('Texture') and not safeZone:GetTexture()) then
safeZone:SetColorTexture(1, 0, 0)
safeZone:SetTexture(1, 0, 0)
end

element:Hide()
Expand Down
11 changes: 7 additions & 4 deletions ElvUI/Libraries/oUF_Plugins/oUF_Fader/oUF_Fader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local UnitPowerType = UnitPowerType
local E -- ElvUI engine defined in ClearTimers
local MIN_ALPHA, MAX_ALPHA = .35, 1
local onRangeObjects, onRangeFrame = {}
local PowerTypesFull = {MANA = true, FOCUS = true, ENERGY = true}
local PowerTypesFull = {MANA = true, ENERGY = true}

local function ClearTimers(element)
if not E then E = _G.ElvUI[1] end
Expand Down Expand Up @@ -228,10 +228,13 @@ local options = {
},
Power = {
enable = function(self)
self:RegisterEvent('UNIT_POWER_UPDATE', Update)
self:RegisterEvent('UNIT_MAXPOWER', Update)
self:RegisterEvent('UNIT_MANA', Update)
self:RegisterEvent('UNIT_MAXMANA', Update)
self:RegisterEvent('UNIT_ENERGY', Update)
self:RegisterEvent('UNIT_MAXENERGY', Update)

end,
events = {'UNIT_POWER_UPDATE','UNIT_MAXPOWER'}
events = {'UNIT_MANA','UNIT_MAXMANA','UNIT_ENERGY','UNIT_MAXENERGY'}
},
Vehicle = {
enable = function(self)
Expand Down
Binary file added ElvUI/Media/Textures/Bubbles.tga
Binary file not shown.
4 changes: 2 additions & 2 deletions ElvUI/Modules/DataBars/DataBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ function mod:CreateBar(name, onEnter, onClick, ...)
end

function mod:UpdateDataBarDimensions()
self:UpdateExperienceDimensions()
self:ExperienceBar_UpdateDimensions()
self:UpdatePetExperienceDimensions()
self:UpdateReputationDimensions()
end

function mod:PLAYER_LEVEL_UP(level)
local maxLevel = MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()]
if (level ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:UpdateExperience("PLAYER_LEVEL_UP", level)
self:ExperienceBar_Update("PLAYER_LEVEL_UP", level)
else
self.expBar:Hide()
end
Expand Down
168 changes: 134 additions & 34 deletions ElvUI/Modules/DataBars/Experience.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function mod:GetXP(unit)
end
end

function mod:UpdateExperience(event)
function mod:ExperienceBar_Update(event)
if not mod.db.experience.enable then return end

local bar = self.expBar
Expand All @@ -44,11 +44,32 @@ function mod:UpdateExperience(event)
end

local cur, max = self:GetXP("player")
local total = self:ExperienceBar_QuestXP()
if max <= 0 then max = 1 end

bar.statusBar:SetMinMaxValues(0, max)
bar.statusBar:SetValue(cur - 1 >= 0 and cur - 1 or 0)
bar.statusBar:SetValue(cur)

bar.questBar:SetMinMaxValues(0, max)
bar.questBar:SetValue(min(cur + total, max))

if cur + total >= max then
bar.questBar:SetStatusBarColor(0/255, 255/255, 0/255, 0.5)
else
local color = self.db.experience.questXP.color
bar.questBar:SetStatusBarColor(color.r, color.g, color.b, color.a)
end

bar.bubbles:SetWidth(bar:GetWidth() - 4)
bar.bubbles:SetHeight(bar:GetHeight() - 8)

if self.db.experience.questXP.showBubbles then
bar.bubbles:Show()
else
bar.bubbles:Hide()
end

local rested = GetXPExhaustion()
local text = ""
local textFormat = self.db.experience.textFormat
Expand Down Expand Up @@ -97,6 +118,30 @@ function mod:UpdateExperience(event)
end
end

function mod:ExperienceBar_QuestXP()
local lastQuestLogID = GetQuestLogSelection()
local completedOnly = self.db.experience.questXP.questCompletedOnly
local zoneOnly = self.db.experience.questXP.questCurrentZoneOnly
local zoneText = GetZoneText()
local totalExp = 0
local locationName

for questIndex = 1, GetNumQuestLogEntries() do
SelectQuestLogEntry(questIndex)
local title, _, _, _, isHeader, _, isComplete, _, questID = GetQuestLogTitle(questIndex)

if isHeader then
locationName = title
elseif (not completedOnly or isComplete) and (not zoneOnly or locationName == zoneText) then
totalExp = totalExp + GetQuestLogRewardXP(questID)
end
end

SelectQuestLogEntry(lastQuestLogID)

return totalExp
end

function mod:ExperienceBar_OnEnter()
if mod.db.experience.mouseover then
E:UIFrameFadeIn(self, 0.4, self:GetAlpha(), 1)
Expand All @@ -116,6 +161,10 @@ function mod:ExperienceBar_OnEnter()
GameTooltip:AddDoubleLine(L["Rested:"], format("+%d (%d%%)", rested, rested / max * 100), 1, 1, 1)
end

if mod.db.experience.questXP.tooltip then
GameTooltip:AddDoubleLine("Quest Log XP:", mod:ExperienceBar_QuestXP(), 1, 1, 1)
end

GameTooltip:Show()
end

Expand All @@ -126,61 +175,112 @@ function mod:ExperienceBar_OnClick(button)
end
end

function mod:UpdateExperienceDimensions()
self.expBar:Width(self.db.experience.width)
self.expBar:Height(self.db.experience.height)
function mod:ExperienceBar_UpdateDimensions()
local bar = self.expBar
bar:Width(self.db.experience.width)
bar:Height(self.db.experience.height)

bar.text:FontTemplate(LSM:Fetch("font", self.db.experience.font), self.db.experience.textSize, self.db.experience.fontOutline)
bar.rested:SetOrientation(self.db.experience.orientation)

self.expBar.text:FontTemplate(LSM:Fetch("font", self.db.experience.font), self.db.experience.textSize, self.db.experience.fontOutline)
self.expBar.rested:SetOrientation(self.db.experience.orientation)
bar.statusBar:SetOrientation(self.db.experience.orientation)

self.expBar.statusBar:SetOrientation(self.db.experience.orientation)
bar.questBar:SetOrientation(E.db.databars.experience.orientation)

if self.db.experience.mouseover then
self.expBar:SetAlpha(0)
bar:SetAlpha(0)
else
self.expBar:SetAlpha(1)
bar:SetAlpha(1)
end
end

function mod:EnableDisable_ExperienceBar()
function mod:ExperienceBar_Toggle()
local maxLevel = MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()]
if (UnitLevel("player") ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:RegisterEvent("PLAYER_XP_UPDATE", "UpdateExperience")
self:RegisterEvent("DISABLE_XP_GAIN", "UpdateExperience")
self:RegisterEvent("ENABLE_XP_GAIN", "UpdateExperience")
self:RegisterEvent("UPDATE_EXHAUSTION", "UpdateExperience")
self:RegisterEvent("PLAYER_XP_UPDATE", "ExperienceBar_Update")
self:RegisterEvent("DISABLE_XP_GAIN", "ExperienceBar_Update")
self:RegisterEvent("ENABLE_XP_GAIN", "ExperienceBar_Update")
self:RegisterEvent("UPDATE_EXHAUSTION", "ExperienceBar_Update")
self:RegisterEvent("QUEST_LOG_UPDATE", "ExperienceBar_QuestXP")
self:RegisterEvent("ZONE_CHANGED", "ExperienceBar_QuestXP")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA", "ExperienceBar_QuestXP")
self:UnregisterEvent("UPDATE_EXPANSION_LEVEL")
self:UpdateExperience()

self:ExperienceBar_Update()
E:EnableMover(self.expBar.mover:GetName())
else
self:UnregisterEvent("PLAYER_XP_UPDATE")
self:UnregisterEvent("DISABLE_XP_GAIN")
self:UnregisterEvent("ENABLE_XP_GAIN")
self:UnregisterEvent("UPDATE_EXHAUSTION")
self:RegisterEvent("UPDATE_EXPANSION_LEVEL", "EnableDisable_ExperienceBar")
self:UnregisterEvent("QUEST_LOG_UPDATE")
self:UnregisterEvent("ZONE_CHANGED")
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
self:RegisterEvent("UPDATE_EXPANSION_LEVEL", "ExperienceBar_Toggle")

self.expBar:Hide()
E:DisableMover(self.expBar.mover:GetName())
end
end

function mod:LoadExperienceBar()
self.expBar = self:CreateBar("ElvUI_ExperienceBar", self.ExperienceBar_OnEnter, self.ExperienceBar_OnClick, "LEFT", LeftChatPanel, "RIGHT", -E.Border + E.Spacing*3, 0)
self.expBar:HookScript("OnMouseUp", self.ExperienceBar_OnClick)
self.expBar.statusBar:SetStatusBarColor(0, 0.4, 1, .8)
self.expBar.rested = CreateFrame("StatusBar", nil, self.expBar)
self.expBar.rested:SetInside()
self.expBar.rested:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(self.expBar.rested)
self.expBar.rested:SetStatusBarColor(1, 0, 1, 0.2)

self.expBar.eventFrame = CreateFrame("Frame")
self.expBar.eventFrame:Hide()
self.expBar.eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
self.expBar.eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
self.expBar.eventFrame:SetScript("OnEvent", function(_, event) mod:UpdateExperience(event) end)

self:UpdateExperienceDimensions()

E:CreateMover(self.expBar, "ExperienceBarMover", L["Experience Bar"], nil, nil, nil, nil, nil, "databars,experience")
self:EnableDisable_ExperienceBar()
local bar = self.expBar
bar:HookScript("OnMouseUp", self.ExperienceBar_OnClick)

bar.statusBar:SetStatusBarColor(0, 0.4, 1, .8)
bar.statusBar:SetFrameLevel(4)

bar.rested = CreateFrame("StatusBar", "ElvUI_ExperienceBar_Rested", bar)
bar.rested:SetInside()
bar.rested:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(bar.rested)
bar.rested:SetStatusBarColor(1, 0, 1, 0.2)
bar.rested:SetFrameLevel(2)
bar.rested.statusBar = bar.rested:GetStatusBarTexture()
bar.rested.statusBar:SetDrawLayer("ARTWORK", 2)

bar.questBar = CreateFrame("StatusBar", "ElvUI_ExperienceBar_Quest", bar)
bar.questBar:SetInside()
bar.questBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(bar.questBar)
bar.questBar:SetStatusBarColor(unpack(self.db.experience.questXP.color))
bar.questBar:SetFrameLevel(3)
bar.questBar.statusBar = bar.questBar:GetStatusBarTexture()
bar.questBar.statusBar:SetDrawLayer("ARTWORK", 3)

bar.eventFrame = CreateFrame("Frame")
bar.eventFrame:Hide()
bar.eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
bar.eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
bar.eventFrame:SetScript("OnEvent", function(_, event)
mod:ExperienceBar_Update(event)
end)

bar.questBar.eventFrame = CreateFrame("Frame")
bar.questBar.eventFrame:Hide()
bar.questBar.eventFrame:RegisterEvent("QUEST_LOG_UPDATE")
bar.questBar.eventFrame:RegisterEvent("PLAYER_XP_UPDATE")
bar.questBar.eventFrame:RegisterEvent("UPDATE_EXHAUSTION")
bar.questBar.eventFrame:RegisterEvent("ZONE_CHANGED")
bar.questBar.eventFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
bar.questBar.eventFrame:RegisterEvent("UNIT_PORTRAIT_UPDATE")
bar.questBar.eventFrame:SetScript("OnEvent", function(self, event)
mod:ExperienceBar_Update(event)
end)

bar.bubbles = CreateFrame("StatusBar", nil, bar)
bar.bubbles:SetStatusBarTexture("Interface\\AddOns\\ElvUI\\media\\textures\\Bubbles")
bar.bubbles:SetPoint("CENTER", bar, "CENTER", 0, 0)
bar.bubbles:SetWidth(bar:GetWidth() - 4)
bar.bubbles:SetHeight(bar:GetHeight() - 8)
bar.bubbles:SetInside()
-- XXX: Blizz tiling breakage.
bar.bubbles:GetStatusBarTexture():SetHorizTile(false)
bar.bubbles:SetFrameLevel(bar:GetFrameLevel() + 4)

self:ExperienceBar_UpdateDimensions()

E:CreateMover(bar, "ExperienceBarMover", L["Experience Bar"], nil, nil, nil, nil, nil, "databars,experience")
self:ExperienceBar_Toggle()
end
4 changes: 2 additions & 2 deletions ElvUI/Modules/DataTexts/Guild.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ local noteFormat = join("", "|cff999999 ", LABEL_NOTE, ":|r %s")
local officerNoteFormat = join("", "|cff999999 ", GUILD_RANK1_DESC, ":|r %s")

local inGroupStamp = "|cffaaaaaa*|r"
local friendOnlineString = select(2, string.split(" ", ERR_FRIEND_ONLINE_SS, 2))
local friendOfflineString = select(2, string.split(" ", ERR_FRIEND_OFFLINE_S, 2))
local friendOnlineString = string.gsub(ERR_FRIEND_ONLINE_SS, ".+|h", "")
local friendOfflineString = string.gsub(ERR_FRIEND_OFFLINE_S, "%%s", "")

local onlineStatusString = "|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r"
local onlineStatus = {
Expand Down
11 changes: 4 additions & 7 deletions ElvUI/Modules/Misc/DebugTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ function D:ModifyErrorFrame()

local Orig_ScriptErrorsFrame_Update = ScriptErrorsFrame_Update
ScriptErrorsFrame_Update = function(...)
if GetCVarBool("scriptErrors") ~= 1 then
Orig_ScriptErrorsFrame_Update(...)
return
end

-- Sometimes the locals table does not have an entry for an index, which can cause an argument #6 error
-- in Blizzard_DebugTools.lua:430 and then cause a C stack overflow, this will prevent that
local index = ScriptErrorsFrame.index
Expand All @@ -32,8 +27,10 @@ function D:ModifyErrorFrame()

Orig_ScriptErrorsFrame_Update(...)

-- Stop text highlighting again
ScriptErrorsFrameScrollFrameText:HighlightText(0, 0)
if GetCVarBool("scriptErrors") == 1 then
-- Stop text highlighting again
ScriptErrorsFrameScrollFrameText:HighlightText(0, 0)
end
end

-- Unhighlight text when focus is hit
Expand Down
Loading

0 comments on commit a558520

Please sign in to comment.