From e6f99c74fdacab4d9aaf7c29e37ec6e7ad044969 Mon Sep 17 00:00:00 2001 From: Repooc Date: Fri, 17 Oct 2014 21:56:39 -0400 Subject: [PATCH] Some changes to armory mode (some things need to updated still) --- .../modules/characterframe/characterframe.lua | 489 ++++++++++---------- ElvUI_SLE/modules/characterframe/communication.lua | 60 +-- ElvUI_SLE/modules/characterframe/inspectframe.lua | 314 ++++++------- 3 files changed, 434 insertions(+), 429 deletions(-) diff --git a/ElvUI_SLE/modules/characterframe/characterframe.lua b/ElvUI_SLE/modules/characterframe/characterframe.lua index 2d0b54b..25a6a38 100644 --- a/ElvUI_SLE/modules/characterframe/characterframe.lua +++ b/ElvUI_SLE/modules/characterframe/characterframe.lua @@ -4,6 +4,10 @@ local LSM = LibStub("LibSharedMedia-3.0") local CA = CreateFrame('Frame', 'CharacterArmory', PaperDollFrame) local SlotIDList = {} + +CA.elapsed = 0 +CA.Delay_Updater = .5 + local C = SLArmoryConstants local backgrounds = { ["SPACE"] = "Space", @@ -157,12 +161,9 @@ function CA:Setup_CharacterArmory() self:SetScript('OnUpdate', self.CharacterArmory_DataSetting) end end) - hooksecurefunc('CharacterFrame_Collapse', function() - CharacterFrame:SetWidth(PaperDollFrame:IsShown() and 448 or PANEL_DEFAULT_WIDTH) - end) - hooksecurefunc('CharacterFrame_Expand', function() - CharacterFrame:SetWidth(650); - end) + hooksecurefunc('CharacterFrame_Collapse', function() CharacterFrame:SetWidth(PaperDollFrame:IsShown() and 448 or PANEL_DEFAULT_WIDTH) end) + hooksecurefunc('CharacterFrame_Expand', function() CharacterFrame:SetWidth(650); end) + hooksecurefunc('ToggleCharacter', function(frameType) if frameType ~= 'PaperDollFrame' then CharacterFrame:SetWidth(PANEL_DEFAULT_WIDTH) end end) hooksecurefunc('PaperDollFrame_SetLevel', function() CharacterLevelText:SetText('|c'..RAID_CLASS_COLORS[E.myclass].colorStr..CharacterLevelText:GetText()) @@ -174,11 +175,6 @@ function CA:Setup_CharacterArmory() CharacterLevelText:SetPoint('TOP', CharacterFrameTitleText, 'BOTTOM', 0, 3) CharacterLevelText:SetParent(self) end) - hooksecurefunc('ToggleCharacter', function(frameType) - if frameType ~= 'PaperDollFrame' then - CharacterFrame:SetWidth(PANEL_DEFAULT_WIDTH) - end - end) --hooksecurefunc('CharacterFrame_Collapse', function() if Info.CharacterArmory_Activate then CharacterFrame:SetWidth(448) end end) --hooksecurefunc('CharacterFrame_Expand', function() if Info.CharacterArmory_Activate then CharacterFrame:SetWidth(650) end end) --hooksecurefunc('PaperDollFrame_SetLevel', function() @@ -313,33 +309,35 @@ function CA:Setup_CharacterArmory() self.ScanTT = CreateFrame('GameTooltip', 'SLE_CharacterArmory_ScanTT', nil, 'GameTooltipTemplate') self.ScanTT:SetOwner(UIParent, 'ANCHOR_NONE') - -- For resizing paper doll frame when it toggled. - self.ChangeCharacterFrameWidth = CreateFrame('Frame') - self.ChangeCharacterFrameWidth:SetScript('OnShow', function() - if PaperDollFrame:IsVisible() then - self:CharacterArmory_DataSetting() - end - end) - self.Setup_CharacterArmory = nil end -local needUpdate -function CA:CharacterArmory_DataSetting() - if not self:IsVisible() then return end - - needUpdate = nil +function CA:CharacterArmory_DataSetting(elapsed) + self.elapsed = self.elapsed + (elapsed or .1) - if not self.DurabilityUpdated then - needUpdate = self:Update_Durability() or needUpdate - end - - if self.GearUpdated ~= true then - needUpdate = self:Update_Gear() or needUpdate - end - - if not needUpdate then - self:SetScript('OnUpdate', nil) + if self.elapsed > 0 then + self.elapsed = -self.Delay_Updater + self.needUpdate = nil + + if not self.DurabilityUpdated then + self.needUpdate = self:Update_Durability() or self.needUpdate + end + + if self.GearUpdated ~= true then + self.needUpdate = self:Update_Gear() or self.needUpdate + end + + if not self.needUpdate and self:IsShown() then + self.elapsed = 0 + self:SetScript('OnUpdate', nil) + elseif self.needUpdate then + self:SetScript('OnShow', function() + self.elapsed = 0 + self:CharacterArmory_DataSetting() + self:SetScript('OnShow', nil) + end) + self:SetScript('OnUpdate', self.CharacterArmory_DataSetting) + end end end @@ -377,8 +375,6 @@ function CA:ClearTooltip(tooltip) end function CA:Update_Gear() - --if not CA:IsVisible() then return end - --print("yep") -- Get Player Profession local Prof1, Prof2 = GetProfessions() local Prof1_Level, Prof2_Level = 0, 0 @@ -422,247 +418,252 @@ function CA:Update_Gear() end if ItemLink then - do --<< Gem Parts >>-- - ItemData = { strsplit(':', ItemLink) } - ItemData[4], ItemData[5], ItemData[6], ItemData[7] = 0, 0, 0, 0 + if not ItemLink:find('%[%]') then + do --<< Gem Parts >>-- + ItemData = { strsplit(':', ItemLink) } + ItemData[4], ItemData[5], ItemData[6], ItemData[7] = 0, 0, 0, 0 - for i = 1, #ItemData do - ItemData.FixedLink = (ItemData.FixedLink and ItemData.FixedLink..':' or '')..ItemData[i] - end + for i = 1, #ItemData do + ItemData.FixedLink = (ItemData.FixedLink and ItemData.FixedLink..':' or '')..ItemData[i] + end - self:ClearTooltip(self.ScanTT) - self.ScanTT:SetHyperlink(ItemData.FixedLink) + self:ClearTooltip(self.ScanTT) + self.ScanTT:SetHyperlink(ItemData.FixedLink) - GemCount_Default, GemCount_Now, GemCount = 0, 0, 0 + GemCount_Default, GemCount_Now, GemCount = 0, 0, 0 - -- First, Counting default gem sockets - for i = 1, MAX_NUM_SOCKETS do - ItemTexture = _G['SLE_CharacterArmory_ScanTTTexture'..i]:GetTexture() + -- First, Counting default gem sockets + for i = 1, MAX_NUM_SOCKETS do + ItemTexture = _G['SLE_CharacterArmory_ScanTTTexture'..i]:GetTexture() - 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--', '')) + 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--', '')) + end end - end - -- Second, Check if slot's item enable to adding a socket - GemCount_Enable = GemCount_Default - if (slotName == 'WaistSlot' and UnitLevel('player') >= 70) or -- buckle - ((slotName == 'WristSlot' or slotName == 'HandsSlot') and self.PlayerProfession.BlackSmithing and self.PlayerProfession.BlackSmithing >= 550) then -- BlackSmith - - GemCount_Enable = GemCount_Enable + 1 - Slot['Socket'..GemCount_Enable].GemType = 'PRISMATIC' - end + -- Second, Check if slot's item enable to adding a socket + GemCount_Enable = GemCount_Default + if (slotName == 'WaistSlot' and UnitLevel('player') >= 70) or -- buckle + ((slotName == 'WristSlot' or slotName == 'HandsSlot') and self.PlayerProfession.BlackSmithing and self.PlayerProfession.BlackSmithing >= 550) then -- BlackSmith - self:ClearTooltip(self.ScanTT) - self.ScanTT:SetInventoryItem('player', Slot.ID) - - -- Apply current item's gem setting - for i = 1, MAX_NUM_SOCKETS do - ItemTexture = _G['SLE_CharacterArmory_ScanTTTexture'..i]:GetTexture() - GemID = select(i, GetInventoryItemGems(Slot.ID)) - - if Slot['Socket'..i].GemType and C.GemColor[Slot['Socket'..i].GemType] then - r, g, b = unpack(C.GemColor[Slot['Socket'..i].GemType]) - Slot['Socket'..i].Socket:SetBackdropColor(r, g, b, .5) - Slot['Socket'..i].Socket:SetBackdropBorderColor(r, g, b) - else - Slot['Socket'..i].Socket:SetBackdropColor(1, 1, 1, .5) - Slot['Socket'..i].Socket:SetBackdropBorderColor(1, 1, 1) + GemCount_Enable = GemCount_Enable + 1 + Slot['Socket'..GemCount_Enable].GemType = 'PRISMATIC' end - if ItemTexture or GemID then - if E.db.sle.characterframeoptions.itemgem.show then - Slot['Socket'..i]:Show() - Slot.SocketWarning:Point(Slot.Direction, Slot['Socket'..i], (Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT'), Slot.Direction == 'LEFT' and 3 or -3, 0) + self:ClearTooltip(self.ScanTT) + self.ScanTT:SetInventoryItem('player', Slot.ID) + + -- Apply current item's gem setting + for i = 1, MAX_NUM_SOCKETS do + ItemTexture = _G['SLE_CharacterArmory_ScanTTTexture'..i]:GetTexture() + GemID = select(i, GetInventoryItemGems(Slot.ID)) + + if Slot['Socket'..i].GemType and C.GemColor[Slot['Socket'..i].GemType] then + r, g, b = unpack(C.GemColor[Slot['Socket'..i].GemType]) + Slot['Socket'..i].Socket:SetBackdropColor(r, g, b, .5) + Slot['Socket'..i].Socket:SetBackdropBorderColor(r, g, b) else - Slot['Socket'..i]:Hide() - Slot.SocketWarning:Point(Slot.Direction, Slot['Socket1'], (Slot.Direction == 'LEFT' and 'LEFT' or 'RIGHT'), 0, 0) + Slot['Socket'..i].Socket:SetBackdropColor(1, 1, 1, .5) + Slot['Socket'..i].Socket:SetBackdropBorderColor(1, 1, 1) end - GemCount_Now = GemCount_Now + 1 + if ItemTexture or GemID then + if E.db.sle.characterframeoptions.itemgem.show then + Slot['Socket'..i]:Show() + Slot.SocketWarning:Point(Slot.Direction, Slot['Socket'..i], (Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT'), Slot.Direction == 'LEFT' and 3 or -3, 0) + else + Slot['Socket'..i]:Hide() + Slot.SocketWarning:Point(Slot.Direction, Slot['Socket1'], (Slot.Direction == 'LEFT' and 'LEFT' or 'RIGHT'), 0, 0) + end + + GemCount_Now = GemCount_Now + 1 - if GemID then - GemCount = GemCount + 1 - Slot['Socket'..i].GemItemID = GemID + if GemID then + GemCount = GemCount + 1 + Slot['Socket'..i].GemItemID = GemID - _, Slot['Socket'..i].Socket.Link, _, _, _, _, _, _, _, ItemTexture = GetItemInfo(GemID) + _, Slot['Socket'..i].Socket.Link, _, _, _, _, _, _, _, ItemTexture = GetItemInfo(GemID) - if ItemTexture then - Slot['Socket'..i].Texture:SetTexture(ItemTexture) - else - needUpdate = true + if ItemTexture then + Slot['Socket'..i].Texture:SetTexture(ItemTexture) + else + needUpdate = true + end end end end - end - --print(slotName..' : ', GemCount_Default, GemCount_Enable, GemCount_Now, GemCount) - if GemCount_Now < GemCount_Default then -- ItemInfo not loaded - needUpdate = true + --print(slotName..' : ', GemCount_Default, GemCount_Enable, GemCount_Now, GemCount) + if GemCount_Now < GemCount_Default then -- ItemInfo not loaded + needUpdate = true + end end - end - _, _, ItemRarity, BasicItemLevel, _, _, _, _, _, ItemTexture = GetItemInfo(ItemLink) - r, g, b = GetItemQualityColor(ItemRarity) - - ItemUpgradeID = ItemLink:match(':(%d+)\124h%[') - - --<< Enchant Parts >>-- - for i = 1, self.ScanTT:NumLines() do - CurrentLineText = _G['SLE_CharacterArmory_ScanTTTextLeft'..i]:GetText() - - if CurrentLineText:find(C.ItemLevelKey_Alt) then - TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey_Alt)) - elseif CurrentLineText:find(C.ItemLevelKey) then - TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey)) - elseif CurrentLineText:find(C.EnchantKey) then - CurrentLineText = CurrentLineText:match(C.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) --Intellect is to long for darth - CurrentLineText = gsub(CurrentLineText, ITEM_MOD_CRIT_RATING_SHORT, CRIT_ABBR) -- Critical is too long - --God damn russian localization team! - CurrentLineText = gsub(CurrentLineText, "к показателю уклонения", ITEM_MOD_DODGE_RATING_SHORT) - CurrentLineText = gsub(CurrentLineText, "к показателю скорости", ITEM_MOD_HASTE_RATING_SHORT) - CurrentLineText = gsub(CurrentLineText, "к показателю парирования", ITEM_MOD_PARRY_RATING_SHORT) - CurrentLineText = gsub(CurrentLineText, "к показателю искусности", ITEM_MOD_MASTERY_RATING_SHORT) - CurrentLineText = gsub(CurrentLineText, ' + ', '+') -- Remove space - CurrentLineText = gsub(CurrentLineText, "небольшое увеличение скорости бега", "+к скорости бега") - - if E.db.sle.characterframeoptions.itemenchant.show then - Slot.ItemEnchant:Show() - if E.db.sle.characterframeoptions.itemenchant.mouseover then - Slot.ItemEnchant:SetDrawLayer('HIGHLIGHT') + _, _, ItemRarity, BasicItemLevel, _, _, _, _, _, ItemTexture = GetItemInfo(ItemLink) + r, g, b = GetItemQualityColor(ItemRarity) + + ItemUpgradeID = ItemLink:match(':(%d+)\124h%[') + + --<< Enchant Parts >>-- + for i = 1, self.ScanTT:NumLines() do + CurrentLineText = _G['SLE_CharacterArmory_ScanTTTextLeft'..i]:GetText() + + if CurrentLineText:find(C.ItemLevelKey_Alt) then + TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey_Alt)) + elseif CurrentLineText:find(C.ItemLevelKey) then + TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey)) + elseif CurrentLineText:find(C.EnchantKey) then + CurrentLineText = CurrentLineText:match(C.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 + --God damn russian localization team! + CurrentLineText = gsub(CurrentLineText, "к показателю уклонения", ITEM_MOD_DODGE_RATING_SHORT) + CurrentLineText = gsub(CurrentLineText, "к показателю скорости", ITEM_MOD_HASTE_RATING_SHORT) + CurrentLineText = gsub(CurrentLineText, "к показателю парирования", ITEM_MOD_PARRY_RATING_SHORT) + CurrentLineText = gsub(CurrentLineText, "к показателю искусности", ITEM_MOD_MASTERY_RATING_SHORT) + CurrentLineText = gsub(CurrentLineText, ' + ', '+') -- Remove space + CurrentLineText = gsub(CurrentLineText, "небольшое увеличение скорости бега", "+к скорости бега") + + if E.db.sle.characterframeoptions.itemenchant.show then + Slot.ItemEnchant:Show() + if E.db.sle.characterframeoptions.itemenchant.mouseover then + Slot.ItemEnchant:SetDrawLayer('HIGHLIGHT') + else + Slot.ItemEnchant:SetDrawLayer('OVERLAY') + end + Slot.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemenchant.font), E.db.sle.characterframeoptions.itemenchant.fontSize, E.db.sle.characterframeoptions.itemenchant.fontOutline) + Slot.ItemEnchant:SetText('|cffceff00'..CurrentLineText) else - Slot.ItemEnchant:SetDrawLayer('OVERLAY') + Slot.ItemEnchant:Hide() end - Slot.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemenchant.font), E.db.sle.characterframeoptions.itemenchant.fontSize, E.db.sle.characterframeoptions.itemenchant.fontOutline) - Slot.ItemEnchant:SetText('|cffceff00'..CurrentLineText) - else - Slot.ItemEnchant:Hide() - end - - IsEnchanted = true - elseif CurrentLineText:find(ITEM_SPELL_TRIGGER_ONUSE) then - UsableEffect = true - end - end - --<< ItemLevel Parts >>-- - if BasicItemLevel then - if ItemUpgradeID then - if ItemUpgradeID == '0' then - ItemUpgradeID = nil - else - --if not C.ItemUpgrade[ItemUpgradeID] then - --print('New Upgrade ID |cffceff00['..ItemUpgradeID..']|r : |cffceff00'..(TrueItemLevel - BasicItemLevel)) - --end - - ItemUpgradeID = TrueItemLevel - BasicItemLevel + IsEnchanted = true + elseif CurrentLineText:find(ITEM_SPELL_TRIGGER_ONUSE) then + UsableEffect = true end end - if E.db.sle.characterframeoptions.itemlevel.show ~= false then - Slot.ItemLevel:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemlevel.font), E.db.sle.characterframeoptions.itemlevel.fontSize, E.db.sle.characterframeoptions.itemlevel.fontOutline) - Slot.ItemLevel:SetText((Slot.Direction == 'LEFT' and TrueItemLevel or '')..(ItemUpgradeID and (Slot.Direction == 'LEFT' and ' ' or '')..(C.UpgradeColor[ItemUpgradeID] or '|cffaaaaaa')..'(+'..ItemUpgradeID..')|r'..(Slot.Direction == 'RIGHT' and ' ' or '') or '')..(Slot.Direction == 'RIGHT' and TrueItemLevel or '')) - end - end - - --[[ Check Error - if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and CFO.PlayerProfession.Enchanting and CFO.PlayerProfession.Enchanting >= 550 and not IsEnchanted) then - ErrorDetected = true - if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then - Slot.EnchantWarning:Show() - Slot.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemenchant.font), E.db.sle.characterframeoptions.itemenchant.fontSize, E.db.sle.characterframeoptions.itemenchant.fontOutline) - Slot.ItemEnchant:SetText('|cffff0000'..L['Not Enchanted']) - end - elseif CFO.PlayerProfession.Engineering and ((slotName == 'BackSlot' and CFO.PlayerProfession.Engineering >= 380) or (slotName == 'HandsSlot' and CFO.PlayerProfession.Engineering >= 400) or (slotName == 'WaistSlot' and CFO.PlayerProfession.Engineering >= 380)) and not UsableEffect then - ErrorDetected = true - if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110403)..'|r : '..L['Missing Tinkers'] - end - elseif slotName == 'ShoulderSlot' and CFO.PlayerProfession.Inscription and C.ItemEnchant_Profession_Inscription and CFO.PlayerProfession.Inscription >= C.ItemEnchant_Profession_Inscription.NeedLevel and not C.ItemEnchant_Profession_Inscription[enchantID] then - ErrorDetected = true - if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then - Slot.ItemEnchant:SetDrawLayer('OVERLAY') - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110400)..'|r : '..L['This is not profession only.'] - end - elseif slotName == 'WristSlot' and CFO.PlayerProfession.LeatherWorking and C.ItemEnchant_Profession_LeatherWorking and CFO.PlayerProfession.LeatherWorking >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then - ErrorDetected = true - if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then - Slot.ItemEnchant:SetDrawLayer('OVERLAY') - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110423)..'|r : '..L['This is not profession only.'] - end - elseif slotName == 'BackSlot' and CFO.PlayerProfession.Tailoring and C.ItemEnchant_Profession_Tailoring and CFO.PlayerProfession.Tailoring >= C.ItemEnchant_Profession_Tailoring.NeedLevel and not C.ItemEnchant_Profession_Tailoring[enchantID] then - ErrorDetected = true - if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then - Slot.ItemEnchant:SetDrawLayer('OVERLAY') - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110426)..'|r : '..L['This is not profession only.'] - end - end - - if GemTotal_1 > GemTotal_2 or GemTotal_1 > GemCount then - ErrorDetected = true - - if E.db.sle.characterframeoptions.itemgem.showwarning ~= false then - Slot.SocketWarning:Show() - end - if GemTotal_1 > GemTotal_2 then - if slotName == 'WaistSlot' then - if TrueItemLevel < 300 then - _, Slot.SocketWarning.Link = GetItemInfo(41611) - elseif TrueItemLevel < 417 then - _, Slot.SocketWarning.Link = GetItemInfo(55054) + --<< ItemLevel Parts >>-- + if BasicItemLevel then + if ItemUpgradeID then + if ItemUpgradeID == '0' then + ItemUpgradeID = nil else - _, Slot.SocketWarning.Link = GetItemInfo(90046) + ItemUpgradeID = TrueItemLevel - BasicItemLevel end - elseif slotName == 'HandsSlot' then - Slot.SocketWarning.Link = GetSpellLink(114112) - elseif slotName == 'WristSlot' then - Slot.SocketWarning.Link = GetSpellLink(113263) end - - if slotName == 'WaistSlot' then - Slot.SocketWarning.Message = L['Missing Buckle'] - elseif slotName == 'WristSlot' or slotName == 'HandsSlot' then - Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + if E.db.sle.characterframeoptions.itemlevel.show ~= false then + Slot.ItemLevel:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemlevel.font), E.db.sle.characterframeoptions.itemlevel.fontSize, E.db.sle.characterframeoptions.itemlevel.fontOutline) + Slot.ItemLevel:SetText((Slot.Direction == 'LEFT' and TrueItemLevel or '')..(ItemUpgradeID and (Slot.Direction == 'LEFT' and ' ' or '')..(C.UpgradeColor[ItemUpgradeID] or '|cffaaaaaa')..'(+'..ItemUpgradeID..')|r'..(Slot.Direction == 'RIGHT' and ' ' or '') or '')..(Slot.Direction == 'RIGHT' and TrueItemLevel or '')) end - else - Slot.SocketWarning.Message = '|cffff5678'..(GemTotal_1 - GemCount)..'|r '..L['Empty Socket'] end - - if GemTotal_1 ~= GemTotal_2 and slotName == 'WaistSlot' then - Slot.SocketWarning:SetScript('OnClick', function(self, button) - local itemName, itemLink - - if TrueItemLevel < 300 then - itemName, itemLink = GetItemInfo(41611) - elseif TrueItemLevel < 417 then - itemName, itemLink = GetItemInfo(55054) - else - itemName, itemLink = GetItemInfo(90046) + + --[[ Check Error + if DB.Modules.Armory.Character.NoticeMissing ~= false then --Replace with our noticemissing + if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and self.PlayerProfession.Enchanting and self.PlayerProfession.Enchanting >= 550 and not IsEnchanted) then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then + Slot.EnchantWarning:Show() + Slot.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemenchant.font), E.db.sle.characterframeoptions.itemenchant.fontSize, E.db.sle.characterframeoptions.itemenchant.fontOutline) + Slot.ItemEnchant:SetText('|cffff0000'..L['Not Enchanted']) end - - if HandleModifiedItemClick(itemLink) then - elseif IsShiftKeyDown() then - if button == 'RightButton' then - SocketInventoryItem(Slot.ID) - elseif BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(itemName) - BrowseName:SetFocus() + elseif self.PlayerProfession.Engineering and ((slotName == 'BackSlot' and self.PlayerProfession.Engineering >= 380) or (slotName == 'HandsSlot' and self.PlayerProfession.Engineering >= 400) or (slotName == 'WaistSlot' and self.PlayerProfession.Engineering >= 380)) and not UsableEffect then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110403)..'|r : '..L['Missing Tinkers'] + end + elseif slotName == 'ShoulderSlot' and self.PlayerProfession.Inscription and C.ItemEnchant_Profession_Inscription and self.PlayerProfession.Inscription >= C.ItemEnchant_Profession_Inscription.NeedLevel and not C.ItemEnchant_Profession_Inscription[enchantID] then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then + Slot.ItemEnchant:SetDrawLayer('OVERLAY') + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110400)..'|r : '..L['This is not profession only.'] + end + elseif slotName == 'WristSlot' and self.PlayerProfession.LeatherWorking and C.ItemEnchant_Profession_LeatherWorking and self.PlayerProfession.LeatherWorking >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then + ErrorDetected = true + if E.db.sle.characterframeoptions.itemenchant.showwarning ~= false then + Slot.ItemEnchant:SetDrawLayer('OVERLAY') + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110423)..'|r : '..L['This is not profession only.'] + end + elseif slotName == 'BackSlot' and self.PlayerProfession.Tailoring and C.ItemEnchant_Profession_Tailoring and CFO.PlayerProfession.Tailoring >= C.ItemEnchant_Profession_Tailoring.NeedLevel and not C.ItemEnchant_Profession_Tailoring[enchantID] then + for EnchantID, NeedLevel in pairs(C.ItemEnchant_Profession_Tailoring) do + if self.PlayerProfession_Tailoring >= NeedLevel then + Slot.ItemEnchant:SetDrawLayer('OVERLAY') + if EnchantID == ItemTable[3] then + ErrorDetected = nil + break + else + ErrorDetected = true + end end end - end) + + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110426)..'|r : '..L['This is not profession only.'] + end + + if GemCount_Enable > GemCount_Now or GemCount_Enable > GemCount or GemCount_Now > GemCount then + ErrorDetected = true + + Slot.SocketWarning:Show() + + if GemCount_Enable > GemCount_Now then + if slotName == 'WaistSlot' then + if TrueItemLevel < 300 then + _, Slot.SocketWarning.Link = GetItemInfo(41611) + elseif TrueItemLevel < 417 then + _, Slot.SocketWarning.Link = GetItemInfo(55054) + else + _, Slot.SocketWarning.Link = GetItemInfo(90046) + end + + Slot.SocketWarning.Message = L['Missing Buckle'] + + Slot.SocketWarning:SetScript('OnClick', function(self, button) + local itemName, itemLink + + if TrueItemLevel < 300 then + itemName, itemLink = GetItemInfo(41611) + elseif TrueItemLevel < 417 then + itemName, itemLink = GetItemInfo(55054) + else + itemName, itemLink = GetItemInfo(90046) + end + + if HandleModifiedItemClick(itemLink) then + elseif IsShiftKeyDown() then + if button == 'RightButton' then + SocketInventoryItem(Slot.ID) + elseif BrowseName and BrowseName:IsVisible() then + AuctionFrameBrowse_Reset(BrowseResetButton) + BrowseName:SetText(itemName) + BrowseName:SetFocus() + end + end + end) + elseif slotName == 'HandsSlot' then + Slot.SocketWarning.Link = GetSpellLink(114112) + Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + elseif slotName == 'WristSlot' then + Slot.SocketWarning.Link = GetSpellLink(113263) + Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + end + else + Slot.SocketWarning.Message = '|cffff5678'..(GemCount_Now - GemCount)..'|r '..L['Empty Socket'] + end + end end - end]] + ]] + else + needUpdate = true + end end -- Change Gradation @@ -756,14 +757,6 @@ function CA:StartArmoryFrame() CA:CharacterArmory_DataSetting() -- Run SLE CharacterArmoryMode - --[[CFO:RegisterEvent('SOCKET_INFO_SUCCESS', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('PLAYER_EQUIPMENT_CHANGED', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('PLAYER_ENTERING_WORLD', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('UNIT_INVENTORY_CHANGED', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('EQUIPMENT_SWAP_FINISHED', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('UPDATE_INVENTORY_DURABILITY', 'ArmoryFrame_DataSetting') - CFO:RegisterEvent('ITEM_UPGRADE_MASTER_UPDATE', 'ArmoryFrame_DataSetting') - ]] CA:RegisterEvent('SOCKET_INFO_SUCCESS') CA:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') CA:RegisterEvent('UNIT_INVENTORY_CHANGED') diff --git a/ElvUI_SLE/modules/characterframe/communication.lua b/ElvUI_SLE/modules/characterframe/communication.lua index 98825c4..f1fc2a2 100644 --- a/ElvUI_SLE/modules/characterframe/communication.lua +++ b/ElvUI_SLE/modules/characterframe/communication.lua @@ -30,6 +30,7 @@ if not AISM.Revision or AISM.Revision <= Revision then AISM.Tooltip = _G['AISM_Tooltip'] or AISM.Tooltip or CreateFrame('GameTooltip', 'AISM_Tooltip', nil, 'GameTooltipTemplate') AISM.Tooltip:SetOwner(UIParent, 'ANCHOR_NONE') AISM.Updater = _G['AISM_Updater'] or AISM.Updater or CreateFrame('Frame', 'AISM_Updater', UIParent) + AISM.Updater.elapsed = 0 AISM.Delay_SendMessage = 2 AISM.Delay_Updater = .5 @@ -115,34 +116,41 @@ if not AISM.Revision or AISM.Revision <= Revision then --<< Player Data Updater Core >>-- local needUpdate, args - AISM.Updater:SetScript('OnUpdate', function(self) - AISM.UpdatedData = needUpdate and AISM.UpdatedData or {} - needUpdate = nil + AISM.Updater:SetScript('OnUpdate', function(self, elapsed) + self.elapsed = self.elapsed + elapsed - if not self.ProfessionUpdated then - needUpdate = AISM:GetPlayerProfessionSetting() or needUpdate - end - - if not self.SpecUpdated then - needUpdate = AISM:GetPlayerSpecSetting() or needUpdate - end - - if not self.GlyphUpdated then - needUpdate = AISM:GetPlayerGlyphString() or needUpdate - end - - if self.GearUpdated ~= true then - needUpdate = AISM:GetPlayerGearString() or needUpdate - end - - if not needUpdate then - self:Hide() + if self.elapsed > 0 then + self.elapsed = -AISM.Delay_Updater + + AISM.UpdatedData = needUpdate and AISM.UpdatedData or {} + needUpdate = nil - for _ in pairs(AISM.UpdatedData) do - if AISM.CurrentGroupMode and AISM.CurrentGroupMode ~= 'NoGroup' and AISM.CurrentGroupType then - AISM:SendData(AISM.UpdatedData) + if not self.ProfessionUpdated then + needUpdate = AISM:GetPlayerProfessionSetting() or needUpdate + end + + if not self.SpecUpdated then + needUpdate = AISM:GetPlayerSpecSetting() or needUpdate + end + + if not self.GlyphUpdated then + needUpdate = AISM:GetPlayerGlyphString() or needUpdate + end + + if self.GearUpdated ~= true then + needUpdate = AISM:GetPlayerGearString() or needUpdate + end + + if not needUpdate then + self.elapsed = 0 + self:Hide() + + for _ in pairs(AISM.UpdatedData) do + if AISM.CurrentGroupMode and AISM.CurrentGroupMode ~= 'NoGroup' and AISM.CurrentGroupType then + AISM:SendData(AISM.UpdatedData) + end + break end - break end end end) @@ -341,7 +349,7 @@ if not AISM.Revision or AISM.Revision <= Revision then --<< Gear String >>-- function AISM:GetPlayerGearString() local ShortString, FullString, needUpdate, needUpdateList - local CurrentSetItem = {} + local CurrentSetItem, GearSetIDList = {}, {} local slotID, slotLink, isTransmogrified, transmogrifiedItemID, SetName, GeatSetCount, SetItemMax, SetOptionCount, colorR, colorG, colorB, checkSpace, tooltipText for slotName in pairs(self.Updater.GearUpdated or self.GearList) do diff --git a/ElvUI_SLE/modules/characterframe/inspectframe.lua b/ElvUI_SLE/modules/characterframe/inspectframe.lua index fbf9e90..3c2d439 100644 --- a/ElvUI_SLE/modules/characterframe/inspectframe.lua +++ b/ElvUI_SLE/modules/characterframe/inspectframe.lua @@ -1386,7 +1386,7 @@ function IA:CreateInspectFrame() if isSending then AISM:RegisterInspectDataRequest(function(User, Message) if User == DataTable.TableIndex and Message == isSending then - InspectArmory_UnitPopup.CreateDropDownButton(nil, DataTable) + InspectArmory_UnitPopup.CreateDropDownButton(Button, DataTable) return true end @@ -1718,188 +1718,192 @@ function IA:InspectFrame_DataSetting(DataTable) if DataTable.Gear[slotName].ItemLink then _, Slot.Link = GetItemInfo(DataTable.Gear[slotName].ItemLink) - do --<< Gem Parts >>-- - arg1, itemID, enchantID, _, _, _, _, arg2, arg3, arg4, arg5, arg6 = strsplit(':', Slot.Link) - - IA:ClearTooltip(self.ScanTT) - self.ScanTT:SetHyperlink(format('%s:%s:%d:0:0:0:0:%s:%s:%s:%s:%s', arg1, itemID, enchantID, arg2, arg3, arg4, arg5, arg6)) - - GemCount_Default, GemCount_Now, GemCount = 0, 0, 0 - - -- First, Counting default gem sockets - for i = 1, MAX_NUM_SOCKETS do - ItemTexture = _G['InspectArmoryScanTTTexture'..i]:GetTexture() + if Slot.Link then + do --<< Gem Parts >>-- + arg1, itemID, enchantID, _, _, _, _, arg2, arg3, arg4, arg5, arg6 = strsplit(':', Slot.Link) - 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--', '')) - end - end - - -- Second, Check if slot's item enable to adding a socket - GemCount_Enable = GemCount_Default - if (slotName == 'WaistSlot' and DataTable.Level >= 70) or -- buckle - ((slotName == 'WristSlot' or slotName == 'HandsSlot') and (DataTable.Profession[1].Name == GetSpellInfo(110396) and DataTable.Profession[1].Level >= 550 or DataTable.Profession[2].Name == GetSpellInfo(110396) and DataTable.Profession[2].Level >= 550)) then -- BlackSmith + IA:ClearTooltip(self.ScanTT) + self.ScanTT:SetHyperlink(format('%s:%s:%d:0:0:0:0:%s:%s:%s:%s:%s', arg1, itemID, enchantID, arg2, arg3, arg4, arg5, arg6)) - GemCount_Enable = GemCount_Enable + 1 - Slot['Socket'..GemCount_Enable].GemType = 'PRISMATIC' - end - - IA:ClearTooltip(self.ScanTT) - self.ScanTT:SetHyperlink(Slot.Link) - - -- Apply current item's gem setting - for i = 1, MAX_NUM_SOCKETS do - ItemTexture = _G['InspectArmoryScanTTTexture'..i]:GetTexture() + GemCount_Default, GemCount_Now, GemCount = 0, 0, 0 - if Slot['Socket'..i].GemType and C.GemColor[Slot['Socket'..i].GemType] then - r, g, b = unpack(C.GemColor[Slot['Socket'..i].GemType]) - Slot['Socket'..i].Socket:SetBackdropColor(r, g, b, 0.5) - Slot['Socket'..i].Socket:SetBackdropBorderColor(r, g, b) - else - Slot['Socket'..i].Socket:SetBackdropColor(1, 1, 1, 0.5) - Slot['Socket'..i].Socket:SetBackdropBorderColor(1, 1, 1) + -- First, Counting default gem sockets + for i = 1, MAX_NUM_SOCKETS do + ItemTexture = _G['InspectArmoryScanTTTexture'..i]:GetTexture() + + 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--', '')) + end end - CurrentLineText = 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 + -- Second, Check if slot's item enable to adding a socket + GemCount_Enable = GemCount_Default + if (slotName == 'WaistSlot' and DataTable.Level >= 70) or -- buckle + ((slotName == 'WristSlot' or slotName == 'HandsSlot') and (DataTable.Profession[1].Name == GetSpellInfo(110396) and DataTable.Profession[1].Level >= 550 or DataTable.Profession[2].Name == GetSpellInfo(110396) and DataTable.Profession[2].Level >= 550)) then -- BlackSmith + + GemCount_Enable = GemCount_Enable + 1 + Slot['Socket'..GemCount_Enable].GemType = 'PRISMATIC' + end - if CurrentLineText then - Slot['Socket'..i]:Show() - GemCount_Now = GemCount_Now + 1 - Slot.SocketWarning:Point(Slot.Direction, Slot['Socket'..i], (Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT'), Slot.Direction == 'LEFT' and 3 or -3, 0) + IA:ClearTooltip(self.ScanTT) + self.ScanTT:SetHyperlink(Slot.Link) + + -- Apply current item's gem setting + for i = 1, MAX_NUM_SOCKETS do + ItemTexture = _G['InspectArmoryScanTTTexture'..i]:GetTexture() - ItemTexture = ItemTexture or DataTable.Gear[slotName]['Gem'..i] and select(10, GetItemInfo(DataTable.Gear[slotName]['Gem'..i])) or nil + if Slot['Socket'..i].GemType and C.GemColor[Slot['Socket'..i].GemType] then + r, g, b = unpack(C.GemColor[Slot['Socket'..i].GemType]) + Slot['Socket'..i].Socket:SetBackdropColor(r, g, b, 0.5) + Slot['Socket'..i].Socket:SetBackdropBorderColor(r, g, b) + else + Slot['Socket'..i].Socket:SetBackdropColor(1, 1, 1, 0.5) + Slot['Socket'..i].Socket:SetBackdropBorderColor(1, 1, 1) + end + + CurrentLineText = 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 not ItemTexture then - needUpdate = true - elseif not C.EmptySocketString[CurrentLineText] then - GemCount = GemCount + 1 - Slot['Socket'..i].GemItemID = CurrentLineText - Slot['Socket'..i].Texture:SetTexture(ItemTexture) + if CurrentLineText then + Slot['Socket'..i]:Show() + GemCount_Now = GemCount_Now + 1 + Slot.SocketWarning:Point(Slot.Direction, Slot['Socket'..i], (Slot.Direction == 'LEFT' and 'RIGHT' or 'LEFT'), Slot.Direction == 'LEFT' and 3 or -3, 0) + + ItemTexture = ItemTexture or DataTable.Gear[slotName]['Gem'..i] and select(10, GetItemInfo(DataTable.Gear[slotName]['Gem'..i])) or nil + + if not ItemTexture then + needUpdate = true + elseif not C.EmptySocketString[CurrentLineText] then + GemCount = GemCount + 1 + Slot['Socket'..i].GemItemID = CurrentLineText + Slot['Socket'..i].Texture:SetTexture(ItemTexture) + end end end + + if GemCount_Now < GemCount_Default then -- ItemInfo not loaded + needUpdate = true + end end - if GemCount_Now < GemCount_Default then -- ItemInfo not loaded - needUpdate = true - end - end - - _, _, ItemRarity, BasicItemLevel, _, _, _, _, _, ItemTexture = GetItemInfo(Slot.Link) - r, g, b = GetItemQualityColor(ItemRarity) - - ItemUpgradeID = Slot.Link:match(':(%d+)\124h%[') - - --<< Enchant Parts >>-- - for i = 1, self.ScanTT:NumLines() do - CurrentLineText = _G['InspectArmoryScanTTTextLeft'..i]:GetText() + _, _, ItemRarity, BasicItemLevel, _, _, _, _, _, ItemTexture = GetItemInfo(Slot.Link) + r, g, b = GetItemQualityColor(ItemRarity) - if CurrentLineText:find(C.ItemLevelKey_Alt) then - TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey_Alt)) - elseif CurrentLineText:find(C.ItemLevelKey) then - TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey)) - elseif CurrentLineText:find(C.EnchantKey) then - CurrentLineText = CurrentLineText:match(C.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 - - Slot.Gradation.ItemEnchant:SetText('|cffceff00'..CurrentLineText) + ItemUpgradeID = Slot.Link:match(':(%d+)\124h%[') + + --<< Enchant Parts >>-- + for i = 1, self.ScanTT:NumLines() do + CurrentLineText = _G['InspectArmoryScanTTTextLeft'..i]:GetText() - IsEnchanted = true + if CurrentLineText:find(C.ItemLevelKey_Alt) then + TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey_Alt)) + elseif CurrentLineText:find(C.ItemLevelKey) then + TrueItemLevel = tonumber(CurrentLineText:match(C.ItemLevelKey)) + elseif CurrentLineText:find(C.EnchantKey) then + CurrentLineText = CurrentLineText:match(C.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 + + Slot.Gradation.ItemEnchant:SetText('|cffceff00'..CurrentLineText) + + IsEnchanted = true + end end - end - - --<< ItemLevel Parts >>-- - if BasicItemLevel then - ItemCount = ItemCount + 1 - if ItemUpgradeID then - if ItemUpgradeID == '0' then - ItemUpgradeID = nil - else - ItemUpgradeID = TrueItemLevel - BasicItemLevel + --<< ItemLevel Parts >>-- + if BasicItemLevel then + ItemCount = ItemCount + 1 + + if ItemUpgradeID then + if ItemUpgradeID == '0' then + ItemUpgradeID = nil + else + ItemUpgradeID = TrueItemLevel - BasicItemLevel + end end + + ItemTotal = ItemTotal + TrueItemLevel + + Slot.ItemLevel:SetText((ItemUpgradeID and (C.UpgradeColor[ItemUpgradeID] or '|cffffffff') or '')..TrueItemLevel) + Slot.Gradation.ItemLevel:SetText((Slot.Direction == 'LEFT' and TrueItemLevel or '')..(ItemUpgradeID and (Slot.Direction == 'LEFT' and ' ' or '')..(C.UpgradeColor[ItemUpgradeID] or '|cffaaaaaa')..'(+'..ItemUpgradeID..')|r'..(Slot.Direction == 'RIGHT' and ' ' or '') or '')..(Slot.Direction == 'RIGHT' and TrueItemLevel or '')) end - ItemTotal = ItemTotal + TrueItemLevel - - Slot.ItemLevel:SetText((ItemUpgradeID and (C.UpgradeColor[ItemUpgradeID] or '|cffffffff') or '')..TrueItemLevel) - Slot.Gradation.ItemLevel:SetText((Slot.Direction == 'LEFT' and TrueItemLevel or '')..(ItemUpgradeID and (Slot.Direction == 'LEFT' and ' ' or '')..(C.UpgradeColor[ItemUpgradeID] or '|cffaaaaaa')..'(+'..ItemUpgradeID..')|r'..(Slot.Direction == 'RIGHT' and ' ' or '') or '')..(Slot.Direction == 'RIGHT' and TrueItemLevel or '')) - end - - --[[ - -- Check Error - if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and (DataTable.Profession[1].Name == GetSpellInfo(110400) and DataTable.Profession[1].Level >= 550 or DataTable.Profession[2].Name == GetSpellInfo(110400) and DataTable.Profession[2].Level >= 550) and not IsEnchanted) then - ErrorDetected = true - Slot.EnchantWarning:Show() - Slot.Gradation.ItemEnchant:SetText('|cffff0000'..L['Not Enchanted']) - elseif slotName == 'ShoulderSlot' and C.ItemEnchant_Profession_Inscription and (DataTable.Profession[1].Name == GetSpellInfo(110417) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_Inscription.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110417) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_Inscription.NeedLevel) and not C.ItemEnchant_Profession_Inscription[enchantID] then - ErrorDetected = true - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110400)..'|r : '..L['This is not profession only.'] - elseif slotName == 'WristSlot' and C.ItemEnchant_Profession_LeatherWorking and (DataTable.Profession[1].Name == GetSpellInfo(110423) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110423) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel) and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then - ErrorDetected = true - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110423)..'|r : '..L['This is not profession only.'] - elseif slotName == 'BackSlot' and C.ItemEnchant_Profession_Tailoring and (DataTable.Profession[1].Name == GetSpellInfo(110426) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_Tailoring.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110426) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_Tailoring.NeedLevel) and not C.ItemEnchant_Profession_Tailoring[enchantID] then - ErrorDetected = true - Slot.EnchantWarning:Show() - Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110426)..'|r : '..L['This is not profession only.'] - end - - if GemCount_Enable > GemCount_Now or GemCount_Enable > GemCount or GemCount_Now > GemCount then - ErrorDetected = true - - Slot.SocketWarning:Show() + --[[ + -- Check Error + if (not IsEnchanted and C.EnchantableSlots[slotName]) or ((slotName == 'Finger0Slot' or slotName == 'Finger1Slot') and (DataTable.Profession[1].Name == GetSpellInfo(110400) and DataTable.Profession[1].Level >= 550 or DataTable.Profession[2].Name == GetSpellInfo(110400) and DataTable.Profession[2].Level >= 550) and not IsEnchanted) then + ErrorDetected = true + Slot.EnchantWarning:Show() + Slot.Gradation.ItemEnchant:SetText('|cffff0000'..L['Not Enchanted']) + elseif slotName == 'ShoulderSlot' and C.ItemEnchant_Profession_Inscription and (DataTable.Profession[1].Name == GetSpellInfo(110417) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_Inscription.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110417) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_Inscription.NeedLevel) and not C.ItemEnchant_Profession_Inscription[enchantID] then + ErrorDetected = true + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110400)..'|r : '..L['This is not profession only.'] + elseif slotName == 'WristSlot' and C.ItemEnchant_Profession_LeatherWorking and (DataTable.Profession[1].Name == GetSpellInfo(110423) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110423) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_LeatherWorking.NeedLevel) and not C.ItemEnchant_Profession_LeatherWorking[enchantID] then + ErrorDetected = true + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110423)..'|r : '..L['This is not profession only.'] + elseif slotName == 'BackSlot' and C.ItemEnchant_Profession_Tailoring and (DataTable.Profession[1].Name == GetSpellInfo(110426) and DataTable.Profession[1].Level >= C.ItemEnchant_Profession_Tailoring.NeedLevel or DataTable.Profession[2].Name == GetSpellInfo(110426) and DataTable.Profession[2].Level >= C.ItemEnchant_Profession_Tailoring.NeedLevel) and not C.ItemEnchant_Profession_Tailoring[enchantID] then + ErrorDetected = true + Slot.EnchantWarning:Show() + Slot.EnchantWarning.Message = '|cff71d5ff'..GetSpellInfo(110426)..'|r : '..L['This is not profession only.'] + end - if GemCount_Enable > GemCount_Now then - if slotName == 'WaistSlot' then - if TrueItemLevel < 300 then - _, Slot.SocketWarning.Link = GetItemInfo(41611) - elseif TrueItemLevel < 417 then - _, Slot.SocketWarning.Link = GetItemInfo(55054) - else - _, Slot.SocketWarning.Link = GetItemInfo(90046) - end - - Slot.SocketWarning.Message = L['Missing Buckle'] - - Slot.SocketWarning:SetScript('OnClick', function(self) - local itemName, itemLink - + if GemCount_Enable > GemCount_Now or GemCount_Enable > GemCount or GemCount_Now > GemCount then + ErrorDetected = true + + Slot.SocketWarning:Show() + + if GemCount_Enable > GemCount_Now then + if slotName == 'WaistSlot' then if TrueItemLevel < 300 then - itemName, itemLink = GetItemInfo(41611) + _, Slot.SocketWarning.Link = GetItemInfo(41611) elseif TrueItemLevel < 417 then - itemName, itemLink = GetItemInfo(55054) + _, Slot.SocketWarning.Link = GetItemInfo(55054) else - itemName, itemLink = GetItemInfo(90046) + _, Slot.SocketWarning.Link = GetItemInfo(90046) end - if HandleModifiedItemClick(itemLink) then - elseif IsShiftKeyDown() and BrowseName and BrowseName:IsVisible() then - AuctionFrameBrowse_Reset(BrowseResetButton) - BrowseName:SetText(itemName) - BrowseName:SetFocus() - end - end) - elseif slotName == 'HandsSlot' then - Slot.SocketWarning.Link = GetSpellLink(114112) - Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] - elseif slotName == 'WristSlot' then - Slot.SocketWarning.Link = GetSpellLink(113263) - Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + Slot.SocketWarning.Message = L['Missing Buckle'] + + Slot.SocketWarning:SetScript('OnClick', function(self) + local itemName, itemLink + + if TrueItemLevel < 300 then + itemName, itemLink = GetItemInfo(41611) + elseif TrueItemLevel < 417 then + itemName, itemLink = GetItemInfo(55054) + else + itemName, itemLink = GetItemInfo(90046) + end + + if HandleModifiedItemClick(itemLink) then + elseif IsShiftKeyDown() and BrowseName and BrowseName:IsVisible() then + AuctionFrameBrowse_Reset(BrowseResetButton) + BrowseName:SetText(itemName) + BrowseName:SetFocus() + end + end) + elseif slotName == 'HandsSlot' then + Slot.SocketWarning.Link = GetSpellLink(114112) + Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + elseif slotName == 'WristSlot' then + Slot.SocketWarning.Link = GetSpellLink(113263) + Slot.SocketWarning.Message = '|cff71d5ff'..GetSpellInfo(110396)..'|r : '..L['Missing Socket'] + end + else + Slot.SocketWarning.Message = '|cffff5678'..(GemCount_Now - GemCount)..'|r '..L['Empty Socket'] end - else - Slot.SocketWarning.Message = '|cffff5678'..(GemCount_Now - GemCount)..'|r '..L['Empty Socket'] end + ]] + else + needUpdate = true end - ]] end if Slot.TransmogrifyAnchor then --<< Transmogrify Parts >>-- -- 1.7.9.5