From 5ac28a071d69d11e9a4415f829c62043a7729657 Mon Sep 17 00:00:00 2001 From: Darth Predator Date: Tue, 11 Apr 2017 19:22:18 +0300 Subject: [PATCH] =?UTF-8?q?Replace=20some=20functions=20that=20will=20be=20r?= =?UTF-8?q?emoved=20soon=E2=84=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElvUI_SLE/core/toolkit.lua | 5 ----- ElvUI_SLE/modules/bags/baginfo.lua | 11 +++++++---- ElvUI_SLE/modules/equipmanager.lua | 24 +++++++++++++++--------- ElvUI_SLE/options/equipmanager_c.lua | 9 ++++++--- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua index 30eb6a5..78596b4 100644 --- a/ElvUI_SLE/core/toolkit.lua +++ b/ElvUI_SLE/core/toolkit.lua @@ -205,11 +205,6 @@ T.BNGetGameAccountInfo = BNGetGameAccountInfo --6.2.4 T.BNGetFriendIndex = BNGetFriendIndex T.GetFriendInfo = GetFriendInfo T.GetNumFriends = GetNumFriends ---Equip -T.UseEquipmentSet = UseEquipmentSet -T.GetEquipmentSetInfo = GetEquipmentSetInfo -T.GetNumEquipmentSets = GetNumEquipmentSets -T.GetEquipmentSetLocations = GetEquipmentSetLocations --Quests T.GetQuestLogTitle = GetQuestLogTitle T.GetNumQuestLogEntries = GetNumQuestLogEntries diff --git a/ElvUI_SLE/modules/bags/baginfo.lua b/ElvUI_SLE/modules/bags/baginfo.lua index c422f22..a9be0b5 100644 --- a/ElvUI_SLE/modules/bags/baginfo.lua +++ b/ElvUI_SLE/modules/bags/baginfo.lua @@ -9,6 +9,7 @@ BI.containers = {} BI.infoArray = {} BI.equipmentMap = {} local EquipmentManager_UnpackLocation = EquipmentManager_UnpackLocation +local C_EquipmentSet = C_EquipmentSet local function Utf8Sub(str, start, numChars) local currentIndex = start @@ -51,11 +52,13 @@ local function BuildEquipmentMap(clear) if clear then return end local name, player, bank, bags, slot, bag, key + local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs() - for i = 1, T.GetNumEquipmentSets() do - name = T.GetEquipmentSetInfo(i) - T.GetEquipmentSetLocations(name, BI.infoArray) - for _, location in T.pairs(BI.infoArray) do + for index = 1, C_EquipmentSet.GetNumEquipmentSets() do + name = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]); + local equipmentSetID = C_EquipmentSet.GetEquipmentSetID(name) + local SetInfoTable = C_EquipmentSet.GetItemLocations(equipmentSetID) + for _, location in T.pairs(SetInfoTable) do if T.type(location) == "number" and (location < -1 or location > 1) then player, bank, bags, _, slot, bag = EquipmentManager_UnpackLocation(location) if ((bank or bags) and slot and bag) then diff --git a/ElvUI_SLE/modules/equipmanager.lua b/ElvUI_SLE/modules/equipmanager.lua index fcfe21d..1742ca7 100644 --- a/ElvUI_SLE/modules/equipmanager.lua +++ b/ElvUI_SLE/modules/equipmanager.lua @@ -4,6 +4,10 @@ local GetRealZoneText = GetRealZoneText EM.Processing = false EM.ErrorShown = false +--GLOBALS: CreateFrame, CharacterFrame, SLASH_FISH1, SlashCmdList +local C_EquipmentSet = C_EquipmentSet +local _G = _G + local SpecTable = { [1] = "firstSpec", [2] = "secondSpec", @@ -14,8 +18,9 @@ local SpecTable = { function EM:GetData() local spec = T.GetSpecialization() local equipSet - for i = 1, T.GetNumEquipmentSets() do - local name, _, _, isEquipped = T.GetEquipmentSetInfo(i) + local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs() + for index = 1, C_EquipmentSet.GetNumEquipmentSets() do + local name, _, _, isEquipped = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]); if isEquipped then equipSet = name break @@ -36,7 +41,7 @@ end local TIMEWALKING_DIFFICULTYID = 24; function EM:IsTimewalkingDungeon(inInstance, instanceType) - if inInstance and (instanceType == "scenario" or instanceType == "party" or instanceType == "raid") and select(3, GetInstanceInfo()) == TIMEWALKING_DIFFICULTYID then + if inInstance and (instanceType == "scenario" or instanceType == "party" or instanceType == "raid") and T.select(3, T.GetInstanceInfo()) == TIMEWALKING_DIFFICULTYID then return true end return false @@ -115,7 +120,8 @@ local function Equip(event) if spec ~= nil then --In case you don't have spec local isWrong, trueSet = EM:WrongSet(equipSet, SpecTable[spec], inCombat) if isWrong and not T.UnitInVehicle("player") then - T.UseEquipmentSet(trueSet) + local SetID = C_EquipmentSet.GetEquipmentSetID(trueSet); + C_EquipmentSet.UseEquipmentSet(SetID) end end end @@ -125,14 +131,14 @@ function EM:CreateLock() local button = CreateFrame("Button", "SLE_Equip_Lock_Button", CharacterFrame) button:Size(20, 20) button:Point("BOTTOMLEFT", _G["CharacterFrame"], "BOTTOMLEFT", 4, 4) - button:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 2) + button:SetFrameLevel(_G["CharacterModelFrame"]:GetFrameLevel() + 2) button:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self) - GameTooltip:AddLine(L["SLE_EM_LOCK_TOOLTIP"]) - GameTooltip:Show() + _G["GameTooltip"]:SetOwner(self) + _G["GameTooltip"]:AddLine(L["SLE_EM_LOCK_TOOLTIP"]) + _G["GameTooltip"]:Show() end) button:SetScript("OnLeave", function(self) - GameTooltip:Hide() + _G["GameTooltip"]:Hide() end) E:GetModule("Skins"):HandleButton(button) diff --git a/ElvUI_SLE/options/equipmanager_c.lua b/ElvUI_SLE/options/equipmanager_c.lua index 5f6cc85..78de361 100644 --- a/ElvUI_SLE/options/equipmanager_c.lua +++ b/ElvUI_SLE/options/equipmanager_c.lua @@ -10,12 +10,15 @@ local GENERAL = GENERAL local TIMEWALKING = L["Timewalking"] local sets = {} +local C_EquipmentSet = C_EquipmentSet local function FillTable() - sets = {} + + T.twipe(sets) sets["NONE"] = NONE - for i = 1, T.GetNumEquipmentSets() do - local name, icon, lessIndex = T.GetEquipmentSetInfo(i) + local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs() + for index = 1, C_EquipmentSet.GetNumEquipmentSets() do + local name, icon, lessIndex = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]) if name then sets[name] = name end -- 1.7.9.5