Quantcast

Replace some functions that will be removed soon™

Darth Predator [04-11-17 - 16:22]
Replace some functions that will be removed soon™
Filename
ElvUI_SLE/core/toolkit.lua
ElvUI_SLE/modules/bags/baginfo.lua
ElvUI_SLE/modules/equipmanager.lua
ElvUI_SLE/options/equipmanager_c.lua
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