diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6fb3b14..addb86b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,6 +6,9 @@ vWTF - Movers created by S&L now don't appear in ElvUI's normall "All" group. Now all our movers are visible only in own groups to prevent overpopulation of the screen - Raid Marks now properly update setting on profile change - Raid Marks module now has an option to hide backdrop for it's main panel +- Added Item Level overlay on item slots +- Added Item Durability overlay on item slots +- Added Font customization for Item Level & Item Durability overlays v1.42 (January 31, 2013) - Curse being stupid and fixed changelog b/c darth dont realize there are 31 days in Jan. diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua index 18fc261..9ac8e18 100644 --- a/ElvUI_SLE/locales/english.lua +++ b/ElvUI_SLE/locales/english.lua @@ -1,245 +1,254 @@ --- English localization file for enUS and enGB. -local AceLocale = LibStub:GetLibrary("AceLocale-3.0"); -local L = AceLocale:NewLocale("ElvUI", "enUS", true); - -if not L then return; end - ---General-- -L["Shadow & Light Edit"] = true -L["Shadow & Light Edit of ElvUI"] = true -L["SLE_DESC"] = [=[This is and edit of ElvUI that adds some functionality to the original addon and changes some previously existed options. -The edit doesn't change original files in any respect so you can freely disable it any time from your addon manager without any risk.]=] -L["LFR Lockdown"] = true -L["Show/Hide LFR lockdown info in time datatext's tooltip."] = true -L["PvP Auto Release"] = true -L["Automatically release body when killed inside a battleground."] = true -L["Errors in combat"] = true -L["Show/hide error messages in combat."] = true -L["Pet autocast corners"] = true -L["Show/hide triangles in corners of autocastable buttons."] = true -L["Loot History"] = true -L["Auto hide"] = true -L["Automaticaly hide Blizzard loot histroy frame when leaving the instance."] = true -L["Sets alpha of loot histroy frame."] = true -L["SLE_LOGIN_MSG"] = [=[You are using |cff1784d1Shadow & Light Edit|r version |cff1784d1%s%s|r for ElvUI. -If you wish to use the original ElvUI addon, disable this edit's plugin in your Addons manager. -Have a nice day.]=] -L["Your version of ElvUI is older than recommended to use with Shadow & Light Edit. Please, download the latest version from tukui.org."] = true -L["Reset All"] = true -L["Reset all Shadow & Light options and movers to their defaults"] = true -L["Reset these options to defaults"] = true - ---Install-- -L["Shadow & Light Settings"] = true -L["You can now choose if you what to use one of authors' set of options. This will change the positioning of most elements but also change a bunch of other options within ElvUI's config."] = true -L["SLE_Install_Text2"] = [=[This step is optional and only to be used if you are wanting to use one of our configurations. -|cffFF0000Warning:|r Please note that the authors' may or may not use any of the layout/theme you have selected as they may not have utilized the options.]=] -L["Darth's Config"] = true -L["Darth's Defaults Set"] = true -L["Repooc's Config"] = true -L["Repooc's Defaults Set"] = true - ---Auras-- -L["Options for customizing auras near the minimap."] = true -L["Caster Name"] = true -L["Enabling this will show caster name in the buffs and debuff icons."] = true - ---Backgroungds-- -L["Backgrounds"] = true -L["Additional Background Panels"] = true -L["BG_DESC"] = "Module for creating additional frames that can be used as backgrounds for anything." -L["Bottom BG"] = true -L["Left BG"] = true -L["Right BG"] = true -L["Actionbar BG"] = true -L["Show/Hide this frame."] = true -L["Sets width of the frame"] = true -L["Sets height of the frame"] = true -L["Sets X offset of the frame"] = true -L["Sets Y offset of the frame"] = true -L["Texture"] = true -L["Set the texture to use in this frame. Requirements are the same as the chat textures."] = true -L["Backdrop Template"] = true -L["Change the template used for this backdrop."] = true -L["Default"] = true -L["Transparent"] = true -L["Hide in Pet Batlle"] = true -L["Show/Hide this frame during Pet Battles."] = true - ---Chat-- -L["Chat Options"] = true -L["Chat Editbox History"] = true -L["Amount of messages to save. Set to 0 to disable."] = true - ---Datatexts-- -L["LFR Dragon Soul"] = true -L["LFR Mogu'shan Vaults"] = true -L["LFR Heart of Fear"] = true -L["LFR Terrace of Endless Spring"] = true -L["LFR Throne of Thunder"] = true -L["Bosses killed: "] = true -L["No LFR is available for your level/gear."] = true -L["SLE_AUTHOR_INFO"] = "Shadow & Light Edit by Darth Predator & Repooc" -L["SLE_CONTACTS"] = [=[Bug reports, suggestions and other stuff accepted via: -- Private Massage on TukUI.org to Darth Predator or Repooc -- AddOn's page/ticket system on curse.com -- Forums on tukui.org, Addons/Help section -- AddOn's repo github.com]=] -L["DP_1"] = "DT Panel 1" -L["DP_2"] = "DT Panel 2" -L["DP_3"] = "DT Panel 3" -L["DP_4"] = "DT Panel 4" -L["DP_5"] = "DT Panel 5" -L["DP_6"] = "DT Panel 6" -L["Bottom_Panel"] = "Bottom Panel" -L["Top_Center"] = "Top Panel" -L["Left Chat"] = true -L["Right Chat"] = true -L["Datatext Panels"] = true -L["Additional Datatext Panels"] = true -L["DP_DESC"] = [=[Additional Datatext Panels. -8 panels with 20 datatext points total and a dashboard with 4 status bars. -You can't disable chat panels.]=] -L["Dashboard"] = true -L["Show/Hide dashboard."] = true -L["Dashboard Panels Width"] = true -L["Sets size of dashboard panels."] = true -L["Show/Hide this panel."] = true -L["Sets size of this panel"] = true -L['Hide panel background'] = true -L["Don't show this panel, only datatexts assinged to it"] = true - ---Exp/Rep Bar-- -L["Xp-Rep Text"] = true -L["Full value on Exp Bar"] = true -L["Changes the way text is shown on exp bar."] = true -L["Full value on Rep Bar"] = true -L["Changes the way text is shown on rep bar."] = true - ---Marks-- -L["Raid Marks"] = true -L["Show/Hide raid marks."] = true -L["Show only in instances"] = true -L["Selecting this option will have the Raid Markers appear only while in a raid or dungeon."] = true -L["Sets size of buttons"] = true --Also used in UI buttons -L["Direction"] = true -L["Change the direction of buttons growth from the skull marker"] = true - ---Mover groups -L["S&L: All"] = true -L["S&L: Datatexts"] = true -L["S&L: Backgrounds"] = true -L["S&L: Misc"] = true - ---Raid Utility-- -L["Raid Utility"] = true - ---Skins-- -L["This options require ElvUI AddOnSkins pack to work."] = true -L["Sets font size on DBM bars"] = true -L["Ground"] = true -L["Flying"] = true -L["Flying & Ground"] = true -L["Swimming"] = true - ---UI buttons-- -L["UI Buttons"] = true -L["Additional menu with useful buttons"] = true -L["Show/Hide UI buttons."] = true -L["Mouse over"] = true -L["Show on mouse over."] = true -L["Buttons position"] = true -L["Layout for UI buttons."] = true -L["Click to reload your interface"] = true -L["Click to toggle config window"] = true -L["Click to toggle the AddOn Manager frame (stAddOnManager, Ampere or ACP) you have enabled."] = true -L["Click to toggle the Configuration/Option Window from the Bossmod (DXE, DBM or Bigwigs) you have enabled."] = true -L["Click to unlock moving ElvUI elements"] = true -L["ElvUI Config"] = true -L["Move UI"] = true -L["Reload UI"] = true -L["AddOns Manager"] = true -L["Boss Mod"] = true -L["Click to toggle iFilger's config UI"] = true - ---Unitframes-- -L["Additional unit frames options"] = true -L["Options for customizing unit frames. Please don't change these setting when ElvUI's testing frames for bosses and arena teams are shown. That will make them invisible until retoggling."] = true -L["Player Frame Indicators"] = true -L["Combat Icon"] = true -L["Show/Hide combat icon on player frame."] = true -L["Combat Position"] = true -L["Set the point to show combat icon"] = true -L["Classbar Energy"] = true -L["Show/hide the text with exact number of energy (Solar/Lunar or Demonic Fury) on your Classbar."] = true -L["Classbar Offset"] = true -L["This options will allow you to detach your classbar from player's frame and move it in other location."] = true -L["Power Text Position"] = true -L["Position power text on this bar of chosen frame"] = true - ---Credits-- -L["ELVUI_SLE_CREDITS"] = "We would like to point out the following people for helping us create this addon with testing, coding, and other stuff." -L["Submodules and Coding:"] = true -L["ELVUI_SLE_CODERS"] = [=[Elv -Tukz -Azilroka -Blazeflack -Boradan -Camealion -Pvtschlag -Sinaris -Sortokk -Swordyy -]=] -L["Other Support:"] = true -L["ELVUI_SLE_MISC"] = [=[BuG - for being french lol -TheSamaKutra -The rest of TukUI community -]=] - ---Tutorials-- -L["To enable full values of health/power on unitframes in Shadow & Light add \":sl\" to the end of the health/power tag.\nExample: [health:current:sl]."] = true - ---Movers-- -L["Pet Battle AB"] = true - - ---Changelog-- -L["Changelog"] = true -L["CHANGE_LOG"] = [=[|cff1784d1v1.37|r -- Decimals are once again shown for hp/power texts on unit frames - -|cff1784d1v1.36|r -- Some tweaks to better work with ElvUI 5.20 - -|cff1784d1v1.35|r -- Fixed compatibility with full Location Plus version - -|cff1784d1v1.34|r -Fixed rune bar error when using classbar offset - -|cff1784d1v1.33|r -- Fixed errors on auras tooltips -- Fixed health bar height with classbar offset enabled - -|cff1784d1v1.32|r -- Config updated - -|cff1784d1v1.31|r -- Repooc config updated - -|cff1784d1v1.3|r -- Authors' layouts have been changed -- Mount serach was deleted, Blizzard added that themselves -- Some adjustions for pixel perfect mode to make things look good -- Caster name in auras' tooltips is now profile based option -- An option added to chosee if you want your power text to be on power bar or health bar (health by default as in normal ElvUI) -- Raid Utility options removed. Now it's fully movable with it's own mover -- Added a mover for world/BG pvp score - Hellfire towers, AV reinforcements, AB resources, etc. (Darth grow tired of using MoveAnything) -- Capture bar is now docked to the bottom of a new mover -- Show errors in combat is now profile based option -- Added S&L version number to version datatext, login message and config -- Buttons for resetting all S&L options or just desired group's options have been added -- You can now see changelog in game -- Added alternative mene regen datatext called "MP5". It shows an "mp5" title instead of "mana regen" +-- English localization file for enUS and enGB. +local AceLocale = LibStub:GetLibrary("AceLocale-3.0"); +local L = AceLocale:NewLocale("ElvUI", "enUS", true); + +if not L then return; end + +--General-- +L["Shadow & Light Edit"] = true +L["Shadow & Light Edit of ElvUI"] = true +L["SLE_DESC"] = [=[This is and edit of ElvUI that adds some functionality to the original addon and changes some previously existed options. +The edit doesn't change original files in any respect so you can freely disable it any time from your addon manager without any risk.]=] +L["LFR Lockdown"] = true +L["Show/Hide LFR lockdown info in time datatext's tooltip."] = true +L["PvP Auto Release"] = true +L["Automatically release body when killed inside a battleground."] = true +L["Errors in combat"] = true +L["Show/hide error messages in combat."] = true +L["Pet autocast corners"] = true +L["Show/hide triangles in corners of autocastable buttons."] = true +L["Loot History"] = true +L["Auto hide"] = true +L["Automaticaly hide Blizzard loot histroy frame when leaving the instance."] = true +L["Sets alpha of loot histroy frame."] = true +L["SLE_LOGIN_MSG"] = [=[You are using |cff1784d1Shadow & Light Edit|r version |cff1784d1%s%s|r for ElvUI. +If you wish to use the original ElvUI addon, disable this edit's plugin in your Addons manager. +Have a nice day.]=] +L["Your version of ElvUI is older than recommended to use with Shadow & Light Edit. Please, download the latest version from tukui.org."] = true +L["Reset All"] = true +L["Reset all Shadow & Light options and movers to their defaults"] = true +L["Reset these options to defaults"] = true + +--Install-- +L["Shadow & Light Settings"] = true +L["You can now choose if you what to use one of authors' set of options. This will change the positioning of most elements but also change a bunch of other options within ElvUI's config."] = true +L["SLE_Install_Text2"] = [=[This step is optional and only to be used if you are wanting to use one of our configurations. +|cffFF0000Warning:|r Please note that the authors' may or may not use any of the layout/theme you have selected as they may not have utilized the options.]=] +L["Darth's Config"] = true +L["Darth's Defaults Set"] = true +L["Repooc's Config"] = true +L["Repooc's Defaults Set"] = true + +--Auras-- +L["Options for customizing auras near the minimap."] = true +L["Caster Name"] = true +L["Enabling this will show caster name in the buffs and debuff icons."] = true + +--Backgroungds-- +L["Backgrounds"] = true +L["Additional Background Panels"] = true +L["BG_DESC"] = "Module for creating additional frames that can be used as backgrounds for anything." +L["Bottom BG"] = true +L["Left BG"] = true +L["Right BG"] = true +L["Actionbar BG"] = true +L["Show/Hide this frame."] = true +L["Sets width of the frame"] = true +L["Sets height of the frame"] = true +L["Sets X offset of the frame"] = true +L["Sets Y offset of the frame"] = true +L["Texture"] = true +L["Set the texture to use in this frame. Requirements are the same as the chat textures."] = true +L["Backdrop Template"] = true +L["Change the template used for this backdrop."] = true +L["Default"] = true +L["Transparent"] = true +L["Hide in Pet Batlle"] = true +L["Show/Hide this frame during Pet Battles."] = true + +--Character Frame Options +L["CFO_DESC"] = "This section will added different options/features to the character sheet. Here you can show item level and durability of your items for a quick glance." +L["Character Frame Options"] = true +L["Enable/Disable Character Frame Options"] = true +L["Item Level"] = true +L["Show/Hide Item Levels"] = true +L['Font'] = true --L['Fonts'] is localized in elvui but not Font +L["The font that the item level will use."] = true +L["Set the font size that the item level will use."] = true +L["Set the font outline that the item level will use."] = true +L["Item Durability"] = true +L["Show/Hide Item Durability"] = true +L["The font that the item durability will use."] = true +L["Set the font size that the item durability will use."] = true +L["Set the font outline that the item durability will use."] = true + +--Chat-- +L["Chat Options"] = true +L["Chat Editbox History"] = true +L["Amount of messages to save. Set to 0 to disable."] = true + +--Datatexts-- +L["LFR Dragon Soul"] = true +L["LFR Mogu'shan Vaults"] = true +L["LFR Heart of Fear"] = true +L["LFR Terrace of Endless Spring"] = true +L["Bosses killed: "] = true +L["No LFR is available for your lever/gear."] = true +L["SLE_AUTHOR_INFO"] = "Shadow & Light Edit by Darth Predator & Repooc" +L["SLE_CONTACTS"] = [=[Bug reports, suggestions and other stuff accepted via: +- Private Massage on TukUI.org to Darth Predator or Repooc +- AddOn's page/ticket system on curse.com +- Forums on tukui.org, Addons/Help section +- AddOn's repo github.com]=] +L["DP_1"] = "DT Panel 1" +L["DP_2"] = "DT Panel 2" +L["DP_3"] = "DT Panel 3" +L["DP_4"] = "DT Panel 4" +L["DP_5"] = "DT Panel 5" +L["DP_6"] = "DT Panel 6" +L["Bottom_Panel"] = "Bottom Panel" +L["Top_Center"] = "Top Panel" +L["Left Chat"] = true +L["Right Chat"] = true +L["Datatext Panels"] = true +L["Additional Datatext Panels"] = true +L["DP_DESC"] = [=[Additional Datatext Panels. +8 panels with 20 datatext points total and a dashboard with 4 status bars. +You can't disable chat panels.]=] +L["Dashboard"] = true +L["Show/Hide dashboard."] = true +L["Dashboard Panels Width"] = true +L["Sets size of dashboard panels."] = true +L["Show/Hide this panel."] = true +L["Sets size of this panel"] = true +L['Hide panel background'] = true +L["Don't show this panel, only datatexts assinged to it"] = true + +--Exp/Rep Bar-- +L["Xp-Rep Text"] = true +L["Full value on Exp Bar"] = true +L["Changes the way text is shown on exp bar."] = true +L["Full value on Rep Bar"] = true +L["Changes the way text is shown on rep bar."] = true + +--Marks-- +L["Raid Marks"] = true +L["Show/Hide raid marks."] = true +L["Show only in instances"] = true +L["Selecting this option will have the Raid Markers appear only while in a raid or dungeon."] = true +L["Sets size of buttons"] = true --Also used in UI buttons +L["Direction"] = true +L["Change the direction of buttons growth from the skull marker"] = true + +--Raid Utility-- +L["Raid Utility"] = true + +--Skins-- +L["This options require ElvUI AddOnSkins pack to work."] = true +L["Sets font size on DBM bars"] = true +L["Ground"] = true +L["Flying"] = true +L["Flying & Ground"] = true +L["Swimming"] = true + +--UI buttons-- +L["UI Buttons"] = true +L["Additional menu with useful buttons"] = true +L["Show/Hide UI buttons."] = true +L["Mouse over"] = true +L["Show on mouse over."] = true +L["Buttons position"] = true +L["Layout for UI buttons."] = true +L["Click to reload your interface"] = true +L["Click to toggle config window"] = true +L["Click to toggle the AddOn Manager frame (stAddOnManager, Ampere or ACP) you have enabled."] = true +L["Click to toggle the Configuration/Option Window from the Bossmod (DXE, DBM or Bigwigs) you have enabled."] = true +L["Click to unlock moving ElvUI elements"] = true +L["ElvUI Config"] = true +L["Move UI"] = true +L["Reload UI"] = true +L["AddOns Manager"] = true +L["Boss Mod"] = true +L["Click to toggle iFilger's config UI"] = true + +--Unitframes-- +L["Additional unit frames options"] = true +L["Options for customizing unit frames. Please don't change these setting when ElvUI's testing frames for bosses and arena teams are shown. That will make them invisible until retoggling."] = true +L["Player Frame Indicators"] = true +L["Combat Icon"] = true +L["Show/Hide combat icon on player frame."] = true +L["Combat Position"] = true +L["Set the point to show combat icon"] = true +L["Classbar Energy"] = true +L["Show/hide the text with exact number of energy (Solar/Lunar or Demonic Fury) on your Classbar."] = true +L["Classbar Offset"] = true +L["This options will allow you to detach your classbar from player's frame and move it in other location."] = true +L["Power Text Position"] = true +L["Position power text on this bar of chosen frame"] = true + +--Credits-- +L["ELVUI_SLE_CREDITS"] = "We would like to point out the following people for helping us create this addon with testing, coding, and other stuff." +L["Submodules and Coding:"] = true +L["ELVUI_SLE_CODERS"] = [=[Elv +Tukz +Azilroka +Blazeflack +Boradan +Camealion +Pvtschlag +Sinaris +Sortokk +Swordyy +]=] +L["Other Support:"] = true +L["ELVUI_SLE_MISC"] = [=[BuG - for being french lol +TheSamaKutra +The rest of TukUI community +]=] + +--Tutorials-- +L["To enable full values of health/power on unitframes in Shadow & Light add \":sl\" to the end of the health/power tag.\nExample: [health:current:sl]."] = true + +--Movers-- +L["Pet Battle AB"] = true + + +--Changelog-- +L["Changelog"] = true +L["CHANGE_LOG"] = [=[|cff1784d1v1.37|r +- Decimals are once again shown for hp/power texts on unit frames + +|cff1784d1v1.36|r +- Some tweaks to better work with ElvUI 5.20 + +|cff1784d1v1.35|r +- Fixed compatibility with full Location Plus version + +|cff1784d1v1.34|r +Fixed rune bar error when using classbar offset + +|cff1784d1v1.33|r +- Fixed errors on auras tooltips +- Fixed health bar height with classbar offset enabled + +|cff1784d1v1.32|r +- Config updated + +|cff1784d1v1.31|r +- Repooc config updated + +|cff1784d1v1.3|r +- Authors' layouts have been changed +- Mount serach was deleted, Blizzard added that themselves +- Some adjustions for pixel perfect mode to make things look good +- Caster name in auras' tooltips is now profile based option +- An option added to chosee if you want your power text to be on power bar or health bar (health by default as in normal ElvUI) +- Raid Utility options removed. Now it's fully movable with it's own mover +- Added a mover for world/BG pvp score - Hellfire towers, AV reinforcements, AB resources, etc. (Darth grow tired of using MoveAnything) +- Capture bar is now docked to the bottom of a new mover +- Show errors in combat is now profile based option +- Added S&L version number to version datatext, login message and config +- Buttons for resetting all S&L options or just desired group's options have been added +- You can now see changelog in game +- Added alternative mene regen datatext called "MP5". It shows an "mp5" title instead of "mana regen" ]=] \ No newline at end of file diff --git a/ElvUI_SLE/modules/characterframe/characterframe.lua b/ElvUI_SLE/modules/characterframe/characterframe.lua new file mode 100644 index 0000000..993ac39 --- /dev/null +++ b/ElvUI_SLE/modules/characterframe/characterframe.lua @@ -0,0 +1,16 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local CFO = E:NewModule('CharacterFrameOptions', 'AceHook-3.0', 'AceEvent-3.0'); + +function CFO:ToggleCFO() + self:UpdateItemDurability() + self:UpdateItemLevel() +end + +function CFO:Initialize() + self.db = E.db.sle.characterframeoptions + if not E.private.sle.characterframeoptions.enable then return; end + self:LoadDurability() + self:LoadItemLevel() +end + +E:RegisterModule(CFO:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/modules/characterframe/durability.lua b/ElvUI_SLE/modules/characterframe/durability.lua new file mode 100644 index 0000000..1e175db --- /dev/null +++ b/ElvUI_SLE/modules/characterframe/durability.lua @@ -0,0 +1,55 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local CFO = E:GetModule('CharacterFrameOptions') +local LSM = LibStub("LibSharedMedia-3.0") + +local durabilitySlots = { + "HeadSlot","NeckSlot","ShoulderSlot","BackSlot","ChestSlot","WristSlot", + "ShirtSlot","TabardSlot","MainHandSlot","SecondaryHandSlot","HandsSlot","WaistSlot", + "LegsSlot","FeetSlot","Finger0Slot","Finger1Slot","Trinket0Slot","Trinket1Slot" +} + +function CFO:UpdateItemDurability() + local frame = _G["CharacterFrame"] + if not frame:IsShown() then return end + + local slot, current, maximum, r, g, b + for i = 1, #durabilitySlots do + frame = _G[("Character%s"):format(durabilitySlots[i])] + frame.ItemDurability:SetText() + slot = GetInventorySlotInfo(durabilitySlots[i]) + current, maximum = GetInventoryItemDurability(slot) + if current and maximum and current < maximum then + r, g, b = E:ColorGradient((current / maximum), 1, 0, 0, 1, 1, 0, 0, 1, 0) + frame.ItemDurability:SetFormattedText("%s%.0f%%|r", E:RGBToHex(r, g, b), (current / maximum) * 100) + end + if not self.db.itemdurability.enable then + frame.ItemDurability:Hide() + else + frame.ItemDurability:Show() + end + end +end + +function CFO:UpdateItemDurabilityFont() + local frame + for i = 1, #durabilitySlots do + frame = _G[("Character%s"):format(durabilitySlots[i])] + frame.ItemDurability:FontTemplate(LSM:Fetch("font", self.db.itemdurability.font), self.db.itemdurability.fontSize, self.db.itemdurability.fontOutline) + end +end + +function CFO:LoadDurability() + _G["CharacterFrame"]:HookScript("OnShow", function(self) + CFO:UpdateItemDurability() + end) + + self:RegisterEvent("UPDATE_INVENTORY_DURABILITY", "UpdateItemDurability") + + local frame + for i = 1, #durabilitySlots do + frame = _G[("Character%s"):format(durabilitySlots[i])] + frame.ItemDurability = frame:CreateFontString(nil, "OVERLAY") + frame.ItemDurability:SetPoint("BOTTOM", frame, "BOTTOM", 2, 2) + frame.ItemDurability:FontTemplate(LSM:Fetch("font", self.db.itemdurability.font), self.db.itemdurability.fontSize, self.db.itemdurability.fontOutline) + end +end \ No newline at end of file diff --git a/ElvUI_SLE/modules/characterframe/itemlevel.lua b/ElvUI_SLE/modules/characterframe/itemlevel.lua new file mode 100644 index 0000000..e310917 --- /dev/null +++ b/ElvUI_SLE/modules/characterframe/itemlevel.lua @@ -0,0 +1,72 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local CFO = E:GetModule('CharacterFrameOptions') +local LSM = LibStub("LibSharedMedia-3.0") + +local ilvlSlots = { + "HeadSlot","NeckSlot","ShoulderSlot","BackSlot","ChestSlot","WristSlot","MainHandSlot","SecondaryHandSlot", + "HandsSlot","WaistSlot","LegsSlot","FeetSlot","Finger0Slot","Finger1Slot","Trinket0Slot","Trinket1Slot" +} + +function CFO:UpdateItemLevel() + local frame = _G["CharacterFrame"] + if not frame:IsShown() then return end + local itemLink, slot, current, maximum, r, g, b + for i = 1, #ilvlSlots do + frame = _G[("Character%s"):format(ilvlSlots[i])] + frame.ItemLevel:SetText() + local avgItemLevel, avgEquipItemLevel, actualItemLevel + avgItemLevel, avgEquipItemLevel = GetAverageItemLevel() + itemlink = GetInventoryItemLink("player",GetInventorySlotInfo(ilvlSlots[i])) + if itemlink then + local levelAdjust={ -- 11th item:id field and level adjustment + ["0"]=0,["1"]=8,["373"]=4,["374"]=8,["375"]=4,["376"]=4, + ["377"]=4,["379"]=4,["380"]=4,["445"]=0,["446"]=4,["447"]=8, + ["451"]=0,["452"]=8,["453"]=0,["454"]=4,["455"]=8,["456"]=0, + ["457"]=8,["458"]=0,["459"]=4,["460"]=8,["461"]=12,["462"]=16} + local baseLevel = select(4,GetItemInfo(itemlink)) + local upgrade = itemlink:match(":(%d+)\124h%[") + if baseLevel and upgrade then + actualItemLevel = baseLevel + levelAdjust[upgrade] + else + actualItemLevel = baseLevel + end + if actualItemLevel <= avgEquipItemLevel - 10 then + frame.ItemLevel:SetFormattedText("|cffff0000%i|r", actualItemLevel) + elseif actualItemLevel >= avgEquipItemLevel + 10 then + frame.ItemLevel:SetFormattedText("|cff00ff00%i|r", actualItemLevel) + else + frame.ItemLevel:SetFormattedText("|cffffff99%i|r", actualItemLevel) + end + end + if not self.db.itemlevel.enable then + frame.ItemLevel:Hide() + else + frame.ItemLevel:Show() + end + end +end + +function CFO:UpdateItemLevelFont() + local frame + for i = 1, #ilvlSlots do + frame = _G[("Character%s"):format(ilvlSlots[i])] + frame.ItemLevel:FontTemplate(LSM:Fetch("font", self.db.itemlevel.font), self.db.itemlevel.fontSize, self.db.itemlevel.fontOutline) + end +end + +function CFO:LoadItemLevel() + _G["CharacterFrame"]:HookScript("OnShow", function(self) + CFO:UpdateItemLevel() + end) + + self:RegisterEvent("PLAYER_EQUIPMENT_CHANGED", "UpdateItemLevel") + self:RegisterEvent("SOCKET_INFO_UPDATE", "UpdateItemLevel") + + local frame + for i = 1, #ilvlSlots do + frame = _G[("Character%s"):format(ilvlSlots[i])] + frame.ItemLevel = frame:CreateFontString(nil, "OVERLAY") + frame.ItemLevel:SetPoint("TOP", frame, "TOP", 0, -3) + frame.ItemLevel:FontTemplate(LSM:Fetch("font", self.db.itemlevel.font), self.db.itemlevel.fontSize, self.db.itemlevel.fontOutline) + 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 new file mode 100644 index 0000000..1df4e7c --- /dev/null +++ b/ElvUI_SLE/modules/characterframe/load_characterframe.xml @@ -0,0 +1,6 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file='characterframe.lua'/> + <Script file='durability.lua'/> + <Script file='itemlevel.lua'/> + <Script file='options.lua'/> +</Ui> \ No newline at end of file diff --git a/ElvUI_SLE/modules/characterframe/options.lua b/ElvUI_SLE/modules/characterframe/options.lua new file mode 100644 index 0000000..fdd6007 --- /dev/null +++ b/ElvUI_SLE/modules/characterframe/options.lua @@ -0,0 +1,147 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local CFO = E:GetModule('CharacterFrameOptions') + +--UI Buttons +E.Options.args.sle.args.characterframeoptions = { + type = "group", + name = L["Character Frame"], + order = 2, + args = { + header = { + order = 1, + type = "header", + name = L["Character Frame Options"], + }, + intro = { + order = 2, + type = 'description', + name = L['CFO_DESC'], + }, + enable = { + order = 3, + type = "toggle", + name = L["Enable"], + desc = L["Enable/Disable Character Frame Options"], + get = function(info) return E.private.sle.characterframeoptions.enable end, + set = function(info, value) E.private.sle.characterframeoptions.enable = value; E:StaticPopup_Show("PRIVATE_RL") end + }, + itemlevel = { + type = "group", + name = L["Item Level"], + order = 4, + guiInline = true, + disabled = function() return not E.private.sle.characterframeoptions.enable end, + args = { + enable = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Show/Hide Item Levels"], + get = function(info) return E.db.sle.characterframeoptions.itemlevel.enable end, + set = function(info, value) E.db.sle.characterframeoptions.itemlevel.enable = value; CFO:ToggleCFO() end + }, + fontGroup = { + order = 2, + type = 'group', + guiInline = true, + disabled = function() return not E.db.sle.characterframeoptions.itemlevel.enable end, + name = L['Font'], + args = { + font = { + type = "select", dialogControl = 'LSM30_Font', + order = 1, + name = L["Fonts"], + desc = L["The font that the item level will use."], + values = AceGUIWidgetLSMlists.font, + get = function(info) return E.db.sle.characterframeoptions.itemlevel.font end, + set = function(info, value) E.db.sle.characterframeoptions.itemlevel.font = value; CFO:UpdateItemLevelFont(); end, + }, + fontSize = { + order = 2, + name = L["Font Size"], + desc = L["Set the font size that the item level will use."], + type = "range", + min = 6, max = 22, step = 1, + get = function(info) return E.db.sle.characterframeoptions.itemlevel.fontSize end, + set = function(info, value) E.db.sle.characterframeoptions.itemlevel.fontSize = value; CFO:UpdateItemLevelFont(); end, + }, + fontOutline = { + order = 3, + name = L["Font Outline"], + desc = L["Set the font outline that the item level will use."], + type = "select", + values = { + ['NONE'] = L['None'], + ['OUTLINE'] = 'OUTLINE', + ['MONOCHROME'] = 'MONOCHROME', + ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE', + ['THICKOUTLINE'] = 'THICKOUTLINE', + }, + get = function(info) return E.db.sle.characterframeoptions.itemlevel.fontOutline end, + set = function(info, value) E.db.sle.characterframeoptions.itemlevel.fontOutline = value; CFO:UpdateItemLevelFont(); end, + }, + }, + }, + }, + }, + itemdurabilty = { + type = "group", + name = L["Item Durability"], + order = 5, + guiInline = true, + disabled = function() return not E.private.sle.characterframeoptions.enable end, + args = { + enable = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Show/Hide Item Durability"], + get = function(info) return E.db.sle.characterframeoptions.itemdurability.enable end, + set = function(info, value) E.db.sle.characterframeoptions.itemdurability.enable = value; CFO:ToggleCFO() end, + }, + fontGroup = { + order = 2, + type = 'group', + guiInline = true, + disabled = function() return not E.db.sle.characterframeoptions.itemdurability.enable end, + name = L['Font'], + args = { + font = { + type = "select", dialogControl = 'LSM30_Font', + order = 2, + name = L["Font"], + desc = L["The font that the item durability will use."], + values = AceGUIWidgetLSMlists.font, + get = function(info) return E.db.sle.characterframeoptions.itemdurability.font end, + set = function(info, value) E.db.sle.characterframeoptions.itemdurability.font = value; CFO:UpdateItemDurabilityFont(); end, + }, + fontSize = { + order = 2, + name = L["Font Size"], + desc = L["Set the font size that the item durability will use."], + type = "range", + min = 6, max = 22, step = 1, + get = function(info) return E.db.sle.characterframeoptions.itemdurability.fontSize end, + set = function(info, value) E.db.sle.characterframeoptions.itemdurability.fontSize = value; CFO:UpdateItemDurabilityFont(); end, + }, + fontOutline = { + order = 3, + name = L["Font Outline"], + desc = L["Set the font outline that the item durability will use."], + type = "select", + values = { + ['NONE'] = L['None'], + ['OUTLINE'] = 'OUTLINE', + ['MONOCHROME'] = 'MONOCHROME', + ['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE', + ['THICKOUTLINE'] = 'THICKOUTLINE', + }, + get = function(info) return E.db.sle.characterframeoptions.itemdurability.fontOutline end, + set = function(info, value) E.db.sle.characterframeoptions.itemdurability.fontOutline = value; CFO:UpdateItemDurabilityFont(); end, + }, + }, + }, + }, + }, + }, +} \ No newline at end of file diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml index cf1a02d..b0dc867 100644 --- a/ElvUI_SLE/modules/load_modules.xml +++ b/ElvUI_SLE/modules/load_modules.xml @@ -4,6 +4,7 @@ <Script file='pvpmover\pvpmover.lua'/> <Include file='autorelease\load_autorelease.xml'/> <Include file='backgrounds\load_backgrounds.xml'/> + <Include file='characterframe\load_characterframe.xml'/> <Include file='chat\load_chat.xml'/> <Include file='datatexts\load_datatexts.xml'/> <Include file='errors\load_errors.xml'/>