mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-28 00:44:45 +00:00
Small cleaning
This commit is contained in:
@@ -46,19 +46,17 @@ function E:IsEvenNumber(num)
|
||||
return mod(num, 2) == 0
|
||||
end
|
||||
|
||||
function E:ColorGradient(perc, ...)
|
||||
if not arg[9] then return end
|
||||
|
||||
function E:ColorGradient(perc, r1, g1, b1, r2, g2, b2, r3, g3, b3)
|
||||
if perc >= 1 then
|
||||
return arg[7], arg[8], arg[9]
|
||||
return r3, g3, b3
|
||||
elseif perc <= 0 then
|
||||
return arg[1], arg[2], arg[3]
|
||||
return r1, g1, b1
|
||||
end
|
||||
|
||||
local num = getn(arg) / 3
|
||||
local segment, relperc = math.modf(perc*(num-1))
|
||||
|
||||
local r1, g1, b1, r2, g2, b2 = select((segment*3)+1, unpack(arg))
|
||||
local segment, relperc = modf(perc)
|
||||
if segment > 0 then
|
||||
r1, g1, b1, r2, g2, b2 = r2, g2, b2, r3, g3, b3
|
||||
end
|
||||
|
||||
return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc
|
||||
end
|
||||
@@ -72,7 +70,7 @@ function E:Round(num, idp)
|
||||
end
|
||||
|
||||
function E:Truncate(v, decimals)
|
||||
return 0
|
||||
return v - (mod(v, 0.1 ^ (decimals or 0)))
|
||||
end
|
||||
|
||||
function E:RGBToHex(r, g, b)
|
||||
|
||||
@@ -6,7 +6,6 @@ local _G = _G
|
||||
local tonumber, type = tonumber, type
|
||||
local format, lower, match = string.format, string.lower, string.match
|
||||
--WoW API / Variables
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local UIFrameFadeOut, UIFrameFadeIn = UIFrameFadeOut, UIFrameFadeIn
|
||||
local EnableAddOn, DisableAddOn, DisableAllAddOns = EnableAddOn, DisableAddOn, DisableAllAddOns
|
||||
local SetCVar = SetCVar
|
||||
@@ -15,7 +14,6 @@ local debugprofilestart, debugprofilestop = debugprofilestart, debugprofilestop
|
||||
local UpdateAddOnCPUUsage, GetAddOnCPUUsage = UpdateAddOnCPUUsage, GetAddOnCPUUsage
|
||||
local ResetCPUUsage = ResetCPUUsage
|
||||
local GetAddOnInfo = GetAddOnInfo
|
||||
local ERR_NOT_IN_COMBAT = ERR_NOT_IN_COMBAT
|
||||
|
||||
function E:EnableAddon(addon)
|
||||
local _, _, _, _, _, reason, _ = GetAddOnInfo(addon)
|
||||
@@ -54,8 +52,8 @@ function FarmMode()
|
||||
end
|
||||
|
||||
function E:FarmMode(msg)
|
||||
if(E.private.general.minimap.enable ~= true) then return end
|
||||
if(msg and type(tonumber(msg)) == "number" and tonumber(msg) <= 500 and tonumber(msg) >= 20 and not InCombatLockdown()) then
|
||||
if E.private.general.minimap.enable ~= true then return end
|
||||
if msg and type(tonumber(msg)) == "number" and tonumber(msg) <= 500 and tonumber(msg) >= 20 then
|
||||
E.db.farmSize = tonumber(msg)
|
||||
FarmModeMap:Size(tonumber(msg))
|
||||
end
|
||||
|
||||
@@ -10,7 +10,6 @@ local twipe, tinsert, tremove, next = table.wipe, tinsert, tremove, next
|
||||
local floor = floor
|
||||
local format, find, match, strrep, len, sub, gsub = string.format, string.find, string.match, strrep, string.len, string.sub, string.gsub
|
||||
--WoW API / Variables
|
||||
local UnitGUID = UnitGUID
|
||||
local CreateFrame = CreateFrame
|
||||
local GetActiveTalentGroup = GetActiveTalentGroup
|
||||
local GetCVar = GetCVar
|
||||
@@ -138,22 +137,25 @@ E.DEFAULT_FILTER = {
|
||||
E.noop = function() end
|
||||
|
||||
local colorizedName
|
||||
local length = len("ElvUI")
|
||||
for i = 1, length do
|
||||
local letter = sub("ElvUI", i, i)
|
||||
if(i == 1) then
|
||||
colorizedName = format("|cffA11313%s", letter)
|
||||
elseif(i == 2) then
|
||||
colorizedName = format("%s|r|cffC4C4C4%s", colorizedName, letter)
|
||||
elseif(i == length) then
|
||||
colorizedName = format("%s%s|r|cffA11313:|r ", colorizedName, letter)
|
||||
else
|
||||
colorizedName = colorizedName .. letter
|
||||
function E:ColorizedName(name, colon)
|
||||
local length = len(name)
|
||||
for i = 1, length do
|
||||
local letter = sub(name, i, i)
|
||||
if i == 1 then
|
||||
colorizedName = format("|cffA11313%s", letter)
|
||||
elseif i == 2 then
|
||||
colorizedName = format("%s|r|cffC4C4C4%s", colorizedName, letter)
|
||||
elseif i == length and colon then
|
||||
colorizedName = format("%s%s|r|cffA11313:|r", colorizedName, letter)
|
||||
else
|
||||
colorizedName = colorizedName..letter
|
||||
end
|
||||
end
|
||||
return colorizedName
|
||||
end
|
||||
|
||||
function E:Print(...)
|
||||
print(colorizedName, unpack(arg))
|
||||
function E:Print(msg)
|
||||
print(self:ColorizedName("ElvUI", true), msg)
|
||||
end
|
||||
|
||||
E.PriestColors = {
|
||||
@@ -623,7 +625,7 @@ function E:TableToLuaString(inTable)
|
||||
if(type(v) == "number") then
|
||||
ret = ret .. v .. ",\n"
|
||||
elseif(type(v) == "string") then
|
||||
ret = ret .. "\"" .. v:gsub("\\", "\\\\"):gsub("\n", "\\n"):gsub("\"", "\\\"") .. "\",\n"
|
||||
ret = ret .. "\"" .. gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"") .. "\",\n"
|
||||
elseif(type(v) == "boolean") then
|
||||
if(v) then
|
||||
ret = ret .. "true,\n"
|
||||
@@ -710,7 +712,7 @@ function E:ProfileTableToPluginFormat(inTable, profileType)
|
||||
if(type(v) == "number") then
|
||||
returnString = returnString .. v .. "\n"
|
||||
elseif(type(v) == "string") then
|
||||
returnString = returnString .. "\"" .. v:gsub("\\", "\\\\"):gsub("\n", "\\n"):gsub("\"", "\\\"") .. "\"\n"
|
||||
returnString = returnString .. "\"" .. gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"") .. "\"\n"
|
||||
elseif(type(v) == "boolean") then
|
||||
if(v) then
|
||||
returnString = returnString .. "true\n"
|
||||
@@ -1091,7 +1093,6 @@ function E:Initialize()
|
||||
twipe(self.global)
|
||||
twipe(self.private)
|
||||
|
||||
--self.myguid = UnitGUID("player")
|
||||
self.data = LibStub("AceDB-3.0"):New("ElvDB", self.DF)
|
||||
self.data.RegisterCallback(self, "OnProfileChanged", "UpdateAll")
|
||||
self.data.RegisterCallback(self, "OnProfileCopied", "UpdateAll")
|
||||
|
||||
@@ -4,7 +4,7 @@ local LSM = LibStub("LibSharedMedia-3.0");
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local unpack, type, getmetatable = unpack, type, getmetatable
|
||||
local unpack, type = unpack, type
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
|
||||
|
||||
@@ -390,7 +390,6 @@ function SetDefaultModuleLibraries(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
error("Usage: SetDefaultModuleLibraries(...): cannot change the module defaults after a module has been registered.", 2)
|
||||
end
|
||||
local args = self.defaultModuleLibraries or {}
|
||||
|
||||
args[1] = a1
|
||||
args[2] = a2
|
||||
args[3] = a3
|
||||
@@ -401,7 +400,6 @@ function SetDefaultModuleLibraries(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
|
||||
args[8] = a8
|
||||
args[9] = a9
|
||||
args[10] = a10
|
||||
truncate(tmp,10)
|
||||
|
||||
self.defaultModuleLibraries = args
|
||||
end
|
||||
|
||||
@@ -72,7 +72,6 @@ end
|
||||
|
||||
local SafeDispatchers = setmetatable({}, {__index=function(self, argCount)
|
||||
local dispatcher
|
||||
if not tonumber(argCount) then dbg(debugstack()) end
|
||||
if argCount > 0 then
|
||||
dispatcher = CreateSafeDispatcher(argCount)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user