diff --git a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua index 5244839..1918c6c 100644 --- a/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua +++ b/ElvUI_SLE/modules/Armory/CharacterArmory/CharacterArmory.lua @@ -1,33 +1,56 @@ if select(2, GetAddOnInfo('ElvUI_KnightFrame')) and IsAddOnLoaded('ElvUI_KnightFrame') then return end -local E, L, V, P, G = unpack(ElvUI) +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) local KF, Info, Timer = unpack(ElvUI_KnightFrame) +--GLOBALS: CreateFrame, UIParent, SLE_ArmoryDB, hooksecurefunc local _G = _G +local _ +local IsShiftKeyDown = IsShiftKeyDown +local SetItemRef = SetItemRef +local GetCursorInfo, CursorHasItem = GetCursorInfo, CursorHasItem +local SocketInventoryItem = SocketInventoryItem +local HandleModifiedItemClick = HandleModifiedItemClick +local AuctionFrameBrowse_Reset = AuctionFrameBrowse_Reset +local ClickSocketButton = ClickSocketButton + +local MAX_NUM_SOCKETS = MAX_NUM_SOCKETS +local RAID_CLASS_COLORS = RAID_CLASS_COLORS +local PANEL_DEFAULT_WIDTH = PANEL_DEFAULT_WIDTH + +local ITEM_MOD_AGILITY_SHORT, ITEM_MOD_SPIRIT_SHORT, ITEM_MOD_STAMINA_SHORT, ITEM_MOD_STRENGTH_SHORT, ITEM_MOD_INTELLECT_SHORT, ITEM_MOD_CRIT_RATING_SHORT, ITEM_SPELL_TRIGGER_ONUSE = ITEM_MOD_AGILITY_SHORT, ITEM_MOD_SPIRIT_SHORT, ITEM_MOD_STAMINA_SHORT, ITEM_MOD_STRENGTH_SHORT, ITEM_MOD_INTELLECT_SHORT, ITEM_MOD_CRIT_RATING_SHORT, ITEM_SPELL_TRIGGER_ONUSE +local AGI, SPI, STA, STR, INT, CRIT_ABBR = AGI, SPI, STA, STR, INT, CRIT_ABBR +local LE_TRANSMOG_TYPE_APPEARANCE = LE_TRANSMOG_TYPE_APPEARANCE +local STAT_AVERAGE_ITEM_LEVEL = STAT_AVERAGE_ITEM_LEVEL +local CHARACTERFRAME_EXPANDED_WIDTH = CHARACTERFRAME_EXPANDED_WIDTH + +local C_TransmogGetSlotInfo = C_Transmog.GetSlotInfo +local C_TransmogCollectionGetAppearanceSourceInfo = C_TransmogCollection.GetAppearanceSourceInfo +local C_TransmogGetSlotVisualInfo = C_Transmog.GetSlotVisualInfo local format = format -------------------------------------------------------------------------------- --<< KnightFrame : Upgrade Character Frame's Item Info like Wow-Armory >>-- -------------------------------------------------------------------------------- -local CA = CharacterArmory or CreateFrame('Frame', 'CharacterArmory', PaperDollFrame) +local CA = CharacterArmory or CreateFrame('Frame', 'CharacterArmory', _G["PaperDollFrame"]) local IsGemType = LE_ITEM_CLASS_GEM local SlotIDList = {} -local InsetDefaultPoint = { CharacterFrameInsetRight:GetPoint() } +local InsetDefaultPoint = { _G["CharacterFrameInsetRight"]:GetPoint() } local linkCache = {}; function GetInventoryItemGems(slot) - local link = GetInventoryItemLink("player", slot); + local link = T.GetInventoryItemLink("player", slot); if (link and linkCache[link]) then - return unpack(linkCache[link]); + return T.unpack(linkCache[link]); end local gem1, gem2, gem3, gem4; if (link) then - gem1, gem2, gem3, gem4 = select(7, string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")); + gem1, gem2, gem3, gem4 = T.select(7, T.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?")); if (gem1 == "") then gem1 = nil; end if (gem2 == "") then gem2 = nil; end if (gem3 == "") then gem3 = nil; end @@ -43,22 +66,22 @@ end do --<< Button Script >>-- function CA:OnEnter() if self.Link or self.Message then - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_RIGHT') self:SetScript('OnUpdate', function() - GameTooltip:ClearLines() + _G["GameTooltip"]:ClearLines() if self.Link then - GameTooltip:SetHyperlink(self.Link) + _G["GameTooltip"]:SetHyperlink(self.Link) end - if self.Link and self.Message then GameTooltip:AddLine(' ') end -- Line space + if self.Link and self.Message then _G["GameTooltip"]:AddLine(' ') end -- Line space if self.Message then - GameTooltip:AddLine(self.Message, 1, 1, 1) + _G["GameTooltip"]:AddLine(self.Message, 1, 1, 1) end - GameTooltip:Show() + _G["GameTooltip"]:Show() end) end end @@ -66,34 +89,34 @@ do --<< Button Script >>-- function CA:OnLeave() self:SetScript('OnUpdate', nil) - GameTooltip:Hide() + _G["GameTooltip"]:Hide() end function CA:GemSocket_OnEnter() - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_RIGHT') local Parent = self:GetParent() if Parent.GemItemID then - if type(Parent.GemItemID) == 'number' then - if GetItemInfo(Parent.GemItemID) then - GameTooltip:SetHyperlink(select(2, GetItemInfo(Parent.GemItemID))) + if T.type(Parent.GemItemID) == 'number' then + if T.GetItemInfo(Parent.GemItemID) then + _G["GameTooltip"]:SetHyperlink(T.select(2, T.GetItemInfo(Parent.GemItemID))) self:SetScript('OnUpdate', nil) else self:SetScript('OnUpdate', CA.GemSocket_OnEnter) return end else - GameTooltip:ClearLines() - GameTooltip:AddLine("|cffffffff"..Parent.GemItemID) + _G["GameTooltip"]:ClearLines() + _G["GameTooltip"]:AddLine("|cffffffff"..Parent.GemItemID) end elseif Parent.GemType then - GameTooltip:ClearLines() - GameTooltip:AddLine("|cffffffff".._G["EMPTY_SOCKET_"..Parent.GemType]) + _G["GameTooltip"]:ClearLines() + _G["GameTooltip"]:AddLine("|cffffffff".._G["EMPTY_SOCKET_"..Parent.GemType]) end - GameTooltip:Show() + _G["GameTooltip"]:Show() end @@ -106,18 +129,18 @@ do --<< Button Script >>-- end if self.GemItemID then - local ItemName, ItemLink = GetItemInfo(self.GemItemID) + local ItemName, ItemLink = T.GetItemInfo(self.GemItemID) if not IsShiftKeyDown() then SetItemRef(ItemLink, ItemLink, 'LeftButton') else if Button == 'RightButton' then - SocketInventoryItem(GetInventorySlotInfo(self.SlotName)) + SocketInventoryItem(T.GetInventorySlotInfo(self.SlotName)) elseif HandleModifiedItemClick(ItemLink) then - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(ItemName) - BrowseName:SetFocus() + elseif _G["BrowseName"] and _G["BrowseName"]:IsVisible() then + AuctionFrameBrowse_Reset(_G["BrowseResetButton"]) + _G["BrowseName"]:SetText(ItemName) + _G["BrowseName"]:SetFocus() end end end @@ -130,8 +153,8 @@ do --<< Button Script >>-- if CursorHasItem() then local CursorType, _, ItemLink = GetCursorInfo() - if CursorType == 'item' and select(6, GetItemInfo(ItemLink)) == IsGemType then - SocketInventoryItem(GetInventorySlotInfo(self.SlotName)) + if CursorType == 'item' and T.select(6, T.GetItemInfo(ItemLink)) == IsGemType then + SocketInventoryItem(T.GetInventorySlotInfo(self.SlotName)) ClickSocketButton(self.SocketNumber) end end @@ -141,30 +164,30 @@ do --<< Button Script >>-- function CA:Transmogrify_OnEnter() self.Texture:SetVertexColor(1, .8, 1) - GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT') - GameTooltip:SetHyperlink(self.Link) - GameTooltip:Show() + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_BOTTOMRIGHT') + _G["GameTooltip"]:SetHyperlink(self.Link) + _G["GameTooltip"]:Show() end function CA:Transmogrify_OnLeave() self.Texture:SetVertexColor(1, .5, 1) - GameTooltip:Hide() + _G["GameTooltip"]:Hide() end function CA:Transmogrify_OnClick(Button) - local ItemName, ItemLink = GetItemInfo(self.Link) + local ItemName, ItemLink = T.GetItemInfo(self.Link) if not IsShiftKeyDown() then SetItemRef(ItemLink, ItemLink, 'LeftButton') else if HandleModifiedItemClick(ItemLink) then - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(ItemName) - BrowseName:SetFocus() + elseif _G["BrowseName"] and _G["BrowseName"]:IsVisible() then + AuctionFrameBrowse_Reset(_G["BrowseResetButton"]) + _G["BrowseName"]:SetText(ItemName) + _G["BrowseName"]:SetFocus() end end end @@ -173,8 +196,8 @@ end function CA:Setup_CharacterArmory() --<< Core >>-- - self:Point('TOPLEFT', CharacterFrameInset, 10, 20) - self:Point('BOTTOMRIGHT', CharacterFrameInsetRight, 'BOTTOMLEFT', -10, 5) + self:Point('TOPLEFT', _G["CharacterFrameInset"], 10, 20) + self:Point('BOTTOMRIGHT', _G["CharacterFrameInsetRight"], 'BOTTOMLEFT', -10, 5) --<< Updater >>-- local args @@ -202,31 +225,31 @@ function CA:Setup_CharacterArmory() end end) self:SetScript('OnShow', self.ScanData) - hooksecurefunc('CharacterFrame_Collapse', function() if Info.CharacterArmory_Activate and PaperDollFrame:IsShown() then CharacterFrame:SetWidth(448) end end) - hooksecurefunc('CharacterFrame_Expand', function() if Info.CharacterArmory_Activate and PaperDollFrame:IsShown() then CharacterFrame:SetWidth(650) end end) + hooksecurefunc('CharacterFrame_Collapse', function() if Info.CharacterArmory_Activate and _G["PaperDollFrame"]:IsShown() then _G["CharacterFrame"]:SetWidth(448) end end) + hooksecurefunc('CharacterFrame_Expand', function() if Info.CharacterArmory_Activate and _G["PaperDollFrame"]:IsShown() then _G["CharacterFrame"]:SetWidth(650) end end) hooksecurefunc('ToggleCharacter', function(frameType) - if frameType ~= 'PaperDollFrame' and frameType ~= 'PetPaperDollFrame' then - CharacterFrame:SetWidth(PANEL_DEFAULT_WIDTH) - elseif Info.CharacterArmory_Activate and frameType == 'PaperDollFrame' then - CharacterFrameInsetRight:SetPoint('TOPLEFT', CharacterFrameInset, 'TOPRIGHT', 110, 0) + if frameType ~= "PaperDollFrame" and frameType ~= "PetPaperDollFrame" then + _G["CharacterFrame"]:SetWidth(PANEL_DEFAULT_WIDTH) + elseif Info.CharacterArmory_Activate and frameType == "PaperDollFrame" then + _G["CharacterFrameInsetRight"]:SetPoint('TOPLEFT', _G["CharacterFrameInset"], 'TOPRIGHT', 110, 0) else - CharacterFrameInsetRight:SetPoint(unpack(InsetDefaultPoint)) + _G["CharacterFrameInsetRight"]:SetPoint(T.unpack(InsetDefaultPoint)) end end) hooksecurefunc('PaperDollFrame_SetLevel', function() if Info.CharacterArmory_Activate then - CharacterLevelText:SetText('|c'..RAID_CLASS_COLORS[E.myclass].colorStr..CharacterLevelText:GetText()) - - CharacterFrameTitleText:ClearAllPoints() - CharacterFrameTitleText:Point('TOP', self, 0, 23) - CharacterFrameTitleText:SetParent(self) - CharacterLevelText:ClearAllPoints() - CharacterLevelText:SetPoint('TOP', CharacterFrameTitleText, 'BOTTOM', 0, -13) - CharacterLevelText:SetParent(self) + _G["CharacterLevelText"]:SetText('|c'..RAID_CLASS_COLORS[E.myclass].colorStr.._G["CharacterLevelText"]:GetText()) + + _G["CharacterFrameTitleText"]:ClearAllPoints() + _G["CharacterFrameTitleText"]:Point('TOP', self, 0, 23) + _G["CharacterFrameTitleText"]:SetParent(self) + _G["CharacterLevelText"]:ClearAllPoints() + _G["CharacterLevelText"]:SetPoint('TOP', _G["CharacterFrameTitleText"], 'BOTTOM', 0, -13) + _G["CharacterLevelText"]:SetParent(self) end end) - self.DisplayUpdater = CreateFrame('Frame', nil, PaperDollFrame) + self.DisplayUpdater = CreateFrame('Frame', nil, _G["PaperDollFrame"]) self.DisplayUpdater:SetScript('OnShow', function() if Info.CharacterArmory_Activate then self:Update_Display(true) end end) self.DisplayUpdater:SetScript('OnUpdate', function() if Info.CharacterArmory_Activate then self:Update_Display() end end) @@ -237,24 +260,24 @@ function CA:Setup_CharacterArmory() self:Update_BG() --<< Change Model Frame's frameLevel >>-- - CharacterModelFrame:SetFrameLevel(self:GetFrameLevel() + 2) + _G["CharacterModelFrame"]:SetFrameLevel(self:GetFrameLevel() + 2) --<< Average Item Level >>-- - KF:TextSetting(self, nil, { Tag = 'AverageItemLevel', FontSize = 12 }, 'BOTTOM', CharacterModelFrame, 'TOP', 0, 14) + KF:TextSetting(self, nil, { Tag = 'AverageItemLevel', FontSize = 12 }, 'BOTTOM', _G["CharacterModelFrame"], 'TOP', 0, 14) local function ValueColorUpdate() - self.AverageItemLevel:SetText(KF:Color_Value(L["Average"])..' : '..format('%.2f', select(2, GetAverageItemLevel()))) + self.AverageItemLevel:SetText(KF:Color_Value(L["Average"])..' : '..format('%.2f', T.select(2, T.GetAverageItemLevel()))) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -- Create each equipment slots gradation, text, gem socket icon. local Slot - for i, SlotName in pairs(Info.Armory_Constants.GearList) do + for i, SlotName in T.pairs(Info.Armory_Constants.GearList) do -- Equipment Tag Slot = CreateFrame('Frame', nil, self) Slot:Size(130, 41) - Slot:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 1) + Slot:SetFrameLevel(_G["CharacterModelFrame"]:GetFrameLevel() + 1) Slot.Direction = i%2 == 1 and 'LEFT' or 'RIGHT' - Slot.ID, Slot.EmptyTexture = GetInventorySlotInfo(SlotName) + Slot.ID, Slot.EmptyTexture = T.GetInventorySlotInfo(SlotName) Slot:Point(Slot.Direction, _G["Character"..SlotName], Slot.Direction == 'LEFT' and -1 or 1, 0) -- Grow each equipment slot's frame level @@ -328,7 +351,7 @@ function CA:Setup_CharacterArmory() }) Slot["Socket"..i]:SetBackdropColor(0, 0, 0, 1) Slot["Socket"..i]:SetBackdropBorderColor(0, 0, 0) - Slot["Socket"..i]:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 1) + Slot["Socket"..i]:SetFrameLevel(_G["CharacterModelFrame"]:GetFrameLevel() + 1) Slot["Socket"..i].SlotName = SlotName Slot["Socket"..i].SocketNumber = i @@ -393,12 +416,12 @@ function CA:Setup_CharacterArmory() self[SlotName] = Slot end - -- GameTooltip for counting gem sockets and getting enchant effects + -- _G["GameTooltip"] for counting gem sockets and getting enchant effects self.ScanTT = CreateFrame('GameTooltip', 'Knight_CharacterArmory_ScanTT', nil, 'GameTooltipTemplate') self.ScanTT:SetOwner(UIParent, 'ANCHOR_NONE') - if PawnUI_InventoryPawnButton then - PawnUI_InventoryPawnButton:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 1) + if _G["PawnUI_InventoryPawnButton"] then + _G["PawnUI_InventoryPawnButton"]:SetFrameLevel(_G["CharacterModelFrame"]:GetFrameLevel() + 1) end self.Setup_CharacterArmory = nil @@ -427,9 +450,9 @@ end function CA:Update_Durability() local Slot, R, G, B, CurrentDurability, MaxDurability - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do Slot = self[SlotName] - CurrentDurability, MaxDurability = GetInventoryItemDurability(Slot.ID) + CurrentDurability, MaxDurability = T.GetInventoryItemDurability(Slot.ID) if CurrentDurability and MaxDurability and not (E.db.sle.Armory.Character.Durability.Display == 'DamagedOnly' and CurrentDurability == MaxDurability) then R, G, B = E:ColorGradient((CurrentDurability / MaxDurability), 1, 0, 0, 1, 1, 0, 0, 1, 0) @@ -477,9 +500,9 @@ function CA:Update_Gear() local ErrorDetected, NeedUpdate, NeedUpdateList, R, G, B local Slot, ItemLink, ItemData, ItemRarity, BasicItemLevel, TrueItemLevel, ItemUpgradeID, ItemType, ItemTexture, UsableEffect, CurrentLineText, GemID, GemCount_Default, GemCount_Enable, GemCount_Now, GemCount, IsTransmogrified, TransmogrifyItemID - for _, SlotName in pairs(type(self.GearUpdated) == 'table' and self.GearUpdated or Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(T.type(self.GearUpdated) == 'table' and self.GearUpdated or Info.Armory_Constants.GearList) do Slot = self[SlotName] - ItemLink = GetInventoryItemLink('player', Slot.ID) + ItemLink = T.GetInventoryItemLink('player', Slot.ID) ErrorDetected = nil if not (SlotName == 'ShirtSlot' or SlotName == 'TabardSlot') then @@ -512,7 +535,7 @@ function CA:Update_Gear() if ItemLink then if not ItemLink:find('%[%]') then -- sometimes itemLink is malformed so we need to update when crashed do --<< Gem Parts >>-- - ItemData = { strsplit(':', ItemLink) } + ItemData = { T.split(':', ItemLink) } ItemData[4], ItemData[5], ItemData[6], ItemData[7] = 0, 0, 0, 0 for i = 1, #ItemData do @@ -530,7 +553,7 @@ function CA:Update_Gear() if ItemTexture and ItemTexture:find('Interface\\ItemSocketingFrame\\') then GemCount_Default = GemCount_Default + 1 - Slot["Socket"..GemCount_Default].GemType = strupper(gsub(ItemTexture, 'Interface\\ItemSocketingFrame\\UI--EmptySocket--', '')) + Slot["Socket"..GemCount_Default].GemType = T.upper(T.gsub(ItemTexture, 'Interface\\ItemSocketingFrame\\UI--EmptySocket--', '')) end end @@ -551,10 +574,10 @@ function CA:Update_Gear() -- Apply current item's gem setting for i = 1, MAX_NUM_SOCKETS do ItemTexture = _G["Knight_CharacterArmory_ScanTTTexture"..i]:GetTexture() - GemID = select(i, GetInventoryItemGems(Slot.ID)) + GemID = T.select(i, GetInventoryItemGems(Slot.ID)) if Slot["Socket"..i].GemType and Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType] then - R, G, B = unpack(Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType]) + R, G, B = T.unpack(Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType]) Slot["Socket"..i].Socket:SetBackdropColor(R, G, B, .5) Slot["Socket"..i].Socket:SetBackdropBorderColor(R, G, B) else @@ -574,7 +597,7 @@ function CA:Update_Gear() GemCount = GemCount + 1 Slot["Socket"..i].GemItemID = GemID - _, Slot["Socket"..i].Socket.Link, _, _, _, _, _, _, _, ItemTexture = GetItemInfo(GemID) + _, Slot["Socket"..i].Socket.Link, _, _, _, _, _, _, _, ItemTexture = T.GetItemInfo(GemID) if ItemTexture then Slot["Socket"..i].Texture:SetTexture(ItemTexture) @@ -591,37 +614,37 @@ function CA:Update_Gear() end end - _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = GetItemInfo(ItemLink) - R, G, B = GetItemQualityColor(ItemRarity) + _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(ItemLink) + R, G, B = T.GetItemQualityColor(ItemRarity) ItemUpgradeID = ItemLink:match(":(%d+)\124h%[") --<< Enchant Parts >>-- for i = 1, self.ScanTT:NumLines() do CurrentLineText = _G["Knight_CharacterArmory_ScanTTTextLeft"..i]:GetText() if CurrentLineText:find(Info.Armory_Constants.ItemLevelKey_Alt) then - TrueItemLevel = tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) + TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) elseif CurrentLineText:find(Info.Armory_Constants.ItemLevelKey) then - TrueItemLevel = tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) + TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) elseif CurrentLineText:find(Info.Armory_Constants.EnchantKey) then if E.db.sle.Armory.Character.Enchant.Display ~= 'Hide' then CurrentLineText = CurrentLineText:match(Info.Armory_Constants.EnchantKey) -- Get enchant string - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_AGILITY_SHORT, AGI) - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_SPIRIT_SHORT, SPI) - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_STAMINA_SHORT, STA) - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_STRENGTH_SHORT, STR) - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_INTELLECT_SHORT, INT) - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_CRIT_RATING_SHORT, CRIT_ABBR) -- Critical is too long - CurrentLineText = gsub(CurrentLineText, ' + ', '+') -- Remove space + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_AGILITY_SHORT, AGI) + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_SPIRIT_SHORT, SPI) + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_STAMINA_SHORT, STA) + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_STRENGTH_SHORT, STR) + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_INTELLECT_SHORT, INT) + CurrentLineText = T.gsub(CurrentLineText, ITEM_MOD_CRIT_RATING_SHORT, CRIT_ABBR) -- Critical is too long + CurrentLineText = T.gsub(CurrentLineText, ' + ', '+') -- Remove space - if L.Armory_ReplaceEnchantString and type(L.Armory_ReplaceEnchantString) == 'table' then - for Old, New in pairs(L.Armory_ReplaceEnchantString) do - CurrentLineText = gsub(CurrentLineText, Old, New) + if L.Armory_ReplaceEnchantString and T.type(L.Armory_ReplaceEnchantString) == 'table' then + for Old, New in T.pairs(L.Armory_ReplaceEnchantString) do + CurrentLineText = T.gsub(CurrentLineText, Old, New) end end - for Name, _ in pairs(SLE_ArmoryDB.EnchantString) do + for Name, _ in T.pairs(SLE_ArmoryDB.EnchantString) do if SLE_ArmoryDB.EnchantString[Name].original and SLE_ArmoryDB.EnchantString[Name].new then - CurrentLineText = gsub(CurrentLineText, SLE_ArmoryDB.EnchantString[Name].original, SLE_ArmoryDB.EnchantString[Name].new) + CurrentLineText = T.gsub(CurrentLineText, SLE_ArmoryDB.EnchantString[Name].original, SLE_ArmoryDB.EnchantString[Name].new) end end @@ -682,10 +705,10 @@ function CA:Update_Gear() --<< Transmogrify Parts >>-- if Slot.TransmogrifyAnchor then - IsTransmogrified = C_Transmog.GetSlotInfo(Slot.ID, LE_TRANSMOG_TYPE_APPEARANCE); + IsTransmogrified = C_TransmogGetSlotInfo(Slot.ID, LE_TRANSMOG_TYPE_APPEARANCE); if IsTransmogrified then - Slot.TransmogrifyAnchor.Link = select(6, C_TransmogCollection.GetAppearanceSourceInfo(select(3, C_Transmog.GetSlotVisualInfo(Slot.ID, LE_TRANSMOG_TYPE_APPEARANCE)))); + Slot.TransmogrifyAnchor.Link = T.select(6, C_TransmogCollectionGetAppearanceSourceInfo(T.select(3, C_TransmogGetSlotVisualInfo(Slot.ID, LE_TRANSMOG_TYPE_APPEARANCE)))); Slot.TransmogrifyAnchor:Show() end end @@ -710,11 +733,11 @@ function CA:Update_Gear() Slot.Gradation:SetVertexColor(1, 0, 0) Slot.Gradation:Show() else - Slot.Gradation:SetVertexColor(unpack(E.db.sle.Armory.Character.Gradation.Color)) + Slot.Gradation:SetVertexColor(T.unpack(E.db.sle.Armory.Character.Gradation.Color)) end end - self.AverageItemLevel:SetText(KF:Color_Value(STAT_AVERAGE_ITEM_LEVEL)..' : '..format('%.2f', select(2, GetAverageItemLevel()))) + self.AverageItemLevel:SetText(KF:Color_Value(STAT_AVERAGE_ITEM_LEVEL)..' : '..format('%.2f', T.select(2, T.GetAverageItemLevel()))) if NeedUpdateList then self.GearUpdated = NeedUpdateList @@ -739,8 +762,8 @@ end function CA:Update_Display(Force) local Slot, Mouseover, SocketVisible - if (PaperDollFrame:IsMouseOver() and (E.db.sle.Armory.Character.Level.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Enchant.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Durability.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Gem.Display == 'MouseoverOnly')) or Force then - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + if (_G["PaperDollFrame"]:IsMouseOver() and (E.db.sle.Armory.Character.Level.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Enchant.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Durability.Display == 'MouseoverOnly' or E.db.sle.Armory.Character.Gem.Display == 'MouseoverOnly')) or Force then + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do Slot = self[SlotName] Mouseover = Slot:IsMouseOver() @@ -829,13 +852,13 @@ KF.Modules.CharacterArmory = function() Info.CharacterArmory_Activate = true -- Setting frame - CharacterFrame:SetHeight(444) + _G["CharacterFrame"]:SetHeight(444) -- Move right equipment slots - CharacterHandsSlot:SetPoint('TOPRIGHT', CharacterFrameInsetRight, 'TOPLEFT', -4, -2) + _G["CharacterHandsSlot"]:SetPoint('TOPRIGHT', _G["CharacterFrameInsetRight"], 'TOPLEFT', -4, -2) -- Move bottom equipment slots - CharacterMainHandSlot:SetPoint('BOTTOMLEFT', PaperDollItemsFrame, 'BOTTOMLEFT', 185, 14) + _G["CharacterMainHandSlot"]:SetPoint('BOTTOMLEFT', _G["PaperDollItemsFrame"], 'BOTTOMLEFT', 185, 14) if CA.Setup_CharacterArmory then CA:Setup_CharacterArmory() @@ -846,18 +869,18 @@ KF.Modules.CharacterArmory = function() CA:Update_BG() -- Model Frame - CharacterModelFrame:ClearAllPoints() - CharacterModelFrame:SetPoint('TOPLEFT', CharacterHeadSlot) - CharacterModelFrame:SetPoint('RIGHT', CharacterHandsSlot) - CharacterModelFrame:SetPoint('BOTTOM', CharacterMainHandSlot) - CharacterModelFrame.BackgroundTopLeft:Hide() - CharacterModelFrame.BackgroundTopRight:Hide() - CharacterModelFrame.BackgroundBotLeft:Hide() - CharacterModelFrame.BackgroundBotRight:Hide() + _G["CharacterModelFrame"]:ClearAllPoints() + _G["CharacterModelFrame"]:SetPoint('TOPLEFT', _G["CharacterHeadSlot"]) + _G["CharacterModelFrame"]:SetPoint('RIGHT', _G["CharacterHandsSlot"]) + _G["CharacterModelFrame"]:SetPoint('BOTTOM', _G["CharacterMainHandSlot"]) + _G["CharacterModelFrame"].BackgroundTopLeft:Hide() + _G["CharacterModelFrame"].BackgroundTopRight:Hide() + _G["CharacterModelFrame"].BackgroundBotLeft:Hide() + _G["CharacterModelFrame"].BackgroundBotRight:Hide() - if PaperDollFrame:IsShown() then - CharacterFrame:SetWidth(CharacterFrame.Expanded and 650 or 444) - CharacterFrameInsetRight:SetPoint('TOPLEFT', CharacterFrameInset, 'TOPRIGHT', 110, 0) + if _G["PaperDollFrame"]:IsShown() then + _G["CharacterFrame"]:SetWidth(_G["CharacterFrame"].Expanded and 650 or 444) + _G["CharacterFrameInsetRight"]:SetPoint('TOPLEFT', _G["CharacterFrameInset"], 'TOPRIGHT', 110, 0) end -- Run KnightArmory @@ -880,24 +903,24 @@ KF.Modules.CharacterArmory = function() Info.CharacterArmory_Activate = nil -- Setting frame to default - CharacterFrame:SetHeight(424) - CharacterFrame:SetWidth(PaperDollFrame:IsShown() and CharacterFrame.Expanded and CHARACTERFRAME_EXPANDED_WIDTH or PANEL_DEFAULT_WIDTH) - CharacterFrameInsetRight:SetPoint(unpack(InsetDefaultPoint)) + _G["CharacterFrame"]:SetHeight(424) + _G["CharacterFrame"]:SetWidth(_G["PaperDollFrame"]:IsShown() and _G["CharacterFrame"].Expanded and CHARACTERFRAME_EXPANDED_WIDTH or PANEL_DEFAULT_WIDTH) + _G["CharacterFrameInsetRight"]:SetPoint(T.unpack(InsetDefaultPoint)) -- Move rightside equipment slots to default position - CharacterHandsSlot:SetPoint('TOPRIGHT', CharacterFrameInset, 'TOPRIGHT', -4, -2) + _G["CharacterHandsSlot"]:SetPoint('TOPRIGHT', _G["CharacterFrameInset"], 'TOPRIGHT', -4, -2) -- Move bottom equipment slots to default position - CharacterMainHandSlot:SetPoint('BOTTOMLEFT', PaperDollItemsFrame, 'BOTTOMLEFT', 130, 16) + _G["CharacterMainHandSlot"]:SetPoint('BOTTOMLEFT', _G["PaperDollItemsFrame"], 'BOTTOMLEFT', 130, 16) -- Model Frame - CharacterModelFrame:ClearAllPoints() - CharacterModelFrame:Size(231, 320) - CharacterModelFrame:SetPoint('TOPLEFT', PaperDollFrame, 'TOPLEFT', 52, -66) - CharacterModelFrame.BackgroundTopLeft:Show() - CharacterModelFrame.BackgroundTopRight:Show() - CharacterModelFrame.BackgroundBotLeft:Show() - CharacterModelFrame.BackgroundBotRight:Show() + _G["CharacterModelFrame"]:ClearAllPoints() + _G["CharacterModelFrame"]:Size(231, 320) + _G["CharacterModelFrame"]:SetPoint('TOPLEFT', _G["PaperDollFrame"], 'TOPLEFT', 52, -66) + _G["CharacterModelFrame"].BackgroundTopLeft:Show() + _G["CharacterModelFrame"].BackgroundTopRight:Show() + _G["CharacterModelFrame"].BackgroundBotLeft:Show() + _G["CharacterModelFrame"].BackgroundBotRight:Show() -- Turn off ArmoryFrame CA:Hide() diff --git a/ElvUI_SLE/modules/Armory/Constants.lua b/ElvUI_SLE/modules/Armory/Constants.lua index 4946485..a89d076 100644 --- a/ElvUI_SLE/modules/Armory/Constants.lua +++ b/ElvUI_SLE/modules/Armory/Constants.lua @@ -2,6 +2,7 @@ local E, L, V, P, G = unpack(ElvUI) local KF, Info, Timer = unpack(ElvUI_KnightFrame) +local gsub = gsub Info.Armory_Constants = { ItemLevelKey = ITEM_LEVEL:gsub('%%d', '(.+)'), diff --git a/ElvUI_SLE/modules/Armory/InspectArmory/Communication.lua b/ElvUI_SLE/modules/Armory/InspectArmory/Communication.lua index 2fa75a7..8c9ed7a 100644 --- a/ElvUI_SLE/modules/Armory/InspectArmory/Communication.lua +++ b/ElvUI_SLE/modules/Armory/InspectArmory/Communication.lua @@ -1,9 +1,30 @@ -------------------------------------------------------------------------------- --<< AISM : Armory Support Module for AddOn Communication Inspecting >>-- -------------------------------------------------------------------------------- +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) local Revision = 1.2 local _G = _G local AISM = _G["Armory_InspectSupportModule"] or CreateFrame('Frame', 'Armory_InspectSupportModule', UIParent) +local gsub = gsub +local strsub = strsub + +local GetNumSpecGroups = GetNumSpecGroups +local GetTotalAchievementPoints = GetTotalAchievementPoints +local C_TransmogGetSlotInfo = C_Transmog.GetSlotInfo +local C_TransmogCollectionGetAppearanceSourceInfo = C_TransmogCollection.GetAppearanceSourceInfo +local C_TransmogGetSlotVisualInfo = C_Transmog.GetSlotVisualInfo +local SendAddonMessage = SendAddonMessage + +local MAX_TALENT_GROUPS, NUM_TALENT_COLUMNS, MAX_TALENT_TIERS = MAX_TALENT_GROUPS, NUM_TALENT_COLUMNS, MAX_TALENT_TIERS +local MAX_NUM_SOCKETS = MAX_NUM_SOCKETS +local LIGHTYELLOW_FONT_COLOR = LIGHTYELLOW_FONT_COLOR +local LIGHTYELLOW_FONT_COLOR_CODE, GRAY_FONT_COLOR_CODE = LIGHTYELLOW_FONT_COLOR_CODE, GRAY_FONT_COLOR_CODE +local LE_TRANSMOG_TYPE_APPEARANCE = LE_TRANSMOG_TYPE_APPEARANCE +local LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_INSTANCE +local COMBATLOG_UNKNOWN_UNIT = COMBATLOG_UNKNOWN_UNIT +local UNKNOWNOBJECT = UNKNOWNOBJECT +local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS +local EMPTY = EMPTY if not AISM.Revision or AISM.Revision < Revision then local ItemSetBonusKey = ITEM_SET_BONUS:gsub('%%s', '(.+)') @@ -12,14 +33,14 @@ if not AISM.Revision or AISM.Revision < Revision then local ProfessionUnlearnKey = ERR_SPELL_UNLEARNED_S:gsub('%%s', '(.+)') local GuildLeaveKey = ERR_GUILD_LEAVE_S:gsub('%%s', '(.+)') local PlayerOfflineKey = ERR_CHAT_PLAYER_NOT_FOUND_S:gsub('%%s', '(.+)') - + local playerName = UnitName('player') local playerRealm = gsub(GetRealmName(),'[%s%-]','') local _, playerClass, playerClassID = UnitClass('player') local playerRace, playerRaceID = UnitRace('player') local playerSex = UnitSex('player') local playerNumSpecGroup = GetNumSpecGroups() - + --<< Create Core >>-- AISM.Revision = Revision @@ -108,7 +129,7 @@ if not AISM.Revision or AISM.Revision < Revision then for groupNum = 1, MAX_TALENT_GROUPS do AISM.DataTypeTable["SP"..groupNum] = 'Specialization' end - for slotName, keyName in pairs(AISM.GearList) do + for slotName, keyName in T.pairs(AISM.GearList) do AISM.DataTypeTable[keyName] = 'Gear' SlotIDList[GetInventorySlotInfo(slotName)] = slotName end @@ -141,7 +162,7 @@ if not AISM.Revision or AISM.Revision < Revision then self.elapsed = 0 self:Hide() - for _ in pairs(AISM.UpdatedData) do + for _ in T.pairs(AISM.UpdatedData) do if AISM.CurrentGroupMode and AISM.CurrentGroupMode ~= 'NoGroup' and AISM.CurrentGroupType then AISM:SendData(AISM.UpdatedData) end @@ -163,7 +184,7 @@ if not AISM.Revision or AISM.Revision < Revision then end elseif Event == 'PLAYER_EQUIPMENT_CHANGED' then args = ... - self.GearUpdated = type(self.GearUpdated) == 'table' and self.GearUpdated or {} + self.GearUpdated = T.type(self.GearUpdated) == 'table' and self.GearUpdated or {} self.GearUpdated[(SlotIDList[args])] = true self:Show() elseif Event == 'COMBAT_LOG_EVENT_UNFILTERED' then @@ -204,11 +225,11 @@ if not AISM.Revision or AISM.Revision < Revision then --<< Profession String >>-- function AISM:GetPlayerProfessionSetting() - local Profession1, Profession2 = GetProfessions() + local Profession1, Profession2 = T.GetProfessions() local Profession1_Level, Profession2_Level = 0, 0 if Profession1 then - Profession1, _, Profession1_Level = GetProfessionInfo(Profession1) + Profession1, _, Profession1_Level = T.GetProfessionInfo(Profession1) if self.ProfessionList[Profession1] then Profession1 = self.ProfessionList[Profession1]..'/'..Profession1_Level @@ -218,7 +239,7 @@ if not AISM.Revision or AISM.Revision < Revision then end if Profession2 then - Profession2, _, Profession2_Level = GetProfessionInfo(Profession2) + Profession2, _, Profession2_Level = T.GetProfessionInfo(Profession2) if self.ProfessionList[Profession2] then Profession2 = self.ProfessionList[Profession2]..'/'..Profession2_Level @@ -247,38 +268,38 @@ if not AISM.Revision or AISM.Revision < Revision then local SpecTable = {} local GroupArray = {} for i = 1, playerNumSpecGroup do - tinsert(GroupArray, i) + T.tinsert(GroupArray, i) end if ActiveSpec ~= 1 then - tremove(GroupArray, ActiveSpec) - tinsert(GroupArray, 1, ActiveSpec) + T.tremove(GroupArray, ActiveSpec) + T.tinsert(GroupArray, 1, ActiveSpec) end function AISM:GetPlayerSpecSetting() local DataString, Spec, Talent, isSelected - ActiveSpec = GetActiveSpecGroup() + ActiveSpec = T.GetActiveSpecGroup() if self.PlayerData.ActiveSpec ~= ActiveSpec then self.PlayerData.ActiveSpec = ActiveSpec self.PlayerData_ShortString.ActiveSpec = ActiveSpec self.UpdatedData.ActiveSpec = ActiveSpec - wipe(GroupArray) + T.twipe(GroupArray) for i = 1, playerNumSpecGroup do - tinsert(GroupArray, i) + T.tinsert(GroupArray, i) end if ActiveSpec ~= 1 then - tremove(GroupArray, ActiveSpec) - tinsert(GroupArray, 1, ActiveSpec) + T.tremove(GroupArray, ActiveSpec) + T.tinsert(GroupArray, 1, ActiveSpec) end end - for Step, Group in pairs(GroupArray) do + for Step, Group in T.pairs(GroupArray) do DataString = nil - Spec = GetSpecialization(nil, nil, Group) - Spec = Spec and GetSpecializationInfo(Spec) or '0' + Spec = T.GetSpecialization(nil, nil, Group) + Spec = Spec and T.GetSpecializationInfo(Spec) or '0' if not SpecTable["Spec"..Step] or SpecTable["Spec"..Step] ~= Spec then SpecTable["Spec"..Step] = Spec @@ -287,7 +308,7 @@ if not AISM.Revision or AISM.Revision < Revision then for i = 1, MAX_TALENT_TIERS do for k = 1, NUM_TALENT_COLUMNS do - Talent, _, _, isSelected = GetTalentInfo(i, k, Group) + Talent, _, _, isSelected = T.GetTalentInfo(i, k, Group) Talent = ((i - 1) * NUM_TALENT_COLUMNS + k)..'_'..Talent..(isSelected == true and '_1' or '') @@ -321,24 +342,24 @@ if not AISM.Revision or AISM.Revision < Revision then local ShortString, FullString, needUpdate, needUpdateList local CurrentSetItem, GearSetIDList = {}, {} - local slotID, slotLink, isTransmogrified, transmogrifiedItemID, SetName, GeatSetCount, SetItemMax, SetOptionCount, colorR, colorG, colorB, checkSpace, tooltipText - for slotName in pairs(type(self.Updater.GearUpdated) == 'table' and self.Updater.GearUpdated or self.GearList) do + local slotID, slotLink, isTransmogrified, transmogrifiedItemID, SetName, SetItemCount, SetItemMax, SetOptionCount, colorR, colorG, colorB, checkSpace, tooltipText + for slotName in T.pairs(T.type(self.Updater.GearUpdated) == 'table' and self.Updater.GearUpdated or self.GearList) do needUpdate = nil self.UncheckableDataList[slotName] = nil - slotID = GetInventorySlotInfo(slotName) - slotLink = GetInventoryItemLink('player', slotID) + slotID = T.GetInventorySlotInfo(slotName) + slotLink = T.GetInventoryItemLink('player', slotID) if slotLink and slotLink:find('%[%]') then -- sometimes itemLink is malformed so we need to update when crashed needUpdate = true else if slotLink and self.CanTransmogrifySlot[slotName] then - isTransmogrified = C_Transmog.GetSlotInfo(slotID, LE_TRANSMOG_TYPE_APPEARANCE); + isTransmogrified = C_TransmogGetSlotInfo(slotID, LE_TRANSMOG_TYPE_APPEARANCE); if (isTransmogrified) then - local transmogLink = select(6, C_TransmogCollection.GetAppearanceSourceInfo(select(3, C_Transmog.GetSlotVisualInfo(slotID, LE_TRANSMOG_TYPE_APPEARANCE)))); + local transmogLink = T.select(6, C_TransmogCollectionGetAppearanceSourceInfo(T.select(3, C_TransmogGetSlotVisualInfo(slotID, LE_TRANSMOG_TYPE_APPEARANCE)))); if (transmogLink) then - transmogrifiedItemID = select(2, strsplit(':', string.match(slotLink, 'item[%-?%d:]+'))); + transmogrifiedItemID = T.select(2, T.split(':', T.match(slotLink, 'item[%-?%d:]+'))); else isTransmogrified = nil end @@ -347,14 +368,14 @@ if not AISM.Revision or AISM.Revision < Revision then isTransmogrified = nil end - ShortString = slotLink and select(2, strsplit(':', string.match(slotLink, 'item[%-?%d:]+'))) or 'F' -- ITEM ID + ShortString = slotLink and T.select(2, T.split(':', T.match(slotLink, 'item[%-?%d:]+'))) or 'F' -- ITEM ID FullString = slotLink or 'F' if slotLink then self.UncheckableDataList[slotName] = slotName == 'HeadSlot' and 'ND' or slotName == 'BackSlot' and 'ND' or isTransmogrified and transmogrifiedItemID or '0' for i = 1, MAX_NUM_SOCKETS do - self.UncheckableDataList[slotName] = self.UncheckableDataList[slotName]..'/'..(select(i, GetInventoryItemGems(slotID)) or 0) + self.UncheckableDataList[slotName] = self.UncheckableDataList[slotName]..'/'..(T.select(i, GetInventoryItemGems(slotID)) or 0) end FullString = FullString..'/'..self.UncheckableDataList[slotName] @@ -380,8 +401,8 @@ if not AISM.Revision or AISM.Revision < Revision then SetName, SetItemCount, SetItemMax = _G["AISM_TooltipTextLeft"..i]:GetText():match('^(.+) %((%d)/(%d)%)$') -- find string likes 'SetName (0/5)' if SetName then - SetItemCount = tonumber(SetItemCount) - SetItemMax = tonumber(SetItemMax) + SetItemCount = T.tonumber(SetItemCount) + SetItemMax = T.tonumber(SetItemMax) if SetItemCount > SetItemMax or SetItemMax == 1 then needUpdate = true @@ -459,7 +480,7 @@ if not AISM.Revision or AISM.Revision < Revision then -- Clear cache when there's no gear set if self.PlayerData.SetItem then - for SetName in pairs(self.PlayerData.SetItem) do + for SetName in T.pairs(self.PlayerData.SetItem) do if not CurrentSetItem[SetName] then self.PlayerData.SetItem[SetName] = nil self.PlayerData_ShortString.SetItem[SetName] = nil @@ -486,36 +507,35 @@ if not AISM.Revision or AISM.Revision < Revision then --<< Player Info >>-- function AISM:SettingInspectData(TableToSave) - local guildName, guildRankName = GetGuildInfo('player') + local guildName, guildRankName = T.GetGuildInfo('player') - TableToSave.PlayerInfo = playerName..'_'..UnitPVPName('player')..'/'..playerRealm..'/'..UnitLevel('player')..'/'..playerClass..'/'..playerClassID..'/'..playerRace..'/'..playerRaceID..'/'..playerSex..(guildName and '/'..guildName..'/'..guildRankName or '') + TableToSave.PlayerInfo = playerName..'_'..T.UnitPVPName('player')..'/'..playerRealm..'/'..T.UnitLevel('player')..'/'..playerClass..'/'..playerClassID..'/'..playerRace..'/'..playerRaceID..'/'..playerSex..(guildName and '/'..guildName..'/'..guildRankName or '') - if IsInGuild() then - TableToSave.GuildInfo = GetTotalAchievementPoints(true)..'/'..GetNumGuildMembers() + if T.IsInGuild() then + TableToSave.GuildInfo = GetTotalAchievementPoints(true)..'/'..T.GetNumGuildMembers() - for _, DataString in ipairs({ GetGuildLogoInfo('player') }) do + for _, DataString in T.ipairs({ T.GetGuildLogoInfo('player') }) do TableToSave.GuildInfo = TableToSave.GuildInfo..'/'..DataString end end - TableToSave.PvP = GetPVPLifetimeStats() + TableToSave.PvP = T.GetPVPLifetimeStats() local Rating, Played, Won - for i, Type in pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do - Rating, _, _, Played, Won = GetPersonalRatedInfo(i) + for i, Type in T.pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do + Rating, _, _, Played, Won = T.GetPersonalRatedInfo(i) if Played > 0 then TableToSave.PvP = TableToSave.PvP..'/'..Type..'_'..Rating..'_'..Played..'_'..Won end end end - - + function AISM:SendData(InputData, Prefix, Channel, WhisperTarget) - Channel = Channel or IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or string.upper(self.CurrentGroupMode) + Channel = Channel or T.IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or T.upper(self.CurrentGroupMode) Prefix = Prefix or 'AISM' - if not InputData or type(InputData) ~= 'table' or Channel == 'NOGROUP' then return end + if not InputData or T.type(InputData) ~= 'table' or Channel == 'NOGROUP' then return end local Data = {} @@ -549,15 +569,15 @@ if not AISM.Revision or AISM.Revision < Revision then end end - for slotName, keyName in pairs(self.GearList) do + for slotName, keyName in T.pairs(self.GearList) do if InputData[slotName] then Data[#Data + 1] = keyName..':'..InputData[slotName] end end if InputData.SetItem then - for SetName, DataString in pairs(InputData.SetItem) do - Data[#Data + 1] = 'SID:'..SetName..(type(DataString) == 'number' and '/' or '')..DataString + for SetName, DataString in T.pairs(InputData.SetItem) do + Data[#Data + 1] = 'SID:'..SetName..(T.type(DataString) == 'number' and '/' or '')..DataString end end @@ -565,18 +585,18 @@ if not AISM.Revision or AISM.Revision < Revision then local stringLength = 0 local dataLength - for dataTag, dataText in pairs(Data) do + for dataTag, dataText in T.pairs(Data) do DataString = DataString..'{'..dataText..'}' - dataLength = strlen(dataText) + 2 + dataLength = T.strlen(dataText) + 2 if stringLength + dataLength <= 255 then stringLength = stringLength + dataLength else - while strlen(DataString) > 255 do + while T.strlen(DataString) > 255 do SendAddonMessage(Prefix, strsub(DataString, 1, 255), Channel, WhisperTarget) DataString = strsub(DataString, 256) - stringLength = strlen(DataString) + stringLength = T.strlen(DataString) end end end @@ -588,18 +608,18 @@ if not AISM.Revision or AISM.Revision < Revision then function AISM:GetPlayerCurrentGroupMode() - if not (IsInGroup() or IsInRaid()) or GetNumGroupMembers() == 1 then + if not (T.IsInGroup() or T.IsInRaid()) or T.GetNumGroupMembers() == 1 then self.CurrentGroupMode = 'NoGroup' - wipe(self.GroupMemberData) + T.twipe(self.GroupMemberData) else - if IsInRaid() then + if T.IsInRaid() then self.CurrentGroupMode = 'raid' else self.CurrentGroupMode = 'party' end - for userName in pairs(self.GroupMemberData) do - if not UnitExists(userName) or not UnitIsConnected(userName) then + for userName in T.pairs(self.GroupMemberData) do + if not T.UnitExists(userName) or not T.UnitIsConnected(userName) then self.GroupMemberData[userName] = nil end end @@ -610,7 +630,7 @@ if not AISM.Revision or AISM.Revision < Revision then function AISM:GetCurrentInstanceType() - local _, instanceType, difficultyID = GetInstanceInfo() + local _, instanceType, difficultyID = T.GetInstanceInfo() if difficultyID == 8 then self.InstanceType = 'challenge' @@ -628,15 +648,15 @@ if not AISM.Revision or AISM.Revision < Revision then if self.CurrentGroupMode ~= 'NoGroup' then for i = 1, MAX_RAID_MEMBERS do - Name = UnitName(self.CurrentGroupMode..i) - TableIndex = GetUnitName(self.CurrentGroupMode..i, true) + Name = T.UnitName(self.CurrentGroupMode..i) + TableIndex = T.GetUnitName(self.CurrentGroupMode..i, true) - if Name and not UnitIsUnit('player', self.CurrentGroupMode..i) then + if Name and not T.UnitIsUnit('player', self.CurrentGroupMode..i) then if Name == UNKNOWNOBJECT or Name == COMBATLOG_UNKNOWN_UNIT then self.AISMUserList[TableIndex] = nil self.GroupMemberData[TableIndex] = nil - elseif self.GroupMemberData[TableIndex] and not UnitIsConnected(self.CurrentGroupMode..i) then - if type(self.GroupMemberData[TableIndex]) ~= 'number' then + elseif self.GroupMemberData[TableIndex] and not T.UnitIsConnected(self.CurrentGroupMode..i) then + if T.type(self.GroupMemberData[TableIndex]) ~= 'number' then self.GroupMemberData[TableIndex] = 0 end @@ -675,7 +695,7 @@ if not AISM.Revision or AISM.Revision < Revision then if Prefix == 'AISM' then local NeedResponse - if type(self.GroupMemberData[Sender]) ~= 'table' then + if T.type(self.GroupMemberData[Sender]) ~= 'table' then self.GroupMemberData[Sender] = {} NeedResponse = true @@ -690,7 +710,7 @@ if not AISM.Revision or AISM.Revision < Revision then local SenderRealm, TableToSave, NeedResponse, Group, stringTable function AISM:Receiver(Prefix, Message, Channel, Sender) - Sender, SenderRealm = strsplit('-', Sender) + Sender, SenderRealm = T.split('-', Sender) SenderRealm = SenderRealm and gsub(SenderRealm,'[%s%-]','') or nil Sender = Sender..(SenderRealm and SenderRealm ~= '' and SenderRealm ~= playerRealm and '-'..SenderRealm or '') @@ -703,10 +723,10 @@ if not AISM.Revision or AISM.Revision < Revision then SendAddonMessage('AISM', 'AISM_Response:'..self.Revision, 'WHISPER', Sender) elseif Message:find('AISM_Response') then - local ver = tonumber(strsub(Message:gsub('AISM_Response', ''), 2)) + local ver = T.tonumber(strsub(Message:gsub('AISM_Response', ''), 2)) Message = 'AISM_Response' - if type(ver) == 'number' then + if T.type(ver) == 'number' then self.AISMUserList[Sender] = ver else self.AISMUserList[Sender] = true @@ -725,13 +745,13 @@ if not AISM.Revision or AISM.Revision < Revision then elseif Message:find('AISM_DataRequestForInspecting:') then Message = Message:gsub('AISM_DataRequestForInspecting:', '') - local needplayerName, needplayerRealm, NeedOnlyUncheckableData = strsplit('-', Message) + local needplayerName, needplayerRealm, NeedOnlyUncheckableData = T.split('-', Message) if needplayerName == playerName and needplayerRealm == playerRealm then if not NeedOnlyUncheckableData then local TableToSend = {} - for Index, Data in pairs(self.PlayerData) do + for Index, Data in T.pairs(self.PlayerData) do TableToSend[Index] = Data end @@ -743,7 +763,7 @@ if not AISM.Revision or AISM.Revision < Revision then end end - for funcName, func in pairs(self.RegisteredFunction) do + for funcName, func in T.pairs(self.RegisteredFunction) do func(Sender, Prefix, Message) end else @@ -760,16 +780,16 @@ if not AISM.Revision or AISM.Revision < Revision then if self.DataTypeTable[DataType] then Message = Message:gsub('%{'..DataType..':.-%}', '') Group = DataType:match('^.+(%d)$') - stringTable = { strsplit('/', DataString) } + stringTable = { T.split('/', DataString) } - for Index, Data in pairs(stringTable) do - if tonumber(Data) then - stringTable[Index] = tonumber(Data) + for Index, Data in T.pairs(stringTable) do + if T.tonumber(Data) then + stringTable[Index] = T.tonumber(Data) end end if Group and self.DataTypeTable[DataType] ~= 'Gear' then -- Prepare group setting - Group = tonumber(Group) + Group = T.tonumber(Group) TableToSave[(self.DataTypeTable[DataType])] = TableToSave[(self.DataTypeTable[DataType])] or {} TableToSave[(self.DataTypeTable[DataType])][Group] = TableToSave[(self.DataTypeTable[DataType])][Group] or {} end @@ -779,7 +799,7 @@ if not AISM.Revision or AISM.Revision < Revision then TableToSave.Profession[Group].Name = EMPTY TableToSave.Profession[Group].Level = 0 else - for localeName, Key in pairs(self.ProfessionList) do + for localeName, Key in T.pairs(self.ProfessionList) do if Key == stringTable[1] then TableToSave.Profession[Group].Name = localeName break @@ -791,7 +811,7 @@ if not AISM.Revision or AISM.Revision < Revision then local Spec, Talent, isSelected for i = 1, #stringTable do - Spec, Talent, isSelected = strsplit('_', stringTable[i]) + Spec, Talent, isSelected = T.split('_', stringTable[i]) if not Talent then TableToSave.Specialization[Group].SpecializationID = stringTable[1] @@ -801,11 +821,11 @@ if not AISM.Revision or AISM.Revision < Revision then end elseif self.DataTypeTable[DataType] == 'ActiveSpec' then TableToSave.Specialization = TableToSave.Specialization or {} - TableToSave.Specialization.ActiveSpec = tonumber(DataString) + TableToSave.Specialization.ActiveSpec = T.tonumber(DataString) elseif self.DataTypeTable[DataType] == 'Gear' then TableToSave.Gear = TableToSave.Gear or {} - for slotName, keyName in pairs(self.GearList) do + for slotName, keyName in T.pairs(self.GearList) do if keyName == DataType then DataType = slotName break @@ -834,13 +854,13 @@ if not AISM.Revision or AISM.Revision < Revision then TableToSave.SetItem = TableToSave.SetItem or {} if stringTable[2] ~= 'F' then - if type(stringTable[2]) == 'number' then + if T.type(stringTable[2]) == 'number' then TableToSave.SetItem[(stringTable[1])] = stringTable[2] else TableToSave.SetItem[(stringTable[1])] = {} for i = 2, #stringTable do - if strlen(stringTable[i]) > 2 then + if T.strlen(stringTable[i]) > 2 then TableToSave.SetItem[(stringTable[1])][i - 1] = stringTable[i] else for k = 1, #stringTable - i + 1 do @@ -854,7 +874,7 @@ if not AISM.Revision or AISM.Revision < Revision then TableToSave.SetItem[(stringTable[1])] = nil end elseif self.DataTypeTable[DataType] == 'PlayerInfo' then - TableToSave.Name, TableToSave.Title = strsplit('_', stringTable[1]) + TableToSave.Name, TableToSave.Title = T.split('_', stringTable[1]) TableToSave.Realm = stringTable[2] ~= '' and stringTable[2] ~= playerRealm and stringTable[2] or nil TableToSave.Level = stringTable[3] TableToSave.Class = stringTable[4] @@ -879,15 +899,15 @@ if not AISM.Revision or AISM.Revision < Revision then local PvPType, Rating, Played, Won for i = 2, #stringTable do - PvPType, Rating, Played, Won = strsplit('_', stringTable[i]) - TableToSave.PvP[PvPType] = { tonumber(Rating), tonumber(Played), tonumber(Won) } + PvPType, Rating, Played, Won = T.split('_', stringTable[i]) + TableToSave.PvP[PvPType] = { T.tonumber(Rating), T.tonumber(Played), T.tonumber(Won) } end end end end if Message == '' then - for funcName, func in pairs(self.RegisteredFunction) do + for funcName, func in T.pairs(self.RegisteredFunction) do func(Sender, Prefix, TableToSave) end @@ -910,11 +930,11 @@ if not AISM.Revision or AISM.Revision < Revision then self:GetPlayerCurrentGroupMode() self:GetCurrentInstanceType() elseif Event == 'PLAYER_LOGOUT' then - if IsInGuild() then + if T.IsInGuild() then SendAddonMessage('AISM', 'AISM_GUILD_UnregistME', 'GUILD') end if self.CurrentGroupMode ~= 'NoGroup' then - SendAddonMessage('AISM', 'AISM_UnregistME', IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or string.upper(self.CurrentGroupMode)) + SendAddonMessage('AISM', 'AISM_UnregistME', T.IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or T.upper(self.CurrentGroupMode)) end elseif Event == 'CHAT_MSG_SYSTEM' then Message = ... @@ -925,11 +945,11 @@ if not AISM.Revision or AISM.Revision < Revision then Sender = Message:match(GuildLeaveKey) or Message:match(PlayerOfflineKey) Sender = Sender:gsub('@', '-') - Sender, SenderRealm = strsplit('-', Sender) + Sender, SenderRealm = T.split('-', Sender) SenderRealm = SenderRealm and gsub(SenderRealm, '[%s%-]', '') or nil Sender = Sender..(SenderRealm and SenderRealm ~= '' and SenderRealm ~= playerRealm and '-'..SenderRealm or '') - for userName in pairs(self.AISMUserList) do + for userName in T.pairs(self.AISMUserList) do if userName == Sender then self.AISMUserList[userName] = Type == 'GUILD' and true or nil @@ -961,7 +981,7 @@ if not AISM.Revision or AISM.Revision < Revision then function AISM:RegisterInspectDataRequest(Func, funcName, PreserveFunction) - if type(Func) == 'function' then + if T.type(Func) == 'function' then funcName = funcName or #self.RegisteredFunction + 1 self.RegisteredFunction[funcName] = function(User, Prefix, UserData) diff --git a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua index e8b3e18..c9edbb8 100644 --- a/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua +++ b/ElvUI_SLE/modules/Armory/InspectArmory/InspectArmory.lua @@ -1,15 +1,19 @@ if select(2, GetAddOnInfo('ElvUI_KnightFrame')) and IsAddOnLoaded('ElvUI_KnightFrame') then return end -local E, L, V, P, G = unpack(ElvUI) +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) local KF, Info, Timer = unpack(ElvUI_KnightFrame) - +--GLOBALS: CreateFrame, SLE_ArmoryDB, NotifyInspect, InspectUnit, UIParent, hooksecurefunc, UIDROPDOWNMENU_MENU_LEVEL local format = format +local gsub = gsub +local print = print +local next = next -------------------------------------------------------------------------------- --<< KnightFrame : Upgrade Inspect Frame like Wow-Armory >>-- -------------------------------------------------------------------------------- local IA = InspectArmory or CreateFrame('Frame', 'InspectArmory', E.UIParent) local _G = _G +local _ local ENI = _G["EnhancedNotifyInspect"] or { CancelInspect = function() end } local AISM = _G["Armory_InspectSupportModule"] local ButtonName = INSPECT --L["Knight Inspect"] @@ -26,6 +30,42 @@ local HeadSlotItem = 99568 local BackSlotItem = 102246 local Default_NotifyInspect, Default_InspectUnit +local NUM_TALENT_COLUMNS,MAX_TALENT_GROUPS = NUM_TALENT_COLUMNS,MAX_TALENT_GROUPS +local MAX_TALENT_GROUPS, CLASS_TALENT_LEVELS, MAX_TALENT_TIERS = MAX_TALENT_GROUPS, CLASS_TALENT_LEVELS, MAX_TALENT_TIERS +local LIGHTYELLOW_FONT_COLOR_CODE = LIGHTYELLOW_FONT_COLOR_CODE +local TRANSMOGRIFIED_HEADER = TRANSMOGRIFIED_HEADER +local RAID_CLASS_COLORS = RAID_CLASS_COLORS +local LEVEL = LEVEL +local MAX_NUM_SOCKETS = MAX_NUM_SOCKETS +local ITEM_MOD_AGILITY_SHORT, ITEM_MOD_SPIRIT_SHORT, ITEM_MOD_STAMINA_SHORT, ITEM_MOD_STRENGTH_SHORT, ITEM_MOD_INTELLECT_SHORT, ITEM_MOD_CRIT_RATING_SHORT, ITEM_SPELL_TRIGGER_ONUSE = ITEM_MOD_AGILITY_SHORT, ITEM_MOD_SPIRIT_SHORT, ITEM_MOD_STAMINA_SHORT, ITEM_MOD_STRENGTH_SHORT, ITEM_MOD_INTELLECT_SHORT, ITEM_MOD_CRIT_RATING_SHORT, ITEM_SPELL_TRIGGER_ONUSE +local AGI, SPI, STA, STR, INT, CRIT_ABBR = AGI, SPI, STA, STR, INT, CRIT_ABBR +local LIGHTYELLOW_FONT_COLOR_CODE, GRAY_FONT_COLOR_CODE = LIGHTYELLOW_FONT_COLOR_CODE, GRAY_FONT_COLOR_CODE +local LIGHTYELLOW_FONT_COLOR = LIGHTYELLOW_FONT_COLOR +local LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_INSTANCE +local INSPECT_GUILD_NUM_MEMBERS = INSPECT_GUILD_NUM_MEMBERS +local STAT_AVERAGE_ITEM_LEVEL = STAT_AVERAGE_ITEM_LEVEL +local TRADE_SKILLS = TRADE_SKILLS +local PVP, ARENA_2V2, ARENA_3V3, ARENA_5V5, PVP_RATED_BATTLEGROUNDS, GUILD = PVP, ARENA_2V2, ARENA_3V3, ARENA_5V5, PVP_RATED_BATTLEGROUNDS, GUILD + +local SendAddonMessage = SendAddonMessage +local ShowUIPanel, HideUIPanel = ShowUIPanel, HideUIPanel +local HandleModifiedItemClick = HandleModifiedItemClick +local AuctionFrameBrowse_Reset = AuctionFrameBrowse_Reset +local IsShiftKeyDown = IsShiftKeyDown +local SetItemRef = SetItemRef +local GetCursorPosition = GetCursorPosition +local PlaySound = PlaySound +local UIDropDownMenu_StopCounting, UIDropDownMenu_StartCounting = UIDropDownMenu_StopCounting, UIDropDownMenu_StartCounting +local UIDropDownMenu_CreateInfo, UIDropDownMenu_AddButton = UIDropDownMenu_CreateInfo, UIDropDownMenu_AddButton +local SetSmallGuildTabardTextures = SetSmallGuildTabardTextures +local GetPlayerInfoByGUID = GetPlayerInfoByGUID +local HasInspectHonorData = HasInspectHonorData +local GetInventoryItemTexture = GetInventoryItemTexture +local GetInspectSpecialization = GetInspectSpecialization +local GetInspectArenaData, GetInspectRatedBGData, GetInspectHonorData = GetInspectArenaData, GetInspectRatedBGData, GetInspectHonorData +local GetGuildLogoInfo, GetInspectGuildInfo = GetGuildLogoInfo, GetInspectGuildInfo +local GetTalentLink = GetTalentLink + --<< Key Table >>-- IA.PageList = { Character = 'CHARACTER', Info = 'INFO', Spec = 'TALENTS' } IA.InfoPageCategoryList = { 'Profession', 'PvP', 'Guild' } @@ -99,22 +139,22 @@ IA.MainStats = { -- STR, INT, AGI, do --<< Button Script >>-- function IA:OnEnter() if self.Link or self.Message then - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_RIGHT') self:SetScript('OnUpdate', function() - GameTooltip:ClearLines() + _G["GameTooltip"]:ClearLines() if self.Link then - GameTooltip:SetHyperlink(self.Link) + _G["GameTooltip"]:SetHyperlink(self.Link) end - if self.Link and self.Message then GameTooltip:AddLine(' ') end -- Line space + if self.Link and self.Message then _G["GameTooltip"]:AddLine(' ') end -- Line space if self.Message then - GameTooltip:AddLine(self.Message, 1, 1, 1) + _G["GameTooltip"]:AddLine(self.Message, 1, 1, 1) end - GameTooltip:Show() + _G["GameTooltip"]:Show() end) end end @@ -122,38 +162,38 @@ do --<< Button Script >>-- function IA:OnLeave() self:SetScript('OnUpdate', nil) - GameTooltip:Hide() + _G["GameTooltip"]:Hide() end function IA:OnClick() if self.Link then if HandleModifiedItemClick(self.Link) then - elseif self.EnableAuctionSearch and BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(self:GetParent().text:GetText()) - BrowseName:SetFocus() + elseif self.EnableAuctionSearch and _G["BrowseName"] and _G["BrowseName"]:IsVisible() then + AuctionFrameBrowse_Reset(_G["BrowseResetButton"]) + _G["BrowseName"]:SetText(self:GetParent().text:GetText()) + _G["BrowseName"]:SetFocus() end end end function IA:Button_OnEnter() - self:SetBackdropBorderColor(unpack(E.media.rgbvaluecolor)) + self:SetBackdropBorderColor(T.unpack(E.media.rgbvaluecolor)) self.text:SetText(KF:Color_Value(self.ButtonString)) end function IA:Button_OnLeave() - self:SetBackdropBorderColor(unpack(E.media.bordercolor)) + self:SetBackdropBorderColor(T.unpack(E.media.bordercolor)) self.text:SetText(self.ButtonString) end function IA:EquipmentSlot_OnEnter() - if Info.Armory_Constants.CanTransmogrifySlot[self.SlotName] and type(self.TransmogrifyLink) == 'number' and not GetItemInfo(self.TransmogrifyLink) then + if Info.Armory_Constants.CanTransmogrifySlot[self.SlotName] and T.type(self.TransmogrifyLink) == 'number' and not T.GetItemInfo(self.TransmogrifyLink) then self:SetScript('OnUpdate', function() - if GetItemInfo(self.TransmogrifyLink) then + if T.GetItemInfo(self.TransmogrifyLink) then IA.EquipmentSlot_OnEnter(self) self:SetScript('OnUpdate', nil) end @@ -162,11 +202,11 @@ do --<< Button Script >>-- end if self.Link then - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') - GameTooltip:SetHyperlink(self.Link) + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_RIGHT') + _G["GameTooltip"]:SetHyperlink(self.Link) local CurrentLineText, SetName - for i = 1, GameTooltip:NumLines() do + for i = 1, _G["GameTooltip"]:NumLines() do CurrentLineText = _G["GameTooltipTextLeft"..i]:GetText() SetName = CurrentLineText:match('^(.+) %((%d)/(%d)%)$') @@ -174,9 +214,9 @@ do --<< Button Script >>-- if SetName then local SetCount = 0 - if type(IA.SetItem[SetName]) == 'table' then - for dataType, Data in pairs(IA.SetItem[SetName]) do - if type(dataType) == 'string' then -- Means SetOption Data + if T.type(IA.SetItem[SetName]) == 'table' then + for dataType, Data in T.pairs(IA.SetItem[SetName]) do + if T.type(dataType) == 'string' then -- Means SetOption Data _G["GameTooltipTextLeft"..(i + #IA.SetItem[SetName] + 1 + dataType:match('^.+(%d)$'))]:SetText(Data) @@ -202,16 +242,16 @@ do --<< Button Script >>-- end end - _G["GameTooltipTextLeft"..i]:SetText(string.gsub(CurrentLineText, ' %(%d/', ' %('..SetCount..'/', 1)) + _G["GameTooltipTextLeft"..i]:SetText(gsub(CurrentLineText, ' %(%d/', ' %('..SetCount..'/', 1)) end break elseif Info.Armory_Constants.CanTransmogrifySlot[self.SlotName] and Info.Armory_Constants.ItemBindString[CurrentLineText] and self.TransmogrifyAnchor.Link then - _G["GameTooltipTextLeft"..i]:SetText(E:RGBToHex(1, .5, 1)..TRANSMOGRIFIED_HEADER..'|n'..(GetItemInfo(self.TransmogrifyAnchor.Link) or self.TransmogrifyAnchor.Link)..'|r|n'..CurrentLineText) + _G["GameTooltipTextLeft"..i]:SetText(E:RGBToHex(1, .5, 1)..TRANSMOGRIFIED_HEADER..'|n'..(T.GetItemInfo(self.TransmogrifyAnchor.Link) or self.TransmogrifyAnchor.Link)..'|r|n'..CurrentLineText) end end - GameTooltip:Show() + _G["GameTooltip"]:Show() end end @@ -253,46 +293,46 @@ do --<< Button Script >>-- function IA:GemSocket_OnEnter() - GameTooltip:SetOwner(self, 'ANCHOR_RIGHT') + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_RIGHT') local Parent = self:GetParent() if Parent.GemItemID then - if type(Parent.GemItemID) == 'number' then - if GetItemInfo(Parent.GemItemID) then - GameTooltip:SetHyperlink(select(2, GetItemInfo(Parent.GemItemID))) + if T.type(Parent.GemItemID) == 'number' then + if T.GetItemInfo(Parent.GemItemID) then + _G["GameTooltip"]:SetHyperlink(T.select(2, T.GetItemInfo(Parent.GemItemID))) self:SetScript('OnUpdate', nil) else self:SetScript('OnUpdate', IA.GemSocket_OnEnter) return end else - GameTooltip:ClearLines() - GameTooltip:AddLine('|cffffffff'..Parent.GemItemID) + _G["GameTooltip"]:ClearLines() + _G["GameTooltip"]:AddLine('|cffffffff'..Parent.GemItemID) end elseif Parent.GemType then - GameTooltip:ClearLines() - GameTooltip:AddLine('|cffffffff'.._G["EMPTY_SOCKET_"..Parent.GemType]) + _G["GameTooltip"]:ClearLines() + _G["GameTooltip"]:AddLine('|cffffffff'.._G["EMPTY_SOCKET_"..Parent.GemType]) end - GameTooltip:Show() + _G["GameTooltip"]:Show() end function IA:GemSocket_OnClick() self = self:GetParent() - if self.GemItemID and type(self.GemItemID) == 'number' then - local ItemName, ItemLink = GetItemInfo(self.GemItemID) + if self.GemItemID and T.type(self.GemItemID) == 'number' then + local ItemName, ItemLink = T.GetItemInfo(self.GemItemID) if not IsShiftKeyDown() then SetItemRef(ItemLink, ItemLink, 'LeftButton') else if HandleModifiedItemClick(ItemLink) then - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(ItemName) - BrowseName:SetFocus() + elseif _G["BrowseName"] and _G["BrowseName"]:IsVisible() then + AuctionFrameBrowse_Reset(_G["BrowseResetButton"]) + _G["BrowseName"]:SetText(ItemName) + _G["BrowseName"]:SetFocus() end end end @@ -303,11 +343,11 @@ do --<< Button Script >>-- self.Texture:SetVertexColor(1, .8, 1) if self.Link then - if GetItemInfo(self.Link) then + if T.GetItemInfo(self.Link) then self:SetScript('OnUpdate', nil) - GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT') - GameTooltip:SetHyperlink(select(2, GetItemInfo(self.Link))) - GameTooltip:Show() + _G["GameTooltip"]:SetOwner(self, 'ANCHOR_BOTTOMRIGHT') + _G["GameTooltip"]:SetHyperlink(T.select(2, T.GetItemInfo(self.Link))) + _G["GameTooltip"]:Show() else self:SetScript('OnUpdate', IA.Transmogrify_OnEnter) end @@ -319,21 +359,21 @@ do --<< Button Script >>-- self:SetScript('OnUpdate', nil) self.Texture:SetVertexColor(1, .5, 1) - GameTooltip:Hide() + _G["GameTooltip"]:Hide() end function IA:Transmogrify_OnClick(Button) - local ItemName, ItemLink = GetItemInfo(self.Link) + local ItemName, ItemLink = T.GetItemInfo(self.Link) if not IsShiftKeyDown() then SetItemRef(ItemLink, ItemLink, 'LeftButton') else if HandleModifiedItemClick(ItemLink) then - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(ItemName) - BrowseName:SetFocus() + elseif _G["BrowseName"] and _G["BrowseName"]:IsVisible() then + AuctionFrameBrowse_Reset(_G["BrowseResetButton"]) + _G["BrowseName"]:SetText(ItemName) + _G["BrowseName"]:SetFocus() end end end @@ -341,7 +381,7 @@ end function IA:ChangePage(Type) - for PageType in pairs(self.PageList) do + for PageType in T.pairs(self.PageList) do if self[PageType] then if Type == PageType..'Button' then Type = PageType @@ -355,14 +395,14 @@ function IA:ChangePage(Type) self.MainHandSlot:ClearAllPoints() self.SecondaryHandSlot:ClearAllPoints() if Type == 'Character' then - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do self[SlotName].ItemLevel:Hide() end self.MainHandSlot:Point('BOTTOMRIGHT', self.BP, 'TOP', -2, SPACING) self.SecondaryHandSlot:Point('BOTTOMLEFT', self.BP, 'TOP', 2, SPACING) else - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do self[SlotName].ItemLevel:Show() end @@ -413,7 +453,7 @@ function IA:CreateInspectFrame() end) self:SetScript('OnShow', function() self.Model:Point('TOPRIGHT', self.HandsSlot) end) self:SetScript('OnEvent', function(self, Event, ...) if self[Event] then self[Event](Event, ...) end end) - UIPanelWindows.InspectArmory = { area = 'left', pushable = 1, whileDead = 1 } + _G["UIPanelWindows"].InspectArmory = { area = 'left', pushable = 1, whileDead = 1 } self.DisplayUpdater = CreateFrame('Frame', nil, self) self.DisplayUpdater:SetScript('OnShow', function() if Info.InspectArmory_Activate then self:Update_Display(true) end end) @@ -521,7 +561,7 @@ function IA:CreateInspectFrame() end do --<< Buttons >>-- - for ButtonName, ButtonString in pairs(self.PageList) do + for ButtonName, ButtonString in T.pairs(self.PageList) do ButtonName = ButtonName..'Button' self[ButtonName] = CreateFrame('Button', nil, self.BP) @@ -577,7 +617,7 @@ function IA:CreateInspectFrame() end do --<< Class, Specialization Icon >>-- - for _, FrameName in pairs({ 'SpecIcon', 'ClassIcon', }) do + for _, FrameName in T.pairs({ 'SpecIcon', 'ClassIcon', }) do self[FrameName.."Slot"] = CreateFrame('Frame', nil, self) self[FrameName.."Slot"]:Size(24) self[FrameName.."Slot"]:SetBackdrop({ @@ -587,7 +627,7 @@ function IA:CreateInspectFrame() insets = { left = 0, right = 0, top = 0, bottom = 0} }) self[FrameName] = self[FrameName.."Slot"]:CreateTexture(nil, 'OVERLAY') - self[FrameName]:SetTexCoord(unpack(E.TexCoords)) + self[FrameName]:SetTexCoord(T.unpack(E.TexCoords)) self[FrameName]:SetInside() end self.ClassIconSlot:Point('RIGHT', self.Tab, 'BOTTOMRIGHT', -44, -35) @@ -645,7 +685,7 @@ function IA:CreateInspectFrame() self.Character = CreateFrame('Frame', nil, self) local Slot - for i, SlotName in pairs(Info.Armory_Constants.GearList) do + for i, SlotName in T.pairs(Info.Armory_Constants.GearList) do -- Slot Slot = CreateFrame('Button', nil, self) Slot:Size(SLOT_SIZE) @@ -663,10 +703,10 @@ function IA:CreateInspectFrame() Slot.SlotName = SlotName Slot.Direction = i%2 == 1 and 'LEFT' or 'RIGHT' - Slot.ID, Slot.EmptyTexture = GetInventorySlotInfo(SlotName) + Slot.ID, Slot.EmptyTexture = T.GetInventorySlotInfo(SlotName) Slot.Texture = Slot:CreateTexture(nil, 'OVERLAY') - Slot.Texture:SetTexCoord(unpack(E.TexCoords)) + Slot.Texture:SetTexCoord(T.unpack(E.TexCoords)) Slot.Texture:SetInside() Slot.Texture:SetTexture(Slot.EmptyTexture) @@ -855,7 +895,7 @@ function IA:CreateInspectFrame() self.Info.Page:Point('TOPLEFT', self.Info, 0, 2) self.Info.Page:Point('TOPRIGHT', self.Info, 0, 2) - for _, CategoryType in pairs(IA.InfoPageCategoryList) do + for _, CategoryType in T.pairs(IA.InfoPageCategoryList) do self.Info[CategoryType] = CreateFrame('ScrollFrame', nil, self.Info.Page) self.Info[CategoryType]:SetBackdrop({ bgFile = E.media.blankTex, @@ -879,7 +919,7 @@ function IA:CreateInspectFrame() }) self.Info[CategoryType].IconSlot:Point('TOPLEFT', self.Info[CategoryType], SPACING, -SPACING) self.Info[CategoryType].Icon = self.Info[CategoryType].IconSlot:CreateTexture(nil, 'OVERLAY') - self.Info[CategoryType].Icon:SetTexCoord(unpack(E.TexCoords)) + self.Info[CategoryType].Icon:SetTexCoord(T.unpack(E.TexCoords)) self.Info[CategoryType].Icon:SetInside() self.Info[CategoryType].Tab = CreateFrame('Frame', nil, self.Info[CategoryType]) @@ -922,7 +962,7 @@ function IA:CreateInspectFrame() self.Info.Profession["Prof"..i]:SetBackdropBorderColor(0, 0, 0) self.Info.Profession["Prof"..i].Icon = self.Info.Profession["Prof"..i]:CreateTexture(nil, 'OVERLAY') - self.Info.Profession["Prof"..i].Icon:SetTexCoord(unpack(E.TexCoords)) + self.Info.Profession["Prof"..i].Icon:SetTexCoord(T.unpack(E.TexCoords)) self.Info.Profession["Prof"..i].Icon:SetInside() self.Info.Profession["Prof"..i].BarFrame = CreateFrame('Frame', nil, self.Info.Profession["Prof"..i]) @@ -982,7 +1022,7 @@ function IA:CreateInspectFrame() self.Info.PvP.Bar3:Point('TOP', self.Info.PvP.PageRight, 0, -SPACING * 2) self.Info.PvP.Bar3:Point('BOTTOM', self.Info.PvP.PageRight, 0, SPACING * 2) - for _, Type in pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do + for _, Type in T.pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do self.Info.PvP[Type] = CreateFrame('Frame', nil, self.Info.PvP.Page) self.Info.PvP[Type]:SetFrameLevel(CORE_FRAME_LEVEL + 5) @@ -1190,7 +1230,7 @@ function IA:CreateInspectFrame() insets = { left = 0, right = 0, top = 0, bottom = 0} }) self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon.Texture = self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon:CreateTexture(nil, 'OVERLAY') - self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon.Texture:SetTexCoord(unpack(E.TexCoords)) + self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon.Texture:SetTexCoord(T.unpack(E.TexCoords)) self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon.Texture:SetInside() self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon:Point('LEFT', self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)], SPACING, 0) KF:TextSetting(self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)], nil, { FontSize = 9, directionH = 'LEFT' }, 'TOPLEFT', self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon, 'TOPRIGHT', SPACING, SPACING) @@ -1218,26 +1258,26 @@ function IA:CreateInspectFrame() end do --<< Scanning Tooltip >>-- - self.ScanTTForInspecting = CreateFrame('GameTooltip', 'InspectArmoryScanTT_I', nil, 'GameTooltipTemplate') + self.ScanTTForInspecting = CreateFrame("GameTooltip", 'InspectArmoryScanTT_I', nil, 'GameTooltipTemplate') self.ScanTTForInspecting:SetOwner(UIParent, 'ANCHOR_NONE') - self.ScanTT = CreateFrame('GameTooltip', 'InspectArmoryScanTT', nil, 'GameTooltipTemplate') + self.ScanTT = CreateFrame("GameTooltip", 'InspectArmoryScanTT', nil, 'GameTooltipTemplate') self.ScanTT:SetOwner(UIParent, 'ANCHOR_NONE') end do --<< UnitPopup Setting >>-- - InspectArmory_UnitPopup.Highlight = InspectArmory_UnitPopup:CreateTexture(nil, 'BACKGROUND') - InspectArmory_UnitPopup.Highlight:SetTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight') - InspectArmory_UnitPopup.Highlight:SetBlendMode('ADD') - InspectArmory_UnitPopup.Highlight:SetAllPoints() - InspectArmory_UnitPopup:SetHighlightTexture(InspectArmory_UnitPopup.Highlight) - - InspectArmory_UnitPopup:SetScript('OnEnter', function() - UIDropDownMenu_StopCounting(DropDownList1) + _G["InspectArmory_UnitPopup"].Highlight = _G["InspectArmory_UnitPopup"]:CreateTexture(nil, 'BACKGROUND') + _G["InspectArmory_UnitPopup"].Highlight:SetTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight') + _G["InspectArmory_UnitPopup"].Highlight:SetBlendMode('ADD') + _G["InspectArmory_UnitPopup"].Highlight:SetAllPoints() + _G["InspectArmory_UnitPopup"]:SetHighlightTexture(_G["InspectArmory_UnitPopup"].Highlight) + + _G["InspectArmory_UnitPopup"]:SetScript('OnEnter', function() + UIDropDownMenu_StopCounting(_G["DropDownList1"]) end) - InspectArmory_UnitPopup:SetScript('OnLeave', function() - UIDropDownMenu_StartCounting(DropDownList1) + _G["InspectArmory_UnitPopup"]:SetScript('OnLeave', function() + UIDropDownMenu_StartCounting(_G["DropDownList1"]) end) - InspectArmory_UnitPopup:SetScript('OnHide', function(self) + _G["InspectArmory_UnitPopup"]:SetScript('OnHide', function(self) if self.Anchored then self.Anchored = nil self.Data = nil @@ -1246,7 +1286,7 @@ function IA:CreateInspectFrame() self:Hide() end end) - InspectArmory_UnitPopup:SetScript('OnClick', function(self) + _G["InspectArmory_UnitPopup"]:SetScript('OnClick', function(self) local SendChannel, InspectWork if AISM and AISM.AISMUserList[self.Data.TableIndex] then if self.Data.Realm == Info.MyRealm then @@ -1254,7 +1294,7 @@ function IA:CreateInspectFrame() elseif AISM.AISMUserList[self.Data.TableIndex] == 'GUILD' then SendChannel = 'GUILD' elseif Info.CurrentGroupMode and Info.CurrentGroupMode ~= 'NoGroup' then - SendChannel = IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or string.upper(Info.CurrentGroupMode) + SendChannel = T.IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or T.upper(Info.CurrentGroupMode) end end @@ -1276,7 +1316,7 @@ function IA:CreateInspectFrame() IA:UnregisterEvent('INSPECT_READY') IA.NeedModelSetting = true - wipe(IA.CurrentInspectData) + T.twipe(IA.CurrentInspectData) E:CopyTable(IA.CurrentInspectData, IA.Default_CurrentInspectData) end @@ -1297,15 +1337,15 @@ function IA:CreateInspectFrame() SendAddonMessage('AISM_Inspect', 'AISM_DataRequestForInspecting:'..self.Data.Name..'-'..self.Data.Realm..(InspectWork and '-true' or ''), SendChannel, self.Data.TableIndex) end - DropDownList1:Hide() + _G["DropDownList1"]:Hide() end) - InspectArmory_UnitPopup:SetScript('OnUpdate', function(self) + _G["InspectArmory_UnitPopup"]:SetScript('OnUpdate', function(self) if not (self:GetPoint() and self:GetParent()) then self:Hide() return end - if AISM and (type(AISM.GroupMemberData[self.Data.TableIndex]) == 'table' or AISM.AISMUserList[self.Data.TableIndex]) or self.Data.Unit and UnitIsVisible(self.Data.Unit) and UnitIsConnected(self.Data.Unit) and not UnitIsDeadOrGhost('player') then + if AISM and (T.type(AISM.GroupMemberData[self.Data.TableIndex]) == 'table' or AISM.AISMUserList[self.Data.TableIndex]) or self.Data.Unit and T.UnitIsVisible(self.Data.Unit) and T.UnitIsConnected(self.Data.Unit) and not T.UnitIsDeadOrGhost('player') then self:SetText(KF:Color_Value(ButtonName)) self:Enable() else @@ -1314,27 +1354,27 @@ function IA:CreateInspectFrame() end end) - InspectArmory_UnitPopup.CreateDropDownButton = function(Button, DataTable) + _G["InspectArmory_UnitPopup"].CreateDropDownButton = function(Button, DataTable) if not Button then Button = UIDropDownMenu_CreateInfo() Button.notCheckable = 1 UIDropDownMenu_AddButton(Button) - Button = _G["DropDownList1Button"..DropDownList1.numButtons] + Button = _G["DropDownList1Button".._G["DropDownList1"].numButtons] end Button.value = 'InspectArmory' - Button:SetText((' '):rep(strlen(ButtonName))) - - InspectArmory_UnitPopup:Show() - InspectArmory_UnitPopup:SetParent('DropDownList1') - InspectArmory_UnitPopup:SetFrameStrata(Button:GetFrameStrata()) - InspectArmory_UnitPopup:SetFrameLevel(Button:GetFrameLevel() + 1) - InspectArmory_UnitPopup:ClearAllPoints() - InspectArmory_UnitPopup:Point('TOPLEFT', Button) - InspectArmory_UnitPopup:Point('BOTTOMRIGHT', Button) - InspectArmory_UnitPopup.Anchored = true - InspectArmory_UnitPopup.Data = DataTable + Button:SetText((' '):rep(T.strlen(ButtonName))) + + _G["InspectArmory_UnitPopup"]:Show() + _G["InspectArmory_UnitPopup"]:SetParent("DropDownList1") + _G["InspectArmory_UnitPopup"]:SetFrameStrata(Button:GetFrameStrata()) + _G["InspectArmory_UnitPopup"]:SetFrameLevel(Button:GetFrameLevel() + 1) + _G["InspectArmory_UnitPopup"]:ClearAllPoints() + _G["InspectArmory_UnitPopup"]:Point('TOPLEFT', Button) + _G["InspectArmory_UnitPopup"]:Point('BOTTOMRIGHT', Button) + _G["InspectArmory_UnitPopup"].Anchored = true + _G["InspectArmory_UnitPopup"].Data = DataTable end hooksecurefunc('UnitPopup_ShowMenu', function(Menu, Type, Unit, Name, ...) @@ -1342,12 +1382,12 @@ function IA:CreateInspectFrame() local Button local DataTable = { Name = Menu.name or Name, - Unit = UnitExists(Menu.name) and Menu.name or Unit, + Unit = T.UnitExists(Menu.name) and Menu.name or Unit, Realm = Menu.server ~= '' and Menu.server or Info.MyRealm } - DataTable.TableIndex = DataTable.Unit and GetUnitName(DataTable.Unit, 1) or DataTable.Name..(DataTable.Realm and DataTable.Realm ~= '' and DataTable.Realm ~= Info.MyRealm and '-'..DataTable.Realm or '') + DataTable.TableIndex = DataTable.Unit and T.GetUnitName(DataTable.Unit, 1) or DataTable.Name..(DataTable.Realm and DataTable.Realm ~= '' and DataTable.Realm ~= Info.MyRealm and '-'..DataTable.Realm or '') - if DataTable.Name == E.myname or DataTable.Unit and (UnitCanAttack('player', DataTable.Unit) or not UnitIsConnected(DataTable.Unit) or not UnitIsPlayer(DataTable.Unit)) then + if DataTable.Name == E.myname or DataTable.Unit and (T.UnitCanAttack('player', DataTable.Unit) or not T.UnitIsConnected(DataTable.Unit) or not T.UnitIsPlayer(DataTable.Unit)) then if AISM then AISM.AISMUserList[DataTable.TableIndex] = nil AISM.GroupMemberData[DataTable.TableIndex] = nil @@ -1356,7 +1396,7 @@ function IA:CreateInspectFrame() return end - for i = 1, DropDownList1.numButtons do + for i = 1, _G["DropDownList1"].numButtons do if _G["DropDownList1Button"..i].value == 'INSPECT' then Button = _G["DropDownList1Button"..i] break @@ -1366,10 +1406,10 @@ function IA:CreateInspectFrame() if AISM and not (AISM.AISMUserList[DataTable.TableIndex] or AISM.GroupMemberData[DataTable.TableIndex]) then local isSending - if DataTable.Unit and not (UnitCanAttack('player', DataTable.Unit) or not UnitIsConnected(DataTable.Unit) or not UnitIsPlayer(DataTable.Unit)) then + if DataTable.Unit and not (T.UnitCanAttack('player', DataTable.Unit) or not T.UnitIsConnected(DataTable.Unit) or not T.UnitIsPlayer(DataTable.Unit)) then if DataTable.Realm == Info.MyRealm or (Info.CurrentGroupMode and Info.CurrentGroupMode ~= 'NoGroup') then isSending = 'AISM_CheckResponse' - SendAddonMessage('AISM', 'AISM_Check', DataTable.Realm == Info.MyRealm and 'WHISPER' or IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or string.upper(Info.CurrentGroupMode), DataTable.Name) + SendAddonMessage('AISM', 'AISM_Check', DataTable.Realm == Info.MyRealm and 'WHISPER' or T.IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or T.upper(Info.CurrentGroupMode), DataTable.Name) end elseif Menu.which == 'GUILD' then isSending = 'AISM_GUILD_CheckResponse' @@ -1382,7 +1422,7 @@ function IA:CreateInspectFrame() if isSending then AISM:RegisterInspectDataRequest(function(User, _, Message) if User == DataTable.TableIndex and Message == isSending then - InspectArmory_UnitPopup.CreateDropDownButton(Button, DataTable) + _G["InspectArmory_UnitPopup"].CreateDropDownButton(Button, DataTable) return true end @@ -1391,7 +1431,7 @@ function IA:CreateInspectFrame() end if DataTable.Unit or Button or (AISM and (AISM.AISMUserList[DataTable.TableIndex] or AISM.GroupMemberData[DataTable.TableIndex]))then - InspectArmory_UnitPopup.CreateDropDownButton(Button, DataTable) + _G["InspectArmory_UnitPopup"].CreateDropDownButton(Button, DataTable) end end end) @@ -1423,14 +1463,14 @@ end function IA:INSPECT_HONOR_UPDATE() if self == 'INSPECT_HONOR_UPDATE' or HasInspectHonorData() then - for i, Type in pairs({ '2vs2', '3vs3', '5vs5' }) do + for i, Type in T.pairs({ '2vs2', '3vs3', '5vs5' }) do IA.CurrentInspectData.PvP[Type] = { GetInspectArenaData(i) } for i = 4, #IA.CurrentInspectData.PvP[Type] do IA.CurrentInspectData.PvP[Type][i] = nil end end IA.CurrentInspectData.PvP.RB = { GetInspectRatedBGData() } - IA.CurrentInspectData.PvP.Honor = select(5, GetInspectHonorData()) + IA.CurrentInspectData.PvP.Honor = T.select(5, GetInspectHonorData()) end if not IA.ForbidUpdatePvPInformation then @@ -1442,11 +1482,11 @@ end function IA:INSPECT_READY(InspectedUnitGUID) local TableIndex = IA.CurrentInspectData.Name..(IA.CurrentInspectData.Realm and '-'..IA.CurrentInspectData.Realm or '') local UnitID = TableIndex - local Name, Realm = UnitFullName(UnitID) + local Name, Realm = T.UnitFullName(UnitID) if not Name then UnitID = IA.CurrentInspectData.UnitID - Name, Realm = UnitFullName(UnitID) + Name, Realm = T.UnitFullName(UnitID) end if not Name then @@ -1464,14 +1504,14 @@ function IA:INSPECT_READY(InspectedUnitGUID) local NeedReinspect local CurrentSetItem = {} local Slot, SlotTexture, SlotLink, CheckSpace, R, G, B, TooltipText, TransmogrifiedItem, SetName, SetItemCount, SetItemMax, SetOptionCount - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do Slot = IA[SlotName] IA.CurrentInspectData.Gear[SlotName] = {} SlotTexture = GetInventoryItemTexture(UnitID, Slot.ID) if SlotTexture and SlotTexture..'.blp' ~= Slot.EmptyTexture then - SlotLink = GetInventoryItemLink(UnitID, Slot.ID) + SlotLink = T.GetInventoryItemLink(UnitID, Slot.ID) if not SlotLink then NeedReinspect = true @@ -1489,7 +1529,7 @@ function IA:INSPECT_READY(InspectedUnitGUID) TooltipText = _G["InspectArmoryScanTT_ITextLeft"..i]:GetText() if not TransmogrifiedItem and TooltipText:match(TRANSMOGRIFIED_HEADER) then -- TooltipText:match(Info.Armory_Constants.TransmogrifiedKey) - if type(IA.CurrentInspectData.Gear[SlotName].Transmogrify) ~= 'number' then + if T.type(IA.CurrentInspectData.Gear[SlotName].Transmogrify) ~= 'number' then IA.CurrentInspectData.Gear[SlotName].Transmogrify = _G["InspectArmoryScanTT_ITextLeft"..(i + 1)]:GetText() --TooltipText:match(Info.Armory_Constants.TransmogrifiedKey) end @@ -1498,8 +1538,8 @@ function IA:INSPECT_READY(InspectedUnitGUID) SetName, SetItemCount, SetItemMax = TooltipText:match('^(.+) %((%d)/(%d)%)$') -- find string likes 'SetName (0/5)' if SetName then - SetItemCount = tonumber(SetItemCount) - SetItemMax = tonumber(SetItemMax) + SetItemCount = T.tonumber(SetItemCount) + SetItemMax = T.tonumber(SetItemMax) if (SetItemCount > SetItemMax or SetItemMax == 1) then NeedReinspect = true @@ -1558,7 +1598,7 @@ function IA:INSPECT_READY(InspectedUnitGUID) end if IA.CurrentInspectData.SetItem then - for SetName in pairs(IA.CurrentInspectData.SetItem) do + for SetName in T.pairs(IA.CurrentInspectData.SetItem) do if not CurrentSetItem[SetName] then IA.CurrentInspectData.SetItem[SetName] = nil end @@ -1570,7 +1610,7 @@ function IA:INSPECT_READY(InspectedUnitGUID) local TalentID, isSelected for i = 1, MAX_TALENT_TIERS do for k = 1, NUM_TALENT_COLUMNS do - TalentID, _, _, isSelected = GetTalentInfo(i, k, 1, true, UnitID) + TalentID, _, _, isSelected = T.GetTalentInfo(i, k, 1, true, UnitID) IA.CurrentInspectData.Specialization[1]["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)] = { TalentID, isSelected } end @@ -1597,30 +1637,30 @@ end IA.InspectUnit = function(UnitID, Properties) - if UnitID == 'mouseover' and not UnitExists('mouseover') and UnitExists('target') then + if UnitID == 'mouseover' and not T.UnitExists('mouseover') and T.UnitExists('target') then UnitID = 'target' end - if not UnitIsPlayer(UnitID) then + if not T.UnitIsPlayer(UnitID) then return - elseif UnitIsDeadOrGhost('player') then + elseif T.UnitIsDeadOrGhost('player') then print(L["KF"]..' : '..L["You can't inspect while dead."]) return - elseif not UnitIsVisible(UnitID) then + elseif not T.UnitIsVisible(UnitID) then return else UnitID = NotifyInspect(UnitID, Properties) or UnitID - wipe(IA.CurrentInspectData) + T.twipe(IA.CurrentInspectData) E:CopyTable(IA.CurrentInspectData, IA.Default_CurrentInspectData) IA.CurrentInspectData.UnitID = UnitID - IA.CurrentInspectData.Title = UnitPVPName(UnitID) - IA.CurrentInspectData.Level = UnitLevel(UnitID) - IA.CurrentInspectData.Name, IA.CurrentInspectData.Realm = UnitFullName(UnitID) - _, IA.CurrentInspectData.Class, IA.CurrentInspectData.ClassID = UnitClass(UnitID) - IA.CurrentInspectData.guildName, IA.CurrentInspectData.guildRankName = GetGuildInfo(UnitID) + IA.CurrentInspectData.Title = T.UnitPVPName(UnitID) + IA.CurrentInspectData.Level = T.UnitLevel(UnitID) + IA.CurrentInspectData.Name, IA.CurrentInspectData.Realm = T.UnitFullName(UnitID) + _, IA.CurrentInspectData.Class, IA.CurrentInspectData.ClassID = T.UnitClass(UnitID) + IA.CurrentInspectData.guildName, IA.CurrentInspectData.guildRankName = T.GetGuildInfo(UnitID) IA.CurrentInspectData.Realm = IA.CurrentInspectData.Realm ~= '' and IA.CurrentInspectData.Realm ~= Info.MyRealm and IA.CurrentInspectData.Realm or nil @@ -1639,8 +1679,8 @@ function IA:ShowFrame(DataTable) self.GET_ITEM_INFO_RECEIVED = nil self:UnregisterEvent('GET_ITEM_INFO_RECEIVED') - for _, SlotName in pairs(Info.Armory_Constants.GearList) do - if DataTable.Gear[SlotName] and DataTable.Gear[SlotName].ItemLink and not GetItemInfo(DataTable.Gear[SlotName].ItemLink) then + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do + if DataTable.Gear[SlotName] and DataTable.Gear[SlotName].ItemLink and not T.GetItemInfo(DataTable.Gear[SlotName].ItemLink) then if not self.GET_ITEM_INFO_RECEIVED then self.GET_ITEM_INFO_RECEIVED = function() self:ShowFrame(DataTable) end end @@ -1659,7 +1699,7 @@ function IA:ShowFrame(DataTable) self.Updater:Hide() self:InspectFrame_PvPSetting(DataTable) - ShowUIPanel(InspectArmory) + ShowUIPanel(_G["InspectArmory"]) end end) end @@ -1673,7 +1713,7 @@ function IA:InspectFrame_DataSetting(DataTable) local ItemData, ItemRarity, BasicItemLevel, TrueItemLevel, ItemUpgradeID, ItemType, ItemTexture, CurrentLineText, GemCount_Default, GemCount_Enable, GemCount_Now, GemCount -- Setting except shirt and tabard - for _, SlotName in pairs(type(self.GearUpdated) == 'table' and self.GearUpdated or Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(T.type(self.GearUpdated) == 'table' and self.GearUpdated or Info.Armory_Constants.GearList) do Slot = self[SlotName] ErrorDetected, ItemRarity, ItemTexture, R, G, B = nil, nil, nil, 0, 0, 0 @@ -1706,11 +1746,11 @@ function IA:InspectFrame_DataSetting(DataTable) end if DataTable.Gear[SlotName].ItemLink then - _, Slot.Link = GetItemInfo(DataTable.Gear[SlotName].ItemLink) + _, Slot.Link = T.GetItemInfo(DataTable.Gear[SlotName].ItemLink) if Slot.Link then do --<< Gem Parts >>-- - ItemData = { strsplit(':', Slot.Link) } + ItemData = { T.split(':', Slot.Link) } ItemData[4], ItemData[5], ItemData[6], ItemData[7] = 0, 0, 0, 0 for i = 1, #ItemData do @@ -1728,7 +1768,7 @@ function IA:InspectFrame_DataSetting(DataTable) if ItemTexture and ItemTexture:find('Interface\\ItemSocketingFrame\\') then GemCount_Default = GemCount_Default + 1 - Slot["Socket"..GemCount_Default].GemType = strupper(gsub(ItemTexture, 'Interface\\ItemSocketingFrame\\UI--EmptySocket--', '')) + Slot["Socket"..GemCount_Default].GemType = T.upper(gsub(ItemTexture, 'Interface\\ItemSocketingFrame\\UI--EmptySocket--', '')) end end @@ -1751,7 +1791,7 @@ function IA:InspectFrame_DataSetting(DataTable) ItemTexture = _G["InspectArmoryScanTTTexture"..i]:GetTexture() if Slot["Socket"..i].GemType and Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType] then - R, G, B = unpack(Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType]) + R, G, B = T.unpack(Info.Armory_Constants.GemColor[Slot["Socket"..i].GemType]) Slot["Socket"..i].Socket:SetBackdropColor(R, G, B, 0.5) Slot["Socket"..i].Socket:SetBackdropBorderColor(R, G, B) else @@ -1759,7 +1799,7 @@ function IA:InspectFrame_DataSetting(DataTable) Slot["Socket"..i].Socket:SetBackdropBorderColor(1, 1, 1) end - CurrentLineText = select(2, _G["InspectArmoryScanTTTexture"..i]:GetPoint()) + CurrentLineText = T.select(2, _G["InspectArmoryScanTTTexture"..i]:GetPoint()) CurrentLineText = DataTable.Gear[SlotName]["Gem"..i] or CurrentLineText ~= self.ScanTT and CurrentLineText.GetText and CurrentLineText:GetText():gsub('|cff......', ''):gsub('|r', '') or nil if CurrentLineText then @@ -1770,7 +1810,7 @@ function IA:InspectFrame_DataSetting(DataTable) GemCount_Now = GemCount_Now + 1 - ItemTexture = ItemTexture or DataTable.Gear[SlotName]["Gem"..i] and select(10, GetItemInfo(DataTable.Gear[SlotName]["Gem"..i])) or nil + ItemTexture = ItemTexture or DataTable.Gear[SlotName]["Gem"..i] and T.select(10, T.GetItemInfo(DataTable.Gear[SlotName]["Gem"..i])) or nil if not ItemTexture then NeedUpdate = true @@ -1787,8 +1827,8 @@ function IA:InspectFrame_DataSetting(DataTable) end end - _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = GetItemInfo(Slot.Link) - R, G, B = GetItemQualityColor(ItemRarity) + _, _, ItemRarity, BasicItemLevel, _, _, _, _, ItemType, ItemTexture = T.GetItemInfo(Slot.Link) + R, G, B = T.GetItemQualityColor(ItemRarity) ItemUpgradeID = Slot.Link:match(":(%d+)\124h%[") @@ -1797,9 +1837,9 @@ function IA:InspectFrame_DataSetting(DataTable) CurrentLineText = _G["InspectArmoryScanTTTextLeft"..i]:GetText() if CurrentLineText:find(Info.Armory_Constants.ItemLevelKey_Alt) then - TrueItemLevel = tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) + TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey_Alt)) elseif CurrentLineText:find(Info.Armory_Constants.ItemLevelKey) then - TrueItemLevel = tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) + TrueItemLevel = T.tonumber(CurrentLineText:match(Info.Armory_Constants.ItemLevelKey)) elseif CurrentLineText:find(Info.Armory_Constants.EnchantKey) then if E.db.sle.Armory.Inspect.Enchant.Display ~= 'Hide' then CurrentLineText = CurrentLineText:match(Info.Armory_Constants.EnchantKey) -- Get enchant string @@ -1811,13 +1851,13 @@ function IA:InspectFrame_DataSetting(DataTable) CurrentLineText = gsub(CurrentLineText, ITEM_MOD_CRIT_RATING_SHORT, CRIT_ABBR) -- Critical is too long CurrentLineText = gsub(CurrentLineText, ' + ', '+') -- Remove space - if L.Armory_ReplaceEnchantString and type(L.Armory_ReplaceEnchantString) == 'table' then - for Old, New in pairs(L.Armory_ReplaceEnchantString) do + if L.Armory_ReplaceEnchantString and T.type(L.Armory_ReplaceEnchantString) == 'table' then + for Old, New in T.pairs(L.Armory_ReplaceEnchantString) do CurrentLineText = gsub(CurrentLineText, Old, New) end end - for Name, _ in pairs(SLE_ArmoryDB.EnchantString) do + for Name, _ in T.pairs(SLE_ArmoryDB.EnchantString) do if SLE_ArmoryDB.EnchantString[Name].original and SLE_ArmoryDB.EnchantString[Name].new then CurrentLineText = gsub(CurrentLineText, SLE_ArmoryDB.EnchantString[Name].original, SLE_ArmoryDB.EnchantString[Name].new) end @@ -1904,7 +1944,7 @@ function IA:InspectFrame_DataSetting(DataTable) if Slot.TransmogrifyAnchor then --<< Transmogrify Parts >>-- Slot.TransmogrifyAnchor.Link = DataTable.Gear[SlotName].Transmogrify ~= 'NotDisplayed' and DataTable.Gear[SlotName].Transmogrify or nil - if type(Slot.TransmogrifyAnchor.Link) == 'number' then + if T.type(Slot.TransmogrifyAnchor.Link) == 'number' then Slot.TransmogrifyAnchor:Show() end end @@ -1923,10 +1963,10 @@ function IA:InspectFrame_DataSetting(DataTable) Slot.Link = DataTable.Gear[SlotName].ItemLink if Slot.Link then - _, _, ItemRarity, _, _, _, _, _, _, ItemTexture = GetItemInfo(Slot.Link) + _, _, ItemRarity, _, _, _, _, _, _, ItemTexture = T.GetItemInfo(Slot.Link) if ItemRarity then - R, G, B = GetItemQualityColor(ItemRarity) + R, G, B = T.GetItemQualityColor(ItemRarity) else NeedUpdateList = NeedUpdateList or {} NeedUpdateList[#NeedUpdateList + 1] = SlotName @@ -1947,7 +1987,7 @@ function IA:InspectFrame_DataSetting(DataTable) Slot.Gradation.Texture:SetVertexColor(1, 0, 0) Slot.Gradation.Texture:Show() else - Slot.Gradation.Texture:SetVertexColor(unpack(E.db.sle.Armory.Inspect.Gradation.Color)) + Slot.Gradation.Texture:SetVertexColor(T.unpack(E.db.sle.Armory.Inspect.Gradation.Color)) end Slot:SetBackdropBorderColor(R, G, B) end @@ -1963,7 +2003,7 @@ function IA:InspectFrame_DataSetting(DataTable) self.GearUpdated = nil do --<< Average ItemLevel >>-- - for _, SlotName in pairs(self.GearUpdated or Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(self.GearUpdated or Info.Armory_Constants.GearList) do if SlotName ~= 'ShirtSlot' and SlotName ~= 'TabardSlot' then Slot = self[SlotName] @@ -1980,7 +2020,7 @@ function IA:InspectFrame_DataSetting(DataTable) do --<< Basic Information >>-- local Realm = DataTable.Realm and DataTable.Realm ~= Info.MyRealm and DataTable.Realm or '' - local Title = DataTable.Title and string.gsub(DataTable.Title, DataTable.Name, '') or '' + local Title = DataTable.Title and gsub(DataTable.Title, DataTable.Name, '') or '' self.Title:SetText(Realm..(Realm ~= '' and Title ~= '' and ' / ' or '')..(Title ~= '' and '|cff93daff'..Title or '')) self.Guild:SetText(DataTable.guildName and '<|cff2eb7e4'..DataTable.guildName..'|r> [|cff2eb7e4'..DataTable.guildRankName..'|r]' or '') @@ -2047,7 +2087,7 @@ function IA:InspectFrame_DataSetting(DataTable) Name = nil if DataTable.Specialization[groupNum].SpecializationID and DataTable.Specialization[groupNum].SpecializationID ~= 0 then - _, Name, _, Texture = GetSpecializationInfoByID(DataTable.Specialization[groupNum].SpecializationID) + _, Name, _, Texture = T.GetSpecializationInfoByID(DataTable.Specialization[groupNum].SpecializationID) if Name then if Info.ClassRole[DataTable.Class][Name] then @@ -2077,7 +2117,7 @@ function IA:InspectFrame_DataSetting(DataTable) end do --<< Model and Frame Setting When InspectUnit Changed >>-- - if DataTable.UnitID and UnitIsVisible(DataTable.UnitID) and self.NeedModelSetting then + if DataTable.UnitID and T.UnitIsVisible(DataTable.UnitID) and self.NeedModelSetting then self.Model:SetUnit(DataTable.UnitID) self.Character.Message = nil @@ -2088,8 +2128,8 @@ function IA:InspectFrame_DataSetting(DataTable) self.Model:TryOn(BackSlotItem) self.Model:Undress() - for _, SlotName in pairs(Info.Armory_Constants.GearList) do - if type(DataTable.Gear[SlotName].Transmogrify) == 'number' then + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do + if T.type(DataTable.Gear[SlotName].Transmogrify) == 'number' then self.Model:TryOn(DataTable.Gear[SlotName].Transmogrify) elseif DataTable.Gear[SlotName].ItemLink and not (DataTable.Gear[SlotName].Transmogrify and DataTable.Gear[SlotName].Transmogrify == 'NotDisplayed') then self.Model:TryOn(DataTable.Gear[SlotName].ItemLink) @@ -2105,7 +2145,7 @@ function IA:InspectFrame_DataSetting(DataTable) if not (self.LastDataSetting and self.LastDataSetting == DataTable.Name..(DataTable.Realm and '-'..DataTable.Realm or '')) and DataTable.Level and DataTable.Race then --<< Initialize Inspect Page >>-- self.Name:SetText('|c'..RAID_CLASS_COLORS[DataTable.Class].colorStr..DataTable.Name) - self.LevelRace:SetText(format('|cff%02x%02x%02x%s|r '..LEVEL..'|n%s', GetQuestDifficultyColor(DataTable.Level).r * 255, GetQuestDifficultyColor(DataTable.Level).g * 255, GetQuestDifficultyColor(DataTable.Level).b * 255, DataTable.Level, DataTable.Race)) + self.LevelRace:SetText(format('|cff%02x%02x%02x%s|r '..LEVEL..'|n%s', T.GetQuestDifficultyColor(DataTable.Level).r * 255, T.GetQuestDifficultyColor(DataTable.Level).g * 255, T.GetQuestDifficultyColor(DataTable.Level).b * 255, DataTable.Level, DataTable.Race)) self.ClassIcon:SetTexture('Interface\\ICONS\\ClassIcon_'..DataTable.Class) self.Model:SetPosition(self.ModelList[DataTable.RaceID][DataTable.GenderID] and self.ModelList[DataTable.RaceID][DataTable.GenderID].z or 0, self.ModelList[DataTable.RaceID][DataTable.GenderID] and self.ModelList[DataTable.RaceID][DataTable.GenderID].x or 0, self.ModelList[DataTable.RaceID][DataTable.GenderID] and self.ModelList[DataTable.RaceID][DataTable.GenderID].y or 0) @@ -2152,7 +2192,7 @@ function IA:InspectFrame_PvPSetting(DataTable) local Rating, Played, Won local NeedExpand = 0 - for _, Type in pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do + for _, Type in T.pairs({ '2vs2', '3vs3', '5vs5', 'RB' }) do if DataTable.PvP[Type] and DataTable.PvP[Type][2] > 0 then Rating = DataTable.PvP[Type][1] or 0 Played = DataTable.PvP[Type][2] or 0 @@ -2214,7 +2254,7 @@ function IA:ReArrangeCategory() local InfoPage_Height = 0 local PrevCategory - for _, CategoryType in pairs(self.InfoPageCategoryList) do + for _, CategoryType in T.pairs(self.InfoPageCategoryList) do if self.Info[CategoryType]:IsShown() then if self.Info[CategoryType].Closed then self.Info[CategoryType].Page:Hide() @@ -2273,12 +2313,12 @@ function IA:ToggleSpecializationTab(Group, DataTable) self.Spec.RightBorder:SetTexture(R, G, B) local LevelTable = CLASS_TALENT_LEVELS[DataTable.Class] or CLASS_TALENT_LEVELS.DEFAULT - + local TalentID, Name, Texture for i = 1, MAX_TALENT_TIERS do for k = 1, NUM_TALENT_COLUMNS do if DataTable.Specialization then if DataTable.Specialization[Group]["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)][1] then - TalentID, Name, Texture = GetTalentInfoByID(DataTable.Specialization[Group]["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)][1], 1) + TalentID, Name, Texture = T.GetTalentInfoByID(DataTable.Specialization[Group]["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)][1], 1) end if TalentID and Name and Texture then self.Spec["Talent"..((i - 1) * NUM_TALENT_COLUMNS + k)].Icon.Texture:SetTexture(Texture) @@ -2342,7 +2382,7 @@ function IA:Update_Display(Force) local Slot, Mouseover, SocketVisible if (self:IsMouseOver() and (E.db.sle.Armory.Inspect.Level.Display == 'MouseoverOnly' or E.db.sle.Armory.Inspect.Enchant.Display == 'MouseoverOnly' or E.db.sle.Armory.Inspect.Gem.Display == 'MouseoverOnly')) or Force then - for _, SlotName in pairs(Info.Armory_Constants.GearList) do + for _, SlotName in T.pairs(Info.Armory_Constants.GearList) do Slot = self[SlotName] Mouseover = Slot.Gradation:IsMouseOver() diff --git a/ElvUI_SLE/modules/Armory/InspectArmory/NotifyInspect.lua b/ElvUI_SLE/modules/Armory/InspectArmory/NotifyInspect.lua index cd0a07d..8382a87 100644 --- a/ElvUI_SLE/modules/Armory/InspectArmory/NotifyInspect.lua +++ b/ElvUI_SLE/modules/Armory/InspectArmory/NotifyInspect.lua @@ -1,7 +1,13 @@ -local Revision = 1.6 +local SLE, T, E, L, V, P, G = unpack(select(2, ...)) +local Revision = 1.6 local _G = _G +local _ local ENI = _G["EnhancedNotifyInspect"] or CreateFrame('Frame', 'EnhancedNotifyInspect', UIParent) +local GetPlayerInfoByGUID = GetPlayerInfoByGUID +local RequestInspectHonorData = RequestInspectHonorData +local C_TimerNewTicker = C_Timer.NewTicker + if not ENI.Revision or ENI.Revision < Revision then ENI.InspectList = {} ENI.Revision = Revision @@ -19,7 +25,7 @@ if not ENI.Revision or ENI.Revision < Revision then end) ENI:SetScript('OnUpdate', function(self) if not self.HoldInspecting then - self.NowInspecting = C_Timer.NewTicker(self.UpdateInterval, self.TryInspect) + self.NowInspecting = C_TimerNewTicker(self.UpdateInterval, self.TryInspect) self:Hide() end end) @@ -34,8 +40,8 @@ if not ENI.Revision or ENI.Revision < Revision then UnitID = ENI.InspectList[(ENI.InspectList[i])].UnitID Count = ENI.InspectList[(ENI.InspectList[i])].InspectTryCount - if UnitID and UnitIsConnected(UnitID) and CanInspect(UnitID) and not (Count and Count <= 0) then - ENI.CurrentInspectUnitGUID = UnitGUID(UnitID) + if UnitID and T.UnitIsConnected(UnitID) and T.CanInspect(UnitID) and not (Count and Count <= 0) then + ENI.CurrentInspectUnitGUID = T.UnitGUID(UnitID) if Count then ENI.InspectList[(ENI.InspectList[i])].InspectTryCount = ENI.InspectList[(ENI.InspectList[i])].InspectTryCount - 1 @@ -68,38 +74,38 @@ if not ENI.Revision or ENI.Revision < Revision then } ]] ENI.NotifyInspect = function(Unit, Properties) - if Unit ~= 'target' and UnitIsUnit(Unit, 'target') then + if Unit ~= 'target' and T.UnitIsUnit(Unit, 'target') then Unit = 'target' end - if Unit ~= 'focus' and UnitIsUnit(Unit, 'focus') then + if Unit ~= 'focus' and T.UnitIsUnit(Unit, 'focus') then Unit = 'focus' end - if UnitInParty(Unit) or UnitInRaid(Unit) then - Unit = GetUnitName(Unit, true) + if T.UnitInParty(Unit) or T.UnitInRaid(Unit) then + Unit = T.GetUnitName(Unit, true) end - if UnitIsPlayer(Unit) and CanInspect(Unit) then - local TableIndex = GetUnitName(Unit, true) - local Check = not (Properties and type(Properties) == 'table' and Properties.Reservation) + if T.UnitIsPlayer(Unit) and T.CanInspect(Unit) then + local TableIndex = T.GetUnitName(Unit, true) + local Check = not (Properties and T.type(Properties) == 'table' and Properties.Reservation) if not ENI.InspectList[TableIndex] then if Check then - tinsert(ENI.InspectList, 1, TableIndex) + T.tinsert(ENI.InspectList, 1, TableIndex) else - tinsert(ENI.InspectList, TableIndex) + T.tinsert(ENI.InspectList, TableIndex) end ENI.InspectList[TableIndex] = { UnitID = Unit } - if Properties and type(Properties) == 'table' then + if Properties and T.type(Properties) == 'table' then ENI.InspectList[TableIndex].InspectTryCount = Properties.InspectTryCount ENI.InspectList[TableIndex].CancelInspectByManual = Properties.CancelInspectByManual end if not ENI.HoldInspecting and (not ENI.NowInspecting or ENI.NowInspecting._cancelled) then - ENI.NowInspecting = C_Timer.NewTicker(ENI.UpdateInterval, ENI.TryInspect) + ENI.NowInspecting = C_TimerNewTicker(ENI.UpdateInterval, ENI.TryInspect) elseif ENI.HoldInspecting then ENI:Show() end @@ -116,7 +122,7 @@ if not ENI.Revision or ENI.Revision < Revision then if ENI.InspectList[Unit] then for i = 1, #ENI.InspectList do if ENI.InspectList[i] == Unit and not (Canceller and ENI.InspectList[Unit].CancelInspectByManual and ENI.InspectList[Unit].CancelInspectByManual ~= Canceller) then - tremove(ENI.InspectList, i) + T.tremove(ENI.InspectList, i) ENI.InspectList[Unit] = nil return diff --git a/ElvUI_SLE/modules/Armory/KnightFrame.lua b/ElvUI_SLE/modules/Armory/KnightFrame.lua index b5bd3d2..18825cb 100644 --- a/ElvUI_SLE/modules/Armory/KnightFrame.lua +++ b/ElvUI_SLE/modules/Armory/KnightFrame.lua @@ -1,5 +1,8 @@ local E, L, V, P, G = unpack(ElvUI) +--GLOBALS: SLE_ArmoryDB +local _ local _G = _G +local RAID_CLASS_COLORS = RAID_CLASS_COLORS if not (select(2, GetAddOnInfo('ElvUI_KnightFrame')) and IsAddOnLoaded('ElvUI_KnightFrame')) then --<< INITIALIZE >>--