This commit is contained in:
Crum
2018-01-08 20:56:48 -06:00
parent 1914e744af
commit badcd649e9
4 changed files with 113 additions and 95 deletions
+2 -2
View File
@@ -728,7 +728,7 @@ local function SetPage(PageNum)
InstallOption3Button:SetText(CLASS)
elseif PageNum == 5 then
f.SubTitle:SetText(L["Resolution"])
f.Desc1:SetText(L["Your current resolution is %s, this is considered a %s resolution."], E.resolution, E.lowversion == true and L["low"] or L["high"])
f.Desc1:SetText(format(L["Your current resolution is %s, this is considered a %s resolution."], E.resolution, E.lowversion == true and L["low"] or L["high"]))
if E.lowversion then
f.Desc2:SetText(L["This resolution requires that you change some settings to get everything to fit on your screen."].." "..L["Click the button below to resize your chat frames, unitframes, and reposition your actionbars."].." "..L["You may need to further alter these settings depending how low you resolution is."])
f.Desc3:SetText(L["Importance: |cff07D400High|r"])
@@ -773,7 +773,7 @@ local function SetPage(PageNum)
InstallOption2Button:SetText(L["Icons Only"])
elseif PageNum == 8 then
f.SubTitle:SetText(L["Installation Complete"])
f.Desc1:SetText(L["You are now finished with the installation process. If you are in need of technical support please visit us at https://github.com/ElvUI-TBC/ElvUI"])
f.Desc1:SetText(L["You are now finished with the installation process. If you are in need of technical support please visit us at https://github.com/ElvUI-Vanilla/ElvUI"])
f.Desc2:SetText(L["Please click the button below so you can setup variables and ReloadUI."])
InstallOption1Button:Show()
InstallOption1Button:SetScript("OnClick", InstallComplete)
@@ -10,7 +10,6 @@ local modf = math.modf
local sub = string.sub
local format = string.format
local getn = table.getn
local gsub = string.gsub
local strlen = string.len
local byte = string.byte
@@ -20,21 +19,21 @@ if not LibBase64 then
return
end
local chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
local _chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
local charTable = {}
local byteToNum = {}
local numToChar = {}
for i = 1, strlen(chars) do
charTable[i] = sub(chars, i, i)
for i = 1, strlen(_chars) do
charTable[i] = sub(_chars, i, i)
end
for i = 1, getn(charTable) do
numToChar[i - 1] = sub(chars, i, i)
byteToNum[byte(chars, i)] = i - 1
numToChar[i - 1] = sub(_chars, i, i)
byteToNum[byte(_chars, i)] = i - 1
end
charTable = nil
_chars = nil
local A_byte = byte("A")
local Z_byte = byte("Z")
@@ -107,17 +106,17 @@ function LibBase64:Encode(text, maxLineLength, lineEnding)
local a = modf(num, 2^6)
t[getn(t+1)] = numToChar[a]
t[getn(t)+1] = numToChar[a]
t[getn(t+1)] = numToChar[b]
t[getn(t)+1] = numToChar[b]
t[getn(t+1)] = (nilNum >= 2) and "=" or numToChar[c]
t[getn(t)+1] = (nilNum >= 2) and "=" or numToChar[c]
t[getn(t+1)] = (nilNum >= 1) and "=" or numToChar[d]
t[getn(t)+1] = (nilNum >= 1) and "=" or numToChar[d]
currentLength = currentLength + 4
if maxLineLength and modf(currentLength, maxLineLength) == 0 then
t[getn(t+1)] = lineEnding
t[getn(t)+1] = lineEnding
end
end
@@ -154,7 +153,7 @@ function LibBase64:Decode(text)
error(format("Bad argument #1 to `Decode'. Received an invalid char: %q", sub(text, i, i)), 2)
end
t2[getn(t2+1)] = num
t2[getn(t2)+1] = num
end
end
@@ -181,12 +180,12 @@ function LibBase64:Decode(text)
local a = modf(num, 2^8)
t[getn(t+1)] = string.char(a)
t[getn(t)+1] = string.char(a)
if nilNum < 2 then
t[getn(t+1)] = string.char(b)
t[getn(t)+1] = string.char(b)
end
if nilNum < 1 then
t[getn(t+1)] = string.char(c)
t[getn(t)+1] = string.char(c)
end
end
@@ -208,7 +207,7 @@ function LibBase64:IsBase64(text)
error(format("Bad argument #1 to `IsBase64'. Expected %q, got %q", "string", type(text)), 2)
end
if modf(strlen(text), 4 ~= 0) then
if modf(strlen(text), 4) ~= 0 then
return false
end
@@ -1,16 +1,17 @@
local MAJOR, MINOR = "LibElvUIPlugin-1.0", 13
local MAJOR, MINOR = "LibElvUIPlugin-1.0", 18
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end
--Cache global variables
--Lua functions
local pairs, tonumber = pairs, tonumber
local format, strsplit = format, strsplit
local format, gsub, strmatch, strsplit = format, gsub, strmatch, strsplit
--WoW API / Variables
local CreateFrame = CreateFrame;
local GetNumPartyMembers, GetNumRaidMembers = GetNumPartyMembers, GetNumRaidMembers
local CreateFrame = CreateFrame
local GetAddOnMetadata = GetAddOnMetadata
local GetNumPartyMembers, GetNumRaidMembers = GetNumPartyMembers, GetNumRaidMembers
local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance = IsInInstance
local SendAddonMessage = SendAddonMessage
--Global variables that we don't cache, list them here for the mikk's Find Globals script
@@ -21,18 +22,18 @@ lib.index = 0
lib.prefix = "ElvUIPluginVC"
-- MULTI Language Support (Default Language: English)
local MSG_OUTDATED = "Your version of %s is out of date (latest is version %s). You can download the latest version from https://github.com/ElvUI-Vanilla/ElvUI/"
local MSG_OUTDATED = "Your version of %s %s is out of date (latest is version %s). You can download the latest version from https://github.com/ElvUI-Vanilla/ElvUI/"
local HDR_CONFIG = "Plugins"
local HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - Plugins Loaded (|cff2BC226Green|r means you have current version, |cffFF0000Red|r means out of date)"
local HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - Plugins Loaded (Green means you have current version, Red means out of date)"
local INFO_BY = "by"
local INFO_VERSION = "Version:"
local INFO_NEW = "Newest:"
local LIBRARY = "Library"
if GetLocale() == "deDE" then -- German Translation
MSG_OUTDATED = "Deine Version von %s ist veraltet (akutelle Version ist %s). Du kannst die aktuelle Version von https://github.com/ElvUI-Vanilla/ElvUI/ herunterrladen."
MSG_OUTDATED = "Deine Version von %s %s ist veraltet (akutelle Version ist %s). Du kannst die aktuelle Version von https://github.com/ElvUI-Vanilla/ElvUI/ herunterrladen."
HDR_CONFIG = "Plugins"
HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - Plugins geladen (|cff2BC226Grün|r bedeutet du hast die aktuelle Version, |cffFF0000Rot|r bedeutet es ist veraltet)"
HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - Plugins geladen (Grün bedeutet du hast die aktuelle Version, Rot bedeutet es ist veraltet)"
INFO_BY = "von"
INFO_VERSION = "Version:"
INFO_NEW = "Neuste:"
@@ -40,9 +41,9 @@ if GetLocale() == "deDE" then -- German Translation
end
if GetLocale() == "ruRU" then -- Russian Translations
MSG_OUTDATED = "Ваша версия %s устарела (последняя версия %s). Вы можете скачать последнюю версию на https://github.com/ElvUI-Vanilla/ElvUI/"
MSG_OUTDATED = "Ваша версия %s %s устарела (последняя версия %s). Вы можете скачать последнюю версию на https://github.com/ElvUI-Vanilla/ElvUI/"
HDR_CONFIG = "Плагины"
HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - Загруженные плагины (|cff2BC226Зеленый|r означает, что у вас последняя версия, |cffFF0000Красный|r - устаревшая)"
HDR_INFORMATION = "LibElvUIPlugin-1.0.%d - загруженные плагины (зеленый означает, что у вас последняя версия, красный - устаревшая)"
INFO_BY = "от"
INFO_VERSION = "Версия:"
INFO_NEW = "Последняя:"
@@ -72,11 +73,11 @@ function lib:RegisterPlugin(name,callback, isLib)
local loaded = IsAddOnLoaded("ElvUI_Config")
if not lib.vcframe then
local f = CreateFrame('Frame')
--f:RegisterEvent("RAID_ROSTER_UPDATE");
--f:RegisterEvent("PARTY_MEMBERS_CHANGED");
--f:RegisterEvent("CHAT_MSG_ADDON")
--f:SetScript("OnEvent", lib.VersionCheck)
local f = CreateFrame("Frame")
f:RegisterEvent("RAID_ROSTER_UPDATE")
f:RegisterEvent("PARTY_MEMBERS_CHANGED")
f:RegisterEvent("CHAT_MSG_ADDON")
f:SetScript("OnEvent", lib.VersionCheck)
lib.vcframe = f
end
@@ -84,11 +85,11 @@ function lib:RegisterPlugin(name,callback, isLib)
if not lib.ConfigFrame then
local configFrame = CreateFrame("Frame")
configFrame:RegisterEvent("ADDON_LOADED")
configFrame:SetScript("OnEvent", function(self,event,addon)
configFrame:SetScript("OnEvent", function(self, event, addon)
if addon == "ElvUI_Config" then
for _, plugin in pairs(lib.plugins) do
if(plugin.callback) then
plugin.callback()
for _, PlugIn in pairs(lib.plugins) do
if PlugIn.callback then
PlugIn.callback()
end
end
end
@@ -147,79 +148,96 @@ local function SendPluginVersionCheck(self)
end
function lib:VersionCheck(event, prefix, message, channel, sender)
if(not ElvUI[1].global.general.versionCheck) then return; end
if not ElvUI[1].global.general.versionCheck then return end
local E = ElvUI[1]
if event == "CHAT_MSG_ADDON" then
if sender == E.myname or not sender or prefix ~= lib.prefix then return end
if not (prefix == lib.prefix and sender and message and not strmatch(message, "^%s-$")) then return end
if sender == E.myname then return end
if not E["pluginRecievedOutOfDateMessage"] then
local name, version, plugin, Pname
for _, p in pairs({strsplit(";",message)}) do
local name, version = p:match("([%w_]+)=([%d%p]+)")
if lib.plugins[name] then
local plugin = lib.plugins[name]
if plugin.version ~= "BETA" and version ~= nil and tonumber(version) ~= nil and plugin.version ~= nil and tonumber(plugin.version) ~= nil and tonumber(version) > tonumber(plugin.version) then
plugin.old = true
plugin.newversion = tonumber(version)
local Pname = GetAddOnMetadata(plugin.name, "Title")
E:Print(format(MSG_OUTDATED,Pname,plugin.newversion))
E["pluginRecievedOutOfDateMessage"] = true
if not strmatch(p, "^%s-$") then
name, version = strmatch(p, "([%w_]+)=([%d%p]+)")
if lib.plugins[name] then
plugin = lib.plugins[name]
if plugin.version ~= "BETA" and version and tonumber(version) and plugin.version and tonumber(plugin.version) and tonumber(version) > tonumber(plugin.version) then
plugin.old = true
plugin.newversion = tonumber(version)
Pname = GetAddOnMetadata(plugin.name, "Title")
E:Print(format(MSG_OUTDATED, Pname, plugin.version, plugin.newversion))
E["pluginRecievedOutOfDateMessage"] = true
end
end
end
end
end
else
E.SendPluginVersionCheck = E.SendPluginVersionCheck or SendPluginVersionCheck
E["ElvUIPluginSendMSGTimer"] = E:ScheduleTimer("SendPluginVersionCheck", 2)
if not E.SendPluginVersionCheck then
E.SendPluginVersionCheck = SendPluginVersionCheck
end
local numRaid, numParty = GetNumRaidMembers(), GetNumPartyMembers() + 1
local num = numRaid > 0 and numRaid or numParty
if num ~= lib.groupSize then
if num > 1 and ((lib.groupSize and num > lib.groupSize) or not lib.groupSize) then
E["ElvUIPluginSendMSGTimer"] = E:ScheduleTimer("SendPluginVersionCheck", 12)
end
lib.groupSize = num
end
end
end
function lib:GeneratePluginList()
local list = ""
local E = ElvUI[1]
local list, E = "", ElvUI[1]
local author, Pname, color
for _, plugin in pairs(lib.plugins) do
if plugin.name ~= MAJOR then
local author = GetAddOnMetadata(plugin.name, "Author")
local Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name
local color = plugin.old and E:RGBToHex(1,0,0) or E:RGBToHex(0,1,0)
list = list..Pname
author = GetAddOnMetadata(plugin.name, "Author")
Pname = GetAddOnMetadata(plugin.name, "Title") or plugin.name
color = plugin.old and E:RGBToHex(1,0,0) or E:RGBToHex(0,1,0)
list = list .. Pname
if author then
list = list.." ".. INFO_BY .." "..author
list = list .. " ".. INFO_BY .." " .. author
end
list = list..color.." - "..(plugin.isLib and LIBRARY or INFO_VERSION .." "..plugin.version)
list = list .. color .. (plugin.isLib and " " .. LIBRARY or " - " .. INFO_VERSION .. " " .. plugin.version)
if plugin.old then
list = list.." ("..INFO_NEW .." "..plugin.newversion..")"
list = list .. " (" .. INFO_NEW .." " .. plugin.newversion .. ")"
end
list = list.."|r\n"
list = list .. "|r\n"
end
end
return list
end
function lib:SendPluginVersionCheck(message)
local plist = {strsplit(";",message)}
local m = ""
local delay = 1
local E = ElvUI[1]
for _, p in pairs(plist) do
if(getn(m..p..";") < 230) then
m = m..p..";"
else
local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers();
if(numRaid > 0) then
E:Delay(delay, SendAddonMessage(lib.prefix, m, "RAID"))
elseif(numParty > 0) then
E:Delay(delay, SendAddonMessage(lib.prefix, m, "PARTY"))
end
m = p..";"
delay = delay + 1
end
if (not message) or strmatch(message, "^%s-$") then return end
local ChatType
if GetNumRaidMembers() > 1 then
local _, instanceType = IsInInstance()
ChatType = instanceType == "pvp" and "BATTLEGROUND" or "RAID"
elseif GetNumPartyMembers() > 0 then
ChatType = "PARTY"
end
-- Send the last message
local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers();
if(numRaid > 0) then
E:Delay(delay+1, SendAddonMessage(lib.prefix, m, "RAID"))
elseif(numParty > 0) then
E:Delay(delay+1, SendAddonMessage(lib.prefix, m, "PARTY"))
if not ChatType then return end
local maxChar, msgLength = 254 - strlen(lib.prefix), strlen(message)
if msgLength > maxChar then
local delay, splitMessage = 0
for _ = 1, ceil(msgLength/maxChar) do
splitMessage = strmatch(strsub(message, 1, maxChar), ".+;")
if splitMessage then -- incase the string is over `maxChar` but doesnt contain `;`
message = gsub(message, "^"..gsub(splitMessage, '([%-%.%+%[%]%(%)%$%^%%%?%*])','%%%1'), "")
ElvUI[1]:Delay(delay, SendAddonMessage, lib.prefix, splitMessage, ChatType)
delay = delay + 1
end
end
else
SendAddonMessage(lib.prefix, message, ChatType)
end
end
+12 -11
View File
@@ -238,7 +238,7 @@ local function ExportImport_Open(mode)
label2:SetWidth(800)
frame:AddChild(label2)
if(mode == "export") then
if mode == "export" then
frame:SetTitle(L["Export Profile"])
local profileTypeDropdown = AceGUI:Create("Dropdown")
@@ -265,7 +265,7 @@ local function ExportImport_Open(mode)
local profileType, exportFormat = profileTypeDropdown:GetValue(), exportFormatDropdown:GetValue()
local profileKey, profileExport = D:ExportProfile(profileType, exportFormat)
if(not profileKey or not profileExport) then
if not profileKey or not profileExport then
label1:SetText(L["Error exporting profile!"])
else
label1:SetText(format("%s: %s%s|r", L["Exported"], E.media.hexvaluecolor, profileTypeItems[profileType]))
@@ -288,8 +288,9 @@ local function ExportImport_Open(mode)
box.editBox:HighlightText()
end
box.scrollFrame:UpdateScrollChildRect()
print(box.scrollFrame:GetName())
end)
elseif(mode == "import") then
elseif mode == "import" then
frame:SetTitle(L["Import Profile"])
local importButton = AceGUI:Create("Button")
importButton:SetDisabled(true)
@@ -301,7 +302,7 @@ local function ExportImport_Open(mode)
local text
local success = D:ImportProfile(box:GetText())
if(success) then
if success then
text = L["Profile imported successfully!"]
else
text = L["Error decoding data. Import string may be corrupted!"]
@@ -319,7 +320,7 @@ local function ExportImport_Open(mode)
label2:SetText(" ")
local decodedText
local profileType, profileKey, profileData = D:Decode(box:GetText())
if(profileData) then
if profileData then
decodedText = E:TableToLuaString(profileData)
end
local importText = D:CreateProfileExport(decodedText, profileType, profileKey)
@@ -330,14 +331,14 @@ local function ExportImport_Open(mode)
local oldText = ""
local function OnTextChanged()
local text = box:GetText()
if(text == "") then
if text == "" then
label1:SetText(" ")
label2:SetText(" ")
importButton:SetDisabled(true)
decodeButton:SetDisabled(true)
elseif(oldText ~= text) then
elseif oldText ~= text then
local stringType = D:GetImportStringType(text)
if(stringType == "Base64") then
if stringType == "Base64" then
decodeButton:SetDisabled(false)
else
decodeButton:SetDisabled(true)
@@ -351,7 +352,7 @@ local function ExportImport_Open(mode)
decodeButton:SetDisabled(true)
else
label1:SetText(format("%s: %s%s|r", L["Importing"], E.media.hexvaluecolor, profileTypeItems[profileType] or ""))
if(profileType == "profile") then
if profileType == "profile" then
label2:SetText(format("%s: %s%s|r", L["Profile Name"], E.media.hexvaluecolor, profileKey))
end
importButton:SetDisabled(false)
@@ -391,10 +392,10 @@ local function ExportImport_Open(mode)
end
E.Options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(E.data)
AC.RegisterOptionsTable(P, "ElvProfiles", E.Options.args.profiles)
AC.RegisterOptionsTable(E, "ElvProfiles", E.Options.args.profiles)
E.Options.args.profiles.order = -10
if(not E.Options.args.profiles.plugins) then
if not E.Options.args.profiles.plugins then
E.Options.args.profiles.plugins = {}
end