remove temp folder structure

This commit is contained in:
Crum
2018-02-19 21:03:21 -06:00
parent 85a2a5bcf7
commit 611f11aff9
408 changed files with 0 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:NewModule("DataBars", "AceEvent-3.0");
E.DataBars = mod
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
local UIFrameFadeOut = UIFrameFadeOut
function mod:OnLeave()
if (this == ElvUI_ExperienceBar and mod.db.experience.mouseover) or (this == ElvUI_ReputationBar and mod.db.reputation.mouseover) then
UIFrameFadeOut(this, 1, this:GetAlpha(), 0)
end
GameTooltip:Hide()
end
function mod:CreateBar(name, onEnter, onClick, ...)
local bar = CreateFrame("Button", name, E.UIParent)
bar:SetPoint(unpack(arg))
bar:SetScript("OnEnter", onEnter)
bar:SetScript("OnLeave", mod.OnLeave)
bar:SetScript("OnClick", onClick)
bar:SetFrameStrata("LOW")
E:SetTemplate(bar, "Transparent")
bar:Hide()
bar.statusBar = CreateFrame("StatusBar", nil, bar)
E:SetInside(bar.statusBar)
bar.statusBar:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(bar.statusBar)
bar.text = bar.statusBar:CreateFontString(nil, "OVERLAY")
E:FontTemplate(bar.text)
bar.text:SetPoint("CENTER", 0, 0)
return bar
end
function mod:UpdateDataBarDimensions()
self:UpdateExperienceDimensions()
self:UpdateReputationDimensions()
end
function mod:PLAYER_LEVEL_UP(level, level2)
print(level, level2)
local maxLevel = 60
if (level ~= maxLevel or not self.db.experience.hideAtMaxLevel) and self.db.experience.enable then
self:UpdateExperience("PLAYER_LEVEL_UP", level)
else
self.expBar:Hide()
end
end
function mod:Initialize()
self.db = E.db.databars
self:LoadExperienceBar()
self:LoadReputationBar()
self:RegisterEvent("PLAYER_LEVEL_UP")
end
local function InitializeCallback()
mod:Initialize()
end
E:RegisterModule(mod:GetName(), InitializeCallback)
+166
View File
@@ -0,0 +1,166 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("DataBars");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local _G = _G
local format = format
local min = min
--WoW API / Variables
local GetPetExperience, UnitXP, UnitXPMax = GetPetExperience, UnitXP, UnitXPMax
local UnitLevel = UnitLevel
local GetXPExhaustion = GetXPExhaustion
function mod:GetXP(unit)
if unit == "pet" then
return GetPetExperience()
else
return UnitXP(unit), UnitXPMax(unit)
end
end
function mod:UpdateExperience(event)
if not mod.db.experience.enable then return end
local bar = self.expBar
local hideXP = (UnitLevel("player") == 60 and self.db.experience.hideAtMaxLevel)
if hideXP then
E:DisableMover(self.expBar.mover:GetName())
bar:Hide()
elseif not hideXP then
E:EnableMover(self.expBar.mover:GetName())
bar:Show()
local cur, max = self:GetXP("player")
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)
local rested = GetXPExhaustion()
local text = ""
local textFormat = self.db.experience.textFormat
if rested and rested > 0 then
bar.rested:SetMinMaxValues(0, max)
bar.rested:SetValue(min(cur + rested, max))
if textFormat == "PERCENT" then
text = format("%d%% R:%d%%", cur / max * 100, rested / max * 100)
elseif textFormat == "CURMAX" then
text = format("%s - %s R:%s", E:ShortValue(cur), E:ShortValue(max), E:ShortValue(rested))
elseif textFormat == "CURPERC" then
text = format("%s - %d%% R:%s [%d%%]", E:ShortValue(cur), cur / max * 100, E:ShortValue(rested), rested / max * 100)
elseif textFormat == "CUR" then
text = format("%s R:%s", E:ShortValue(cur), E:ShortValue(rested))
elseif textFormat == "REM" then
text = format("%s R:%s", E:ShortValue(max - cur), E:ShortValue(rested))
elseif textFormat == "CURREM" then
text = format("%s - %s R:%s", E:ShortValue(cur), E:ShortValue(max - cur), E:ShortValue(rested))
elseif textFormat == "CURPERCREM" then
text = format("%s - %d%% (%s) R:%s", E:ShortValue(cur), cur / max * 100, E:ShortValue(max - cur), E:ShortValue(rested))
end
else
bar.rested:SetMinMaxValues(0, 1)
bar.rested:SetValue(0)
if textFormat == "PERCENT" then
text = format("%d%%", cur / max * 100)
elseif textFormat == "CURMAX" then
text = format("%s - %s", E:ShortValue(cur), E:ShortValue(max))
elseif textFormat == "CURPERC" then
text = format("%s - %d%%", E:ShortValue(cur), cur / max * 100)
elseif textFormat == "CUR" then
text = format("%s", E:ShortValue(cur))
elseif textFormat == "REM" then
text = format("%s", E:ShortValue(max - cur))
elseif textFormat == "CURREM" then
text = format("%s - %s", E:ShortValue(cur), E:ShortValue(max - cur))
elseif textFormat == "CURPERCREM" then
text = format("%s - %d%% (%s)", E:ShortValue(cur), cur / max * 100, E:ShortValue(max - cur))
end
end
bar.text:SetText(text)
end
end
function mod:ExperienceBar_OnEnter()
if mod.db.experience.mouseover then
UIFrameFadeIn(this, 0.4, this:GetAlpha(), 1)
end
GameTooltip:ClearLines()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR", 0, -4)
local cur, max = mod:GetXP("player")
local rested = GetXPExhaustion()
GameTooltip:AddLine(L["Experience"])
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(L["XP:"], format(" %d / %d (%d%%)", cur, max, cur/max * 100), 1, 1, 1)
GameTooltip:AddDoubleLine(L["Remaining:"], format(" %d (%d%% - %d "..L["Bars"]..")", max - cur, (max - cur) / max * 100, 20 * (max - cur) / max), 1, 1, 1)
if rested then
GameTooltip:AddDoubleLine(L["Rested:"], format("+%d (%d%%)", rested, rested / max * 100), 1, 1, 1)
end
GameTooltip:Show()
end
function mod:ExperienceBar_OnClick()
end
function mod:UpdateExperienceDimensions()
self.expBar:SetWidth(self.db.experience.width)
self.expBar:SetHeight(self.db.experience.height)
E:FontTemplate(self.expBar.text, LSM:Fetch("font", self.db.experience.font), self.db.experience.textSize, self.db.experience.fontOutline)
self.expBar.rested:SetOrientation(self.db.experience.orientation)
self.expBar.statusBar:SetOrientation(self.db.experience.orientation)
if self.db.experience.mouseover then
self.expBar:SetAlpha(0)
else
self.expBar:SetAlpha(1)
end
end
function mod:EnableDisable_ExperienceBar()
local maxLevel = 60
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:UnregisterEvent("UPDATE_EXPANSION_LEVEL")
self:UpdateExperience()
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.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.statusBar:SetStatusBarColor(0, 0.4, 1, .8)
self.expBar.rested = CreateFrame("StatusBar", nil, self.expBar)
E:SetInside(self.expBar.rested)
self.expBar.rested:SetStatusBarTexture(E.media.normTex)
E:RegisterStatusBar(self.expBar.rested)
self.expBar.rested:SetStatusBarColor(1, 0, 1, 0.2)
self:UpdateExperienceDimensions()
E:CreateMover(self.expBar, "ExperienceBarMover", L["Experience Bar"])
self:EnableDisable_ExperienceBar()
end
+5
View File
@@ -0,0 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="DataBars.lua"/>
<Script file="Experience.lua"/>
<Script file="Reputation.lua"/>
</Ui>
+132
View File
@@ -0,0 +1,132 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local mod = E:GetModule("DataBars");
local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables
--Lua functions
local _G = _G
local format = format
--WoW API / Variables
local GetWatchedFactionInfo, GetNumFactions, GetFactionInfo = GetWatchedFactionInfo, GetNumFactions, GetFactionInfo
local InCombatLockdown = InCombatLockdown
local FACTION_BAR_COLORS = FACTION_BAR_COLORS
local REPUTATION, STANDING = REPUTATION, STANDING
local backupColor = FACTION_BAR_COLORS[1]
local FactionStandingLabelUnknown = UNKNOWN
function mod:UpdateReputation(event)
if not mod.db.reputation.enable then return end
local bar = self.repBar
local ID, standingLabel
local name, reaction, min, max, value = GetWatchedFactionInfo()
local numFactions = GetNumFactions()
if not name then
bar:Hide()
elseif name then
bar:Show()
local text = ""
local textFormat = self.db.reputation.textFormat
local color = FACTION_BAR_COLORS[reaction] or backupColor
bar.statusBar:SetStatusBarColor(color.r, color.g, color.b)
bar.statusBar:SetMinMaxValues(min, max)
bar.statusBar:SetValue(value)
for i = 1, numFactions do
local factionName, _, standingID = GetFactionInfo(i)
if factionName == name then
ID = standingID;
end
end
if ID then
standingLabel = _G["FACTION_STANDING_LABEL"..ID]
else
standingLabel = FactionStandingLabelUnknown
end
--Prevent a division by zero
local maxMinDiff = max - min
if maxMinDiff == 0 then
maxMinDiff = 1
end
if textFormat == "PERCENT" then
text = format("%s: %d%% [%s]", name, ((value - min) / maxMinDiff * 100), standingLabel)
elseif textFormat == "CURMAX" then
text = format("%s: %s - %s [%s]", name, E:ShortValue(value - min), E:ShortValue(max - min), standingLabel)
elseif textFormat == "CURPERC" then
text = format("%s: %s - %d%% [%s]", name, E:ShortValue(value - min), ((value - min) / maxMinDiff * 100), standingLabel)
elseif textFormat == "CUR" then
text = format("%s: %s [%s]", name, E:ShortValue(value - min), standingLabel)
elseif textFormat == "REM" then
text = format("%s: %s [%s]", name, E:ShortValue((max - min) - (value-min)), standingLabel)
elseif textFormat == "CURREM" then
text = format("%s: %s - %s [%s]", name, E:ShortValue(value - min), E:ShortValue((max - min) - (value-min)), standingLabel)
elseif textFormat == "CURPERCREM" then
text = format("%s: %s - %d%% (%s) [%s]", name, E:ShortValue(value - min), ((value - min) / maxMinDiff * 100), E:ShortValue((max - min) - (value-min)), standingLabel)
end
bar.text:SetText(text)
end
end
function mod:ReputationBar_OnEnter()
if mod.db.reputation.mouseover then
UIFrameFadeIn(this, 0.4, this:GetAlpha(), 1)
end
GameTooltip:ClearLines()
GameTooltip:SetOwner(this, "ANCHOR_CURSOR", 0, -4)
local name, reaction, min, max, value = GetWatchedFactionInfo()
if name then
GameTooltip:AddLine(name)
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine(STANDING..":", _G["FACTION_STANDING_LABEL"..reaction], 1, 1, 1)
GameTooltip:AddDoubleLine(REPUTATION..":", format("%d / %d (%d%%)", value - min, max - min, (value - min) / ((max - min == 0) and max or (max - min)) * 100), 1, 1, 1)
end
GameTooltip:Show()
end
function mod:ReputationBar_OnClick()
ToggleCharacter("ReputationFrame");
end
function mod:UpdateReputationDimensions()
self.repBar:SetWidth(self.db.reputation.width)
self.repBar:SetHeight(self.db.reputation.height)
self.repBar.statusBar:SetOrientation(self.db.reputation.orientation)
E:FontTemplate(self.repBar.text, LSM:Fetch("font", self.db.reputation.font), self.db.reputation.textSize, self.db.reputation.fontOutline)
if self.db.reputation.mouseover then
self.repBar:SetAlpha(0)
else
self.repBar:SetAlpha(1)
end
end
function mod:EnableDisable_ReputationBar()
if self.db.reputation.enable then
self:RegisterEvent("UPDATE_FACTION", "UpdateReputation")
self:UpdateReputation()
E:EnableMover(self.repBar.mover:GetName())
else
self:UnregisterEvent("UPDATE_FACTION")
self.repBar:Hide()
E:DisableMover(self.repBar.mover:GetName())
end
end
function mod:LoadReputationBar()
self.repBar = self:CreateBar("ElvUI_ReputationBar", self.ReputationBar_OnEnter, self.ReputationBar_OnClick, "RIGHT", RightChatPanel, "LEFT", E.Border - E.Spacing*3, 0)
E:RegisterStatusBar(self.repBar.statusBar)
self:UpdateReputationDimensions()
E:CreateMover(self.repBar, "ReputationBarMover", L["Reputation Bar"])
self:EnableDisable_ReputationBar()
end