From e03c4b9eb375ea44735235c25b67677061b87ea6 Mon Sep 17 00:00:00 2001 From: Crum Date: Thu, 18 Jan 2018 17:14:26 -0600 Subject: [PATCH] cleanup --- .../libs/LibBabble-Zone-3.0.lua | 1 - 2/3/4/5/6/7/ElvUI/Core/distributor.lua | 345 +++++++++--------- .../AceSerializer-3.0/AceSerializer-3.0.lua | 32 +- 2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua | 2 +- 2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua | 6 +- 2/3/4/5/6/7/ElvUI/Modules/Misc/Misc.lua | 7 +- .../7/ElvUI/Modules/NamePlates/NamePlates.lua | 6 +- .../Modules/Skins/Blizzard/AuctionHouse.lua | 2 +- 2/3/4/5/6/7/ElvUI_Config/Core.lua | 13 +- 9 files changed, 205 insertions(+), 209 deletions(-) diff --git a/2/3/4/5/6/7/!Compatibility/libs/LibBabble-Zone-3.0.lua b/2/3/4/5/6/7/!Compatibility/libs/LibBabble-Zone-3.0.lua index 745fcbb..dca540f 100644 --- a/2/3/4/5/6/7/!Compatibility/libs/LibBabble-Zone-3.0.lua +++ b/2/3/4/5/6/7/!Compatibility/libs/LibBabble-Zone-3.0.lua @@ -8,7 +8,6 @@ License: MIT ]] local MAJOR_VERSION = "LibBabble-Zone-3.0" ---local MINOR_VERSION = 90000 + tonumber(("$Revision: 107 $"):match("%d+")) local MINOR_VERSION = 90000 + tonumber(string.match("$Revision: 107 $", "%d+")) if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end diff --git a/2/3/4/5/6/7/ElvUI/Core/distributor.lua b/2/3/4/5/6/7/ElvUI/Core/distributor.lua index 0395444..4d8ca89 100644 --- a/2/3/4/5/6/7/ElvUI/Core/distributor.lua +++ b/2/3/4/5/6/7/ElvUI/Core/distributor.lua @@ -1,15 +1,17 @@ -local E, L, V, P, G = unpack(ElvUI) -local D = E:NewModule("Distributor", "AceEvent-3.0","AceTimer-3.0","AceComm-3.0","AceSerializer-3.0") +local E, L, V, P, G = unpack(ElvUI) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB +local D = E:NewModule("Distributor", "AceEvent-3.0","AceTimer-3.0","AceComm-3.0","AceSerializer-3.0"); local LibCompress = LibStub:GetLibrary("LibCompress"); local LibBase64 = LibStub("LibBase64-1.0"); -local tonumber, type, pcall, loadstring = tonumber, type, pcall, loadstring; -local len, format, split, find = string.len, string.format, string.split, string.find; - -local CreateFrame = CreateFrame; -local GetNumRaidMembers, UnitInRaid = GetNumRaidMembers, UnitInRaid; -local GetNumPartyMembers, UnitInParty = GetNumPartyMembers, UnitInParty; -local ACCEPT, CANCEL, YES, NO = ACCEPT, CANCEL, YES, NO; +--Cache global variables +--Lua functions +local tonumber, type, pcall, loadstring = tonumber, type, pcall, loadstring +local len, format, split, find = string.len, string.format, string.split, string.find +--WoW API / Variables +local CreateFrame = CreateFrame +local GetNumRaidMembers, UnitInRaid = GetNumRaidMembers, UnitInRaid +local GetNumPartyMembers, UnitInParty = GetNumPartyMembers, UnitInParty +local ACCEPT, CANCEL, YES, NO = ACCEPT, CANCEL, YES, NO ---------------------------------- -- CONSTANTS @@ -29,7 +31,7 @@ function D:Initialize() self:RegisterEvent("CHAT_MSG_ADDON") self.statusBar = CreateFrame("StatusBar", "ElvUI_Download", UIParent) - E:RegisterStatusBar(self.statusBar); + E:RegisterStatusBar(self.statusBar) E:CreateBackdrop(self.statusBar, "Default") self.statusBar:SetStatusBarTexture(E.media.normTex) self.statusBar:SetStatusBarColor(0.95, 0.15, 0.15) @@ -43,7 +45,7 @@ end -- Used to start uploads function D:Distribute(target, otherServer, isGlobal) - local profileKey, data; + local profileKey, data if not isGlobal then if ElvDB.profileKeys then profileKey = ElvDB.profileKeys[E.myname.." - "..E.myrealm] @@ -67,11 +69,11 @@ function D:Distribute(target, otherServer, isGlobal) } if otherServer then - local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers(); - if(numRaid > 0 and UnitInRaid("target")) then - self:SendCommMessage(REQUEST_PREFIX, message, "RAID"); - elseif(numParty > 0 and UnitInParty("target")) then - self:SendCommMessage(REQUEST_PREFIX, message, "PARTY"); + local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers() + if numRaid > 0 and UnitInRaid("target") then + self:SendCommMessage(REQUEST_PREFIX, message, "RAID") + elseif numParty > 0 and UnitInParty("target") then + self:SendCommMessage(REQUEST_PREFIX, message, "PARTY") else E:Print(L["Must be in group with the player if he isn't on the same server as you."]) return @@ -234,240 +236,241 @@ function D:OnCommReceived(prefix, msg, dist, sender) end local function GetProfileData(profileType) - if(not profileType or type(profileType) ~= "string") then - E:Print("Bad argument #1 to 'GetProfileData' (string expected)"); - return; + if not profileType or type(profileType) ~= "string" then + E:Print("Bad argument #1 to 'GetProfileData' (string expected)") + return end - local profileKey; - local profileData = {}; + local profileKey + local profileData = {} - if(profileType == "profile") then - if(ElvDB.profileKeys) then - profileKey = ElvDB.profileKeys[E.myname.." - "..E.myrealm]; + if profileType == "profile" then + if ElvDB.profileKeys then + profileKey = ElvDB.profileKeys[E.myname.." - "..E.myrealm] end profileData = E:CopyTable(profileData , ElvDB.profiles[profileKey]) - profileData = E:RemoveTableDuplicates(profileData, P); - elseif(profileType == "private") then - local privateProfileKey = E.myname.." - "..E.myrealm; - profileKey = "private"; + profileData = E:RemoveTableDuplicates(profileData, P) + elseif profileType == "private" then + local privateProfileKey = E.myname.." - "..E.myrealm + profileKey = "private" - profileData = E:CopyTable(profileData, ElvPrivateDB.profiles[privateProfileKey]); - profileData = E:RemoveTableDuplicates(profileData, V); - elseif(profileType == "global") then - profileKey = "global"; + profileData = E:CopyTable(profileData, ElvPrivateDB.profiles[privateProfileKey]) + profileData = E:RemoveTableDuplicates(profileData, V) + elseif profileType == "global" then + profileKey = "global" - profileData = E:CopyTable(profileData, ElvDB.global); - profileData = E:RemoveTableDuplicates(profileData, G); - elseif(profileType == "filtersNP") then - profileKey = "filtersNP"; + profileData = E:CopyTable(profileData, ElvDB.global) + profileData = E:RemoveTableDuplicates(profileData, G) + elseif profileType == "filtersNP" then + profileKey = "filtersNP" - profileData["nameplates"] = {}; - profileData["nameplates"]["filter"] = {}; - profileData["nameplates"]["filter"] = E:CopyTable(profileData["nameplates"]["filter"], ElvDB.global.nameplates.filter); - profileData = E:RemoveTableDuplicates(profileData, G); - elseif(profileType == "filtersUF") then - profileKey = "filtersUF"; + profileData["nameplates"] = {} + profileData["nameplates"]["filter"] = {} + profileData["nameplates"]["filter"] = E:CopyTable(profileData["nameplates"]["filter"], ElvDB.global.nameplates.filter) + profileData = E:RemoveTableDuplicates(profileData, G) + elseif profileType == "filtersUF" then + profileKey = "filtersUF" - profileData["unitframe"] = {}; - profileData["unitframe"]["aurafilters"] = {}; - profileData["unitframe"]["aurafilters"] = E:CopyTable(profileData["unitframe"]["aurafilters"], ElvDB.global.unitframe.aurafilters); - profileData["unitframe"]["buffwatch"] = {}; - profileData["unitframe"]["buffwatch"] = E:CopyTable(profileData["unitframe"]["buffwatch"], ElvDB.global.unitframe.buffwatch); - profileData = E:RemoveTableDuplicates(profileData, G); - elseif(profileType == "filtersAll") then - profileKey = "filtersAll"; + profileData["unitframe"] = {} + profileData["unitframe"]["aurafilters"] = {} + profileData["unitframe"]["aurafilters"] = E:CopyTable(profileData["unitframe"]["aurafilters"], ElvDB.global.unitframe.aurafilters) + profileData["unitframe"]["buffwatch"] = {} + profileData["unitframe"]["buffwatch"] = E:CopyTable(profileData["unitframe"]["buffwatch"], ElvDB.global.unitframe.buffwatch) + profileData = E:RemoveTableDuplicates(profileData, G) + elseif profileType == "filtersAll" then + profileKey = "filtersAll" - profileData["nameplates"] = {}; - profileData["nameplates"]["filter"] = {}; - profileData["nameplates"]["filter"] = E:CopyTable(profileData["nameplates"]["filter"], ElvDB.global.nameplates.filter); - profileData["unitframe"] = {}; - profileData["unitframe"]["aurafilters"] = {}; - profileData["unitframe"]["aurafilters"] = E:CopyTable(profileData["unitframe"]["aurafilters"], ElvDB.global.unitframe.aurafilters); - profileData["unitframe"]["buffwatch"] = {}; - profileData["unitframe"]["buffwatch"] = E:CopyTable(profileData["unitframe"]["buffwatch"], ElvDB.global.unitframe.buffwatch); - profileData = E:RemoveTableDuplicates(profileData, G); + profileData["nameplates"] = {} + profileData["nameplates"]["filter"] = {} + profileData["nameplates"]["filter"] = E:CopyTable(profileData["nameplates"]["filter"], ElvDB.global.nameplates.filter) + profileData["unitframe"] = {} + profileData["unitframe"]["aurafilters"] = {} + profileData["unitframe"]["aurafilters"] = E:CopyTable(profileData["unitframe"]["aurafilters"], ElvDB.global.unitframe.aurafilters) + profileData["unitframe"]["buffwatch"] = {} + profileData["unitframe"]["buffwatch"] = E:CopyTable(profileData["unitframe"]["buffwatch"], ElvDB.global.unitframe.buffwatch) + profileData = E:RemoveTableDuplicates(profileData, G) end - return profileKey, profileData; + return profileKey, profileData end local function GetProfileExport(profileType, exportFormat) - local profileExport, exportString; - local profileKey, profileData = GetProfileData(profileType); + local profileExport, exportString + local profileKey, profileData = GetProfileData(profileType) - if(not profileKey or not profileData or (profileData and type(profileData) ~= "table")) then - E:Print("Error getting data from 'GetProfileData'"); - return; + if not profileKey or not profileData or (profileData and type(profileData) ~= "table") then + E:Print("Error getting data from 'GetProfileData'") + return end - if(exportFormat == "text") then - local serialData = D:Serialize(profileData); + if exportFormat == "text" then + local serialData = D:Serialize(profileData) - exportString = D:CreateProfileExport(serialData, profileType, profileKey); + exportString = D:CreateProfileExport(serialData, profileType, profileKey) - local compressedData = LibCompress:Compress(exportString); - local encodedData = LibBase64:Encode(compressedData); - profileExport = encodedData; - elseif(exportFormat == "luaTable") then - exportString = E:TableToLuaString(profileData); - profileExport = D:CreateProfileExport(exportString, profileType, profileKey); - elseif(exportFormat == "luaPlugin") then - profileExport = E:ProfileTableToPluginFormat(profileData, profileType); + local compressedData = LibCompress:Compress(exportString) + local encodedData = LibBase64:Encode(compressedData) + profileExport = encodedData + elseif exportFormat == "luaTable" then + exportString = E:TableToLuaString(profileData) + profileExport = D:CreateProfileExport(exportString, profileType, profileKey) + elseif exportFormat == "luaPlugin" then + profileExport = E:ProfileTableToPluginFormat(profileData, profileType) end - return profileKey, profileExport; + return profileKey, profileExport end function D:CreateProfileExport(dataString, profileType, profileKey) - local returnString; + local returnString - if(profileType == "profile") then - returnString = format("%s::%s::%s", dataString, profileType, profileKey); + if profileType == "profile" then + returnString = format("%s::%s::%s", dataString, profileType, profileKey) else - returnString = format("%s::%s", dataString, profileType); + returnString = format("%s::%s", dataString, profileType) end - return returnString; + return returnString end function D:GetImportStringType(dataString) - local stringType = ""; + local stringType = "" - if(LibBase64:IsBase64(dataString)) then - stringType = "Base64"; - elseif(find(dataString, "{")) then - stringType = "Table"; + if LibBase64:IsBase64(dataString) then + stringType = "Base64" + elseif find(dataString, "{") then + stringType = "Table" end - return stringType; + return stringType end function D:Decode(dataString) - local profileInfo, profileType, profileKey, profileData, message; - local stringType = self:GetImportStringType(dataString); + local profileInfo, profileType, profileKey, profileData, message + local stringType = self:GetImportStringType(dataString) - if(stringType == "Base64") then - local decodedData = LibBase64:Decode(dataString); - local decompressedData, message = LibCompress:Decompress(decodedData); + if stringType == "Base64" then + local decodedData = LibBase64:Decode(dataString) + local decompressedData, message = LibCompress:Decompress(decodedData) - if(not decompressedData) then - E:Print("Error decompressing data:", message); - return; + if not decompressedData then + E:Print("Error decompressing data:", message) + return end - local serializedData, success; - serializedData, profileInfo = E:StringSplitMultiDelim(decompressedData, "^^::"); + local serializedData, success + serializedData, profileInfo = E:StringSplitMultiDelim(decompressedData, "^^::") if not profileInfo then E:Print("Error importing profile. String is invalid or corrupted!") return end - serializedData = format("%s%s", serializedData, "^^"); - profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::"); - success, profileData = D:Deserialize(serializedData); + serializedData = format("%s%s", serializedData, "^^") + profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::") + success, profileData = D:Deserialize(serializedData) - if(not success) then - E:Print("Error deserializing:", profileData); - return; + if not success then + E:Print("Error deserializing:", profileData) + return end - elseif(stringType == "Table") then - local profileDataAsString; - profileDataAsString, profileInfo = E:StringSplitMultiDelim(dataString, "}::"); + elseif stringType == "Table" then + local profileDataAsString + profileDataAsString, profileInfo = E:StringSplitMultiDelim(dataString, "}::") if not profileInfo then E:Print("Error extracting profile info. Invalid import string!") return end - if(not profileDataAsString) then - E:Print("Error extracting profile data. Invalid import string!"); - return; + if not profileDataAsString then + E:Print("Error extracting profile data. Invalid import string!") + return end - profileDataAsString = format("%s%s", profileDataAsString, "}"); - profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::"); + profileDataAsString = format("%s%s", profileDataAsString, "}") + profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::") - local profileToTable = loadstring(format("%s %s", "return", profileDataAsString)); - if(profileToTable) then - message, profileData = pcall(profileToTable); + local profileToTable = loadstring(format("%s %s", "return", profileDataAsString)) + if profileToTable then + message, profileData = pcall(profileToTable) end - if(not profileData or type(profileData) ~= "table") then - E:Print("Error converting lua string to table:", message); - return; + if not profileData or type(profileData) ~= "table" then + E:Print("Error converting lua string to table:", message) + return end end - return profileType, profileKey, profileData; + return profileType, profileKey, profileData end local function SetImportedProfile(profileType, profileKey, profileData, force) - D.profileType = nil; - D.profileKey = nil; - D.profileData = nil; + D.profileType = nil + D.profileKey = nil + D.profileData = nil - if(profileType == "profile") then - if(not ElvDB.profiles[profileKey] or force) then - if(force and E.data.keys.profile == profileKey) then - local tempKey = profileKey.."_Temp"; - E.data.keys.profile = tempKey; + if profileType == "profile" then + if not ElvDB.profiles[profileKey] or force then + if force and E.data.keys.profile == profileKey then + local tempKey = profileKey.."_Temp" + E.data.keys.profile = tempKey end - ElvDB.profiles[profileKey] = profileData; - E.data:SetProfile(profileKey); + ElvDB.profiles[profileKey] = profileData + E.data:SetProfile(profileKey) else - D.profileType = profileType; - D.profileKey = profileKey; - D.profileData = profileData; - E:StaticPopup_Show("IMPORT_PROFILE_EXISTS"); + D.profileType = profileType + D.profileKey = profileKey + D.profileData = profileData + E:StaticPopup_Show("IMPORT_PROFILE_EXISTS") - return; + return end - elseif(profileType == "private") then - local profileKey = ElvPrivateDB.profileKeys[E.myname.." - "..E.myrealm]; - ElvPrivateDB.profiles[profileKey] = profileData; - E:StaticPopup_Show("IMPORT_RL"); + elseif profileType == "private" then + local profileKey = ElvPrivateDB.profileKeys[E.myname.." - "..E.myrealm] + ElvPrivateDB.profiles[profileKey] = profileData + E:StaticPopup_Show("IMPORT_RL") - elseif(profileType == "global") then - E:CopyTable(ElvDB.global, profileData); - E:StaticPopup_Show("IMPORT_RL"); - elseif(profileType == "filtersNP") then - E:CopyTable(ElvDB.global.nameplates, profileData.nameplates); - elseif(profileType == "filtersUF") then - E:CopyTable(ElvDB.global.unitframe, profileData.unitframe); - elseif(profileType == "filtersAll") then - E:CopyTable(ElvDB.global.nameplates, profileData.nameplates); - E:CopyTable(ElvDB.global.unitframe, profileData.unitframe); + elseif profileType == "global" then + E:CopyTable(ElvDB.global, profileData) + E:StaticPopup_Show("IMPORT_RL") + elseif profileType == "filtersNP" then + E:CopyTable(ElvDB.global.nameplates, profileData.nameplates) + elseif profileType == "filtersUF" then + E:CopyTable(ElvDB.global.unitframe, profileData.unitframe) + elseif profileType == "filtersAll" then + E:CopyTable(ElvDB.global.nameplates, profileData.nameplates) + E:CopyTable(ElvDB.global.unitframe, profileData.unitframe) end - E:UpdateAll(true); + E:UpdateAll(true) end function D:ExportProfile(profileType, exportFormat) - if(not profileType or not exportFormat) then - E:Print("Bad argument to 'ExportProfile' (string expected)"); - return; + if not profileType or not exportFormat then + E:Print("Bad argument to 'ExportProfile' (string expected)") + return end - local profileKey, profileExport = GetProfileExport(profileType, exportFormat); - return profileKey, profileExport; + local profileKey, profileExport = GetProfileExport(profileType, exportFormat) + return profileKey, profileExport end function D:ImportProfile(dataString) - local profileType, profileKey, profileData = self:Decode(dataString); + print(self) + local profileType, profileKey, profileData = self:Decode(dataString) - if(not profileData or type(profileData) ~= "table") then - E:Print("Error: something went wrong when converting string to table!"); - return; + if not profileData or type(profileData) ~= "table" then + E:Print("Error: something went wrong when converting string to table!") + return end - if(profileType and ((profileType == "profile" and profileKey) or profileType ~= "profile")) then - SetImportedProfile(profileType, profileKey, profileData); + if profileType and ((profileType == "profile" and profileKey) or profileType ~= "profile") then + SetImportedProfile(profileType, profileKey, profileData) end - return true; + return true end E.PopupDialogs["DISTRIBUTOR_SUCCESS"] = { @@ -509,24 +512,24 @@ E.PopupDialogs["IMPORT_PROFILE_EXISTS"] = { editBoxWidth = 350, maxLetters = 127, OnAccept = function(self) - local profileType = D.profileType; - local profileKey = self.editBox:GetText(); - local profileData = D.profileData; - SetImportedProfile(profileType, profileKey, profileData, true); + local profileType = D.profileType + local profileKey = self.editBox:GetText() + local profileData = D.profileData + SetImportedProfile(profileType, profileKey, profileData, true) end, EditBoxOnTextChanged = function(self) - if(self:GetText() == "") then - self:GetParent().button1:Disable(); + if self:GetText() == "" then + self:GetParent().button1:Disable() else - self:GetParent().button1:Enable(); + self:GetParent().button1:Enable() end end, - OnShow = function() this.editBox:SetText(D.profileKey); this.editBox:SetFocus(); end, + OnShow = function() this.editBox:SetText(D.profileKey) this.editBox:SetFocus() end, timeout = 0, whileDead = 1, hideOnEscape = true, preferredIndex = 3 -}; +} E.PopupDialogs["IMPORT_RL"] = { text = L["You have imported settings which may require a UI reload to take effect. Reload now?"], @@ -537,7 +540,7 @@ E.PopupDialogs["IMPORT_RL"] = { whileDead = 1, hideOnEscape = false, preferredIndex = 3 -}; +} local function InitializeCallback() D:Initialize() diff --git a/2/3/4/5/6/7/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua b/2/3/4/5/6/7/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua index 75ecd0c..75430bb 100644 --- a/2/3/4/5/6/7/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua +++ b/2/3/4/5/6/7/ElvUI/Libraries/AceSerializer-3.0/AceSerializer-3.0.lua @@ -1,9 +1,9 @@ --- **AceSerializer-3.0** can serialize any variable (except functions or userdata) into a string format, --- that can be send over the addon comm channel. AceSerializer was designed to keep all data intact, especially +-- that can be send over the addon comm channel. AceSerializer was designed to keep all data intact, especially -- very large numbers or floating point numbers, and table structures. The only caveat currently is, that multiple -- references to the same table will be send individually. -- --- **AceSerializer-3.0** can be embeded into your addon, either explicitly by calling AceSerializer:Embed(MyAddon) or by +-- **AceSerializer-3.0** can be embeded into your addon, either explicitly by calling AceSerializer:Embed(MyAddon) or by -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object -- and can be accessed directly, without having to explicitly call AceSerializer itself.\\ -- It is recommended to embed AceSerializer, otherwise you'll have to specify a custom `self` on all calls you @@ -40,7 +40,7 @@ local function SerializeStringHelper(ch) -- Used by SerializeValue for strings return "\126\122" elseif n<=32 then -- nonprint + space return "\126"..strchar(n+64) - elseif n==94 then -- value separator + elseif n==94 then -- value separator return "\126\125" elseif n==126 then -- our own escape character return "\126\124" @@ -54,12 +54,12 @@ end local function SerializeValue(v, res, nres) -- We use "^" as a value separator, followed by one byte for type indicator local t=type(v) - + if t=="string" then -- ^S = string (escaped to remove nonprints, "^"s, etc) res[nres+1] = "^S" res[nres+2] = gsub(v,"[%c \94\126\127]", SerializeStringHelper) nres=nres+2 - + elseif t=="number" then -- ^N = number (just tostring()ed) or ^F (float components) local str = tostring(v) if tonumber(str)==v --[[not in 4.3 or str==serNaN]] then @@ -79,7 +79,7 @@ local function SerializeValue(v, res, nres) res[nres+4] = tostring(e-53) -- adjust exponent to counteract mantissa manipulation nres=nres+4 end - + elseif t=="table" then -- ^T...^t = table (list of key,value pairs) nres=nres+1 res[nres] = "^T" @@ -89,7 +89,7 @@ local function SerializeValue(v, res, nres) end nres=nres+1 res[nres] = "^t" - + elseif t=="boolean" then -- ^B = true, ^b = false nres=nres+1 if v then @@ -97,15 +97,15 @@ local function SerializeValue(v, res, nres) else res[nres] = "^b" -- false end - + elseif t=="nil" then -- ^Z = nil (zero, "N" was taken :P) nres=nres+1 res[nres] = "^Z" - + else error(MAJOR..": Cannot serialize a value of type '"..t.."'") -- can't produce error on right level, this is wildly recursive end - + return nres end @@ -127,7 +127,7 @@ function AceSerializer:Serialize(...) end serializeTbl[nres+1] = "^^" -- "^^" = End of serialized data - + return tconcat(serializeTbl, "", 1, nres+1) end @@ -174,9 +174,9 @@ local function DeserializeValue(iter,single,ctl,data) ctl,data = iter() end - if not ctl then + if not ctl then error("Supplied data misses AceSerializer terminator ('^^')") - end + end if ctl=="^^" then -- ignore extraneous data @@ -184,7 +184,7 @@ local function DeserializeValue(iter,single,ctl,data) end local res - + if ctl=="^S" then res = gsub(data, "~.", DeserializeStringHelper) elseif ctl=="^N" then @@ -217,7 +217,7 @@ local function DeserializeValue(iter,single,ctl,data) ctl,data = iter() if ctl=="^t" then break end -- ignore ^t's data k = DeserializeValue(iter,true,ctl,data) - if k==nil then + if k==nil then error("Invalid AceSerializer table format (no table end marker)") end ctl,data = iter() @@ -230,7 +230,7 @@ local function DeserializeValue(iter,single,ctl,data) else error("Invalid AceSerializer control code '"..ctl.."'") end - + if not single then return res,DeserializeValue(iter) else diff --git a/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua b/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua index 93cde41..d84b076 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Bags/Bags.lua @@ -723,7 +723,7 @@ function B:VendorGrays(delete, _, getValue) for s = 1, GetContainerNumSlots(b) do local l = GetContainerItemLink(b, s) if l and find(l,"ff9d9d9d") then - local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s)) + -- local p = LIP:GetSellValue(l) * select(2, GetContainerItemInfo(b, s)) if delete then if find(l,"ff9d9d9d") then diff --git a/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua b/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua index 19313b2..50d9aeb 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Chat/Chat.lua @@ -694,7 +694,7 @@ end local hyperLinkEntered function CH:OnHyperlinkEnter() - local linkToken = match(arg1, "(%a+):(%d+)") + local linkToken = match(arg1, "([^:]+)") if hyperlinkTypes[linkToken] then ShowUIPanel(GameTooltip) GameTooltip:SetOwner(this, "ANCHOR_CURSOR") @@ -705,7 +705,7 @@ function CH:OnHyperlinkEnter() end function CH:OnHyperlinkLeave() - local linkToken = match(arg1, "(%a+):(%d+)") + local linkToken = match(arg1, "([^:]+)") if hyperlinkTypes[linkToken] then HideUIPanel(GameTooltip) hyperLinkEntered = nil @@ -1708,7 +1708,7 @@ function CH:Initialize() end local S = E:GetModule("Skins") - --S:HandleNextPrevButton(CombatLogQuickButtonFrame_CustomAdditionalFilterButton, true) + local frame = CreateFrame("Frame", "CopyChatFrame", E.UIParent) tinsert(UISpecialFrames, "CopyChatFrame") E:SetTemplate(frame, "Transparent") diff --git a/2/3/4/5/6/7/ElvUI/Modules/Misc/Misc.lua b/2/3/4/5/6/7/ElvUI/Modules/Misc/Misc.lua index e3bcbcd..7b60adf 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Misc/Misc.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Misc/Misc.lua @@ -6,10 +6,8 @@ E.Misc = M --Lua functions local format, gsub = string.format, string.gsub --WoW API / Variables -local CanGuildBankRepair = CanGuildBankRepair local CanMerchantRepair = CanMerchantRepair local GetFriendInfo = GetFriendInfo -local GetGuildBankWithdrawMoney = GetGuildBankWithdrawMoney local GetGuildRosterInfo = GetGuildRosterInfo local GetNumFriends = GetNumFriends local GetNumGuildMembers = GetNumGuildMembers @@ -18,7 +16,6 @@ local GetNumRaidMembers = GetNumRaidMembers local GetPartyMember = GetPartyMember local GetRepairAllCost = GetRepairAllCost local GuildRoster = GuildRoster -local InCombatLockdown = InCombatLockdown local IsInGuild = IsInGuild local IsInInstance = IsInInstance local IsShiftKeyDown = IsShiftKeyDown @@ -97,8 +94,6 @@ function M:MERCHANT_SHOW() end function M:DisbandRaidGroup() - if InCombatLockdown() then return end -- Prevent user error in combat - if UnitInRaid("player") then for i = 1, GetNumRaidMembers() do local name, _, _, _, _, _, _, online = GetRaidRosterInfo(i) @@ -182,7 +177,7 @@ function M:Initialize() self:RegisterEvent("MERCHANT_SHOW") self:RegisterEvent("PLAYER_REGEN_DISABLED", "ErrorFrameToggle") self:RegisterEvent("PLAYER_REGEN_ENABLED", "ErrorFrameToggle") - self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + -- self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE", "PVPMessageEnhancement") self:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE", "PVPMessageEnhancement") self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL", "PVPMessageEnhancement") diff --git a/2/3/4/5/6/7/ElvUI/Modules/NamePlates/NamePlates.lua b/2/3/4/5/6/7/ElvUI/Modules/NamePlates/NamePlates.lua index bd920ed..19a83eb 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/NamePlates/NamePlates.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/NamePlates/NamePlates.lua @@ -5,7 +5,7 @@ local mod = E:NewModule("NamePlates", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3 local _G = _G local pairs, tonumber = pairs, tonumber local select = select -local gsub, split = string.gsub, string.split +local gsub, match, split = string.gsub, string.match, string.split local twipe = table.wipe local CreateFrame = CreateFrame @@ -82,7 +82,7 @@ function mod:CheckBGHealers() for i = 1, GetNumBattlefieldScores() do name, _, _, _, _, _, _, _, _, class, damageDone, healingDone = GetBattlefieldScore(i) if name and class and healClasses[class] then - name = name:match("(.+)%-.+") or name + name = match(name, "(.+)%-.+") or name if name and healingDone > (damageDone * 2) then self.Healers[name] = true elseif name and self.Healers[name] then @@ -712,7 +712,7 @@ end if queryList[name] then local frame = queryList[name] - if frame.UnitType then + if frame.UnitType then if frame.UnitType == "ENEMY_NPC" then frame.UnitType = "ENEMY_PLAYER" end diff --git a/2/3/4/5/6/7/ElvUI/Modules/Skins/Blizzard/AuctionHouse.lua b/2/3/4/5/6/7/ElvUI/Modules/Skins/Blizzard/AuctionHouse.lua index 89ea8a2..c2fc49b 100644 --- a/2/3/4/5/6/7/ElvUI/Modules/Skins/Blizzard/AuctionHouse.lua +++ b/2/3/4/5/6/7/ElvUI/Modules/Skins/Blizzard/AuctionHouse.lua @@ -223,7 +223,7 @@ local function LoadSkin() end E:StripTextures(button) - E:StyleButton(button, false ,true) + E:StyleButton(button, false, true) _G["BrowseButton"..i.."Highlight"] = button:GetHighlightTexture() button:GetHighlightTexture():ClearAllPoints() button:GetHighlightTexture():SetPoint("TOPLEFT", icon, "TOPRIGHT", 2, 0) diff --git a/2/3/4/5/6/7/ElvUI_Config/Core.lua b/2/3/4/5/6/7/ElvUI_Config/Core.lua index 8cde19c..5610249 100644 --- a/2/3/4/5/6/7/ElvUI_Config/Core.lua +++ b/2/3/4/5/6/7/ElvUI_Config/Core.lua @@ -288,7 +288,6 @@ local function ExportImport_Open(mode) box.editBox:HighlightText() end box.scrollFrame:UpdateScrollChildRect() - print(box.scrollFrame:GetName()) end) elseif mode == "import" then frame:SetTitle(L["Import Profile"]) @@ -416,14 +415,14 @@ E.Options.args.profiles.plugins["ElvUI"] = { desc = L["Sends your current profile to your target."], type = "execute", func = function() - if(not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target")) then + if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName("target") - if(name and (not server or server == "")) then + if name and not server or server == "" then D:Distribute(name) - elseif(server) then + elseif server then D:Distribute(name, true) end end @@ -434,14 +433,14 @@ E.Options.args.profiles.plugins["ElvUI"] = { name = L["Share Filters"], desc = L["Sends your filter settings to your target."], func = function() - if(not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target")) then + if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then E:Print(L["You must be targeting a player."]) return end local name, server = UnitName("target") - if(name and (not server or server == "")) then + if name and not server or server == "" then D:Distribute(name, false, true) - elseif(server) then + elseif server then D:Distribute(name, true, true) end end,