From 9adefbbf5f421b7394cadd43494a96276d7196a3 Mon Sep 17 00:00:00 2001 From: Repooc Date: Mon, 16 Sep 2013 15:05:18 -0400 Subject: [PATCH] Some enchant checking or character frame --- ElvUI_SLE/media/textures/Warning-Small.tga | Bin 0 -> 1068 bytes .../modules/characterframe/characterframe.lua | 2 + ElvUI_SLE/modules/characterframe/itemlevel.lua | 6 +- ElvUI_SLE/modules/characterframe/itemmods.lua | 160 ++++++++++++++++++++ .../modules/characterframe/load_characterframe.xml | 1 + 5 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 ElvUI_SLE/media/textures/Warning-Small.tga create mode 100644 ElvUI_SLE/modules/characterframe/itemmods.lua diff --git a/ElvUI_SLE/media/textures/Warning-Small.tga b/ElvUI_SLE/media/textures/Warning-Small.tga new file mode 100644 index 0000000000000000000000000000000000000000..feb4e389ae9d75009f17ff954f8ba53f65c1cc75 GIT binary patch literal 1068 zcmXw(Ye-XJ7{||?TFVp_F)X)5qSi#Sg0Mo==8Spmju8xr3c3qHeUKt6!cT?})Q5Hk_D__4$P`Tw6i?|a^J1R+6KyV8Yp zVe5J#5YPui;Eqd@b@W|lOqa+d0Y^_OyGBP-MX)@QF{o_C1ehQT#(2ZX(uM4<<-^h zOPQI!o+Tz)K7#qItZA=CGZWmj$r?;a`R>CUcIe~qbi><<>;aI2{GP6^ zA=HU$K!(Q)#-QCp-cVO3n)37KpF{f%BAAf@+PLvMWn}!Kw6rNwslE|v9L7Ds$}`BG zE-7)eVom+foIp-Um?Z2S<>c6C#|}Gf*|Ho4bMf5Hvm) z69hA#m9S>&>kCnPyPvS{#QQ1~lYE9a5Rn-~wsreVuPD_iI{Qfw( zTrxE@c#!?4|IfRS89?@$Uhh7u)y}vWDV z)*Zt+iWL^lhoN~|mC^m 0 then + --self.ItemEnchant:SetFormattedText("|cff00ff00%i|r|cffff0000%s|r", "E", "G") + frame.ItemEnchant:SetFormattedText("|cff00ff00%s|r", "Enchanted") + end + elseif canEnchant == false then + frame.ItemEnchant:SetFormattedText("|cff00ff00%s|r", "Cant Enchant") + elseif canEnchant == nil then + frame.ItemEnchant:SetFormattedText("") + end + + if not E.db.sle.characterframeoptions.itemdurability.enable then + frame.ItemEnchant:Hide() + else + frame.ItemEnchant:Show() + end + --end + end +end +function CFO:fetchChant(slotName) + local inventoryID = GetInventorySlotInfo(slotName) + local myLink = GetInventoryItemLink("player", inventoryID) + local parsedItemDataTable = {} + local foundStart, foundEnd, parsedItemData = string.find(myLink, "^|c%x+|H(.+)|h%[.*%]") + for v in string.gmatch(parsedItemData, "[^:]+") do + tinsert(parsedItemDataTable, v) + end + + return parsedItemDataTable[3] +end + +function CFO:fetchProfs() + local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions() + local profs = {prof1, prof2, archaeology, fishing, cooking, firstAid} + local profNames = {} + + for k, v in pairs(profs) do + local name, texture, rank, maxRank, numSpells, spelloffset, skillLine, rankModifier = GetProfessionInfo(v) + tinsert(profNames, name) + end + + return profNames +end +function CFO:fetchSubclass(slotName) + local slotId, texture, checkRelic = GetInventorySlotInfo(slotName) + local itemId = GetInventoryItemID("player", slotId) + if itemId then + local name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(itemId) + return(subclass) + end +end +function CFO:UpdateItemModsFont() + local frame + for i = 1, #enchantSlot do + frame = _G[("Character%s"):format(enchantSlot[i])] + frame.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemdurability.font), E.db.sle.characterframeoptions.itemdurability.fontSize, E.db.sle.characterframeoptions.itemdurability.fontOutline) + end +end + +function CFO:LoadItemMods() + _G["CharacterFrame"]:HookScript("OnShow", function(self) + CFO:UpdateItemMods() + end) + + self:RegisterEvent("PLAYER_EQUIPMENT_CHANGED", "UpdateItemMods") + + local frame + for i = 1, #enchantSlot do + frame = _G[("Character%s"):format(enchantSlot[i])] + frame.ItemEnchant = frame:CreateFontString(nil, "OVERLAY") + + if frame == CharacterHeadSlot or frame == CharacterNeckSlot or frame == CharacterShoulderSlot or frame == CharacterBackSlot or frame == CharacterChestSlot or frame == CharacterWristSlot or frame == CharacterShirtSlot or frame == CharacterTabardSlot then + frame.ItemEnchant:SetPoint("LEFT", frame, "RIGHT", 2, 7) + elseif frame == CharacterHandsSlot or frame == CharacterWaistSlot or frame == CharacterLegsSlot or frame == CharacterFeetSlot or frame == CharacterFinger0Slot or frame == CharacterFinger1Slot or frame == CharacterTrinket0Slot or frame == CharacterTrinket1Slot then + frame.ItemEnchant:SetPoint("RIGHT", frame, "LEFT", -2, 7) + elseif frame == CharacterMainHandSlot or frame == CharacterSecondaryHandSlot or frame == CharacterRangedSlot then + frame.ItemEnchant:SetPoint("TOP", frame, "BOTTOM", 0, -3) + end + frame.ItemEnchant:FontTemplate(LSM:Fetch("font", E.db.sle.characterframeoptions.itemdurability.font), E.db.sle.characterframeoptions.itemdurability.fontSize, E.db.sle.characterframeoptions.itemdurability.fontOutline) + + --frame.EnchantWarning = CreateFrame('Button', nil, frame) + --frame.EnchantWarning:Size(12) + --frame.EnchantWarning.Texture = frame.EnchantWarning:CreateTexture(nil, 'OVERLAY') + --frame.EnchantWarning.Texture:SetInside() + --frame.EnchantWarning.Texture:SetTexture('Interface\\AddOns\\ElvUI_SLE\\Media\\Textures\\Warning-Small.tga') + --frame.EnchantWarning:Point("LEFT", frame.ItemEnchant, "RIGHT", 3, 0) + --frame.EnchantWarning:Hide() + end +end \ No newline at end of file diff --git a/ElvUI_SLE/modules/characterframe/load_characterframe.xml b/ElvUI_SLE/modules/characterframe/load_characterframe.xml index 1df4e7c..b7cc29a 100755 --- a/ElvUI_SLE/modules/characterframe/load_characterframe.xml +++ b/ElvUI_SLE/modules/characterframe/load_characterframe.xml @@ -2,5 +2,6 @@