Verified Commit 7fc692d5 authored by Repooc's avatar Repooc
Browse files

Remove text overlay option for equipment sets an replaced with an icon option instead.

parent bcffc533
......@@ -75,6 +75,14 @@ function SLE:UpdateMedia()
E.db.sle.shadows.shadowcolor.g = shadowColor.g
E.db.sle.shadows.shadowcolor.b = shadowColor.b
end
local iconColor = E.db.sle.bags.equipmentmanager.color
if E:CheckClassColor(iconColor.r, iconColor.g, iconColor.b) then
iconColor = E:ClassColor(E.myclass, true)
E.db.sle.bags.equipmentmanager.color.r = iconColor.r
E.db.sle.bags.equipmentmanager.color.g = iconColor.g
E.db.sle.bags.equipmentmanager.color.b = iconColor.b
end
end
function SLE:Initialize()
......
......@@ -10,7 +10,6 @@ V["sle"] = {
["spam"] = false,
["onlyTalent"] = false,
["conditions"] = "",
["setoverlay"] = false,
["lockbutton"] = false,
},
--Minimap Module
......
......@@ -215,6 +215,23 @@ P["sle"] = {
["visibility"] = "show",
},
},
bags = {
equipmentmanager = {
enable = false,
size = 14,
point = 'TOPRIGHT',
xOffset = -1,
yOffset = -1,
icon = 'EQUIPMGR',
customTexture = "",
color = {
r = 1,
g = 0.82,
b = 0,
a = 1,
}
},
},
--Blizzard
["blizzard"] = {
["rumouseover"] = false,
......
......@@ -169,6 +169,7 @@ L["Enables a different look/feel vehicle bar."] = true
L["Enables a shadow for the panel or backdrop of this frame."] = true
L["Enables a shadow on the %s when it's enabled."] = true
L["Enables a small arrow-like indicator on the item slot. Howering over this arrow will show the item this slot is transmogged into."] = true
L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."] = true
L["Enables timers for 2 & 3 chest times in M+"] = true
L["Enabling mouse over will make ElvUI's raid utility show on mouse over instead of always showing."] = true
L["Enchant Scroll Button"] = true
......
......@@ -169,6 +169,7 @@ L["Enables a different look/feel vehicle bar."] = "Permet une barre de véhicule
L["Enables a shadow for the panel or backdrop of this frame."] = true
L["Enables a shadow on the %s when it's enabled."] = true
L["Enables a small arrow-like indicator on the item slot. Howering over this arrow will show the item this slot is transmogged into."] = true
L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."] = true
L["Enables timers for 2 & 3 chest times in M+"] = true
L["Enabling mouse over will make ElvUI's raid utility show on mouse over instead of always showing."] = "En activant le survol de la souris, l'utilitaire de raid d'ElvUI s'affichera au survol de la souris au lieu de toujours s'afficher."
L["Enchant Scroll Button"] = "Bouton de défilement d'enchantement"
......
......@@ -169,6 +169,7 @@ L["Enables a different look/feel vehicle bar."] = "Aktiviert eine andere Fahrzeu
L["Enables a shadow for the panel or backdrop of this frame."] = true
L["Enables a shadow on the %s when it's enabled."] = true
L["Enables a small arrow-like indicator on the item slot. Howering over this arrow will show the item this slot is transmogged into."] = "Aktiviert eine kleine pfeilartige Anzeige im Gegenstandsschlitz. Wenn Sie über diesen Pfeil blicken, wird der Gegenstand angezeigt, in den dieser Steckplatz umgewandelt wurde."
L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."] = true
L["Enables timers for 2 & 3 chest times in M+"] = "Aktiviert Timer für 2 & 3 Chest Zeiten in M+"
L["Enabling mouse over will make ElvUI's raid utility show on mouse over instead of always showing."] = "Durch Aktivieren der Maus wird das RAID-Dienstprogramm von ElvUI bei der Maus angezeigt, anstatt immer angezeigt zu werden."
L["Enchant Scroll Button"] = "Verzauberungs Scrolltaste"
......
......@@ -169,6 +169,7 @@ L["Enables a different look/feel vehicle bar."] = true
L["Enables a shadow for the panel or backdrop of this frame."] = true
L["Enables a shadow on the %s when it's enabled."] = true
L["Enables a small arrow-like indicator on the item slot. Howering over this arrow will show the item this slot is transmogged into."] = true
L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."] = true
L["Enables timers for 2 & 3 chest times in M+"] = true
L["Enabling mouse over will make ElvUI's raid utility show on mouse over instead of always showing."] = "활성화하면 ElvUI 공격대 유틸리티가 항상 표시되는 대신 마우스 오버스에 표시됩니다."
L["Enchant Scroll Button"] = true
......
......@@ -169,6 +169,7 @@ L["Enables a different look/feel vehicle bar."] = "Включить специа
L["Enables a shadow for the panel or backdrop of this frame."] = true
L["Enables a shadow on the %s when it's enabled."] = true
L["Enables a small arrow-like indicator on the item slot. Howering over this arrow will show the item this slot is transmogged into."] = "отображать индикатор в виде стрелки на слоте. При наведении курсора на стрелку будет показываться название предмета трансмогрификации."
L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."] = true
L["Enables timers for 2 & 3 chest times in M+"] = "Включает таймеры на 2 и 3 сундука в ключах"
L["Enabling mouse over will make ElvUI's raid utility show on mouse over instead of always showing."] = "Включение позволит отображать кнопку управления рейдом только при наведении курсора."
L["Enchant Scroll Button"] = "Кнопка зачарования свитка"
......
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local BI = SLE:NewModule('BagInfo', 'AceHook-3.0', 'AceEvent-3.0', 'AceTimer-3.0')
local SLE, _, E = unpack(select(2, ...))
local BI = SLE:NewModule('BagInfo', 'AceHook-3.0', 'AceEvent-3.0')
local B = E:GetModule('Bags')
local _G = _G
local format = format
local byte = string.byte
local updateTimer
BI.containers = {}
BI.infoArray = {}
BI.equipmentMap = {}
local EquipmentManager_UnpackLocation = EquipmentManager_UnpackLocation
local C_EquipmentSet = C_EquipmentSet
local function Utf8Sub(str, start, numChars)
local currentIndex = start
while numChars > 0 and currentIndex <= #str do
local char = byte(str, currentIndex)
if char > 240 then
currentIndex = currentIndex + 4
elseif char > 225 then
currentIndex = currentIndex + 3
elseif char > 192 then
currentIndex = currentIndex + 2
else
currentIndex = currentIndex + 1
end
numChars = numChars -1
end
return str:sub(start, currentIndex - 1)
end
local function MapKey(bag, slot)
return format("%d_%d", bag, slot)
end
local quickFormat = {
[0] = function(font, map) font:SetText() end,
[1] = function(font, map) font:SetFormattedText("|cffffffaa%s|r", Utf8Sub(map[1], 1, 4)) end,
[2] = function(font, map) font:SetFormattedText("|cffffffaa%s %s|r", Utf8Sub(map[1], 1, 4), Utf8Sub(map[2], 1, 4)) end,
[3] = function(font, map) font:SetFormattedText("|cffffffaa%s %s %s|r", Utf8Sub(map[1], 1, 4), Utf8Sub(map[2], 1, 4), Utf8Sub(map[3], 1, 4)) end,
local GetContainerNumSlots = GetContainerNumSlots
local CUSTOM = CUSTOM
local EQUIPMENT_SETS = EQUIPMENT_SETS
--* Used this to help translate known texcoords to a |T |t string
-- CreateTextureMarkup('Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs', 64, 256, 0, 0, 0.01562500, 0.53125000, 0.46875000, 0.60546875, 0, 0)
-- CreateTextureMarkup(file, fileWidth, fileHeight, width, height, left, right, top, bottom, xOffset, yOffset)
-- return ("|T%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d|t"):format(
-- file, height, width, xOffset or 0, yOffset or 0, fileWidth, fileHeight, left * fileWidth, right * fileWidth, top * fileHeight, bottom * fileHeight
-- );
-- end
-- local texture = '|TInterface\\PaperDollInfoFrame\\PaperDollSidebarTabs:20:20:0:0:64:256:1:34:120:155|t'
BI.equipmentmanager = {
icons = {
EQUIPMGR = 'Equipment Manager Icon |TInterface\\PaperDollInfoFrame\\PaperDollSidebarTabs:20:20:0:0:64:256:1:34:120:155|t',
EQUIPLOCK = 'Equipment Lock Icon |TInterface\\AddOns\\ElvUI_SLE\\media\\textures\\lock:14|t',
NEWICON = 'New Feature Icon |TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeatureIcon:14|t',
CUSTOM = CUSTOM,
},
iconLocations = {
EQUIPLOCK = [[Interface\AddOns\ElvUI_SLE\media\textures\lock]],
NEWICON = [[Interface\OptionsFrame\UI-OptionsFrame-NewFeatureIcon]],
},
}
local function BuildEquipmentMap(clear)
-- clear mapped names
for k, v in pairs(BI.equipmentMap) do
wipe(v)
end
local function SetupBags()
for _, bagFrame in pairs(B.BagFrames) do
for _, bagID in ipairs(bagFrame.BagIDs) do
for slotID = 1, GetContainerNumSlots(bagID) do
local button = bagFrame.Bags[bagID][slotID]
if clear then return end
local name, player, bank, bags, slot, bag, key
local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs()
for index = 1, C_EquipmentSet.GetNumEquipmentSets() do
name = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]);
local equipmentSetID = C_EquipmentSet.GetEquipmentSetID(name)
if equipmentSetID then
local SetInfoTable = C_EquipmentSet.GetItemLocations(equipmentSetID)
for _, location in pairs(SetInfoTable) do
if type(location) == "number" and (location < -1 or location > 1) then
player, bank, bags, _, slot, bag = EquipmentManager_UnpackLocation(location)
if ((bank or bags) and slot and bag) then
key = MapKey(bag, slot)
BI.equipmentMap[key] = BI.equipmentMap[key] or {}
tinsert(BI.equipmentMap[key], name)
end
if not button.equipIcon then
button.equipIcon = button:CreateTexture(nil, 'OVERLAY')
button.equipIcon:Hide()
end
end
end
end
end
local function UpdateContainerFrame(frame, bag, slot)
if (not frame.equipmentinfo) then
frame.equipmentinfo = frame:CreateFontString(nil, "OVERLAY")
frame.equipmentinfo:FontTemplate(E.media.font, 12, "THINOUTLINE")
frame.equipmentinfo:SetWordWrap(true)
frame.equipmentinfo:SetJustifyH('CENTER')
frame.equipmentinfo:SetJustifyV('MIDDLE')
function BI:UpdateEquipment()
for _, bagFrame in pairs(B.BagFrames) do
for _, bagID in ipairs(bagFrame.BagIDs) do
for slotID = 1, GetContainerNumSlots(bagID) do
local button = bagFrame.Bags[bagID][slotID]
if not button.equipIcon then
SetupBags()
BI:UpdateSettings()
end
button.equipIcon:SetShown(BI:CheckVisibility(bagFrame, bagID, slotID))
end
end
end
end
if (frame.equipmentinfo) then
frame.equipmentinfo:SetAllPoints(frame)
function BI:CheckVisibility(bagFrame, bagID, slotID)
if not bagFrame or not bagID or not slotID then return end
local button = bagFrame.Bags[bagID][slotID]
local show = false
local key = MapKey(bag, slot)
if BI.equipmentMap[key] then
quickFormat[#BI.equipmentMap[key] < 4 and #BI.equipmentMap[key] or 3](frame.equipmentinfo, BI.equipmentMap[key])
else
quickFormat[0](frame.equipmentinfo, nil)
end
E.ScanTooltip:SetOwner(_G.UIParent, 'ANCHOR_NONE')
if button.GetInventorySlot then -- this fixes bank bagid -1
E.ScanTooltip:SetInventoryItem('player', button:GetInventorySlot())
else
E.ScanTooltip:SetBagItem(bagID, slotID)
end
end
E.ScanTooltip:Show()
local function UpdateBagInformation(clear)
updateTimer = nil
for i = 3, E.ScanTooltip:NumLines() do
local str = _G['ElvUI_ScanTooltipTextLeft' .. i]
local text = str and str:GetText()
BuildEquipmentMap(clear)
for _, container in pairs(BI.containers) do
for _, bagID in ipairs(container.BagIDs) do
for slotID = 1, GetContainerNumSlots(bagID) do
UpdateContainerFrame(container.Bags[bagID][slotID], bagID, slotID)
end
if not text or text == '' then return end
if text:find(EQUIPMENT_SETS:gsub('%%s','.-')) then
show = true
end
end
E.ScanTooltip:Hide()
return E.db.sle.bags.equipmentmanager.enable and show
end
local function DelayUpdateBagInformation(event)
-- delay to make sure multiple bag events are consolidated to one update.
if not updateTimer then
updateTimer = BI:ScheduleTimer(UpdateBagInformation, .25)
function BI:ToggleSettings()
if E.private.sle.equip.setoverlay then
BI:RegisterEvent('EQUIPMENT_SETS_CHANGED', BI.UpdateEquipment)
BI:RegisterEvent('BAG_UPDATE', BI.UpdateEquipment)
BI:RegisterEvent('PLAYERBANKSLOTS_CHANGED', BI.UpdateEquipment)
else
BI:UnregisterEvent('EQUIPMENT_SETS_CHANGED')
BI:UnregisterEvent('BAG_UPDATE')
BI:UnregisterEvent('PLAYERBANKSLOTS_CHANGED')
end
BI:UpdateEquipment()
end
function BI:ToggleSettings()
if updateTimer then
self:CancelTimer(updateTimer)
end
function BI:UpdateSettings()
local db = E.db.sle.bags.equipmentmanager
local texture = db.icon
if E.private.sle.equip.setoverlay then
self:RegisterEvent("EQUIPMENT_SETS_CHANGED", DelayUpdateBagInformation)
self:RegisterEvent("BAG_UPDATE", DelayUpdateBagInformation)
UpdateBagInformation()
else
self:UnregisterEvent("EQUIPMENT_SETS_CHANGED")
self:UnregisterEvent("BAG_UPDATE")
UpdateBagInformation(true)
for _, bagFrame in pairs(B.BagFrames) do
for _, bagID in ipairs(bagFrame.BagIDs) do
for slotID = 1, GetContainerNumSlots(bagID) do
local button = bagFrame.Bags[bagID][slotID]
button.equipIcon:SetSize(db.size, db.size)
button.equipIcon:ClearAllPoints()
button.equipIcon:Point(db.point, db.xOffset, db.yOffset)
if texture == 'EQUIPMGR' then
button.equipIcon:SetTexture('Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs')
button.equipIcon:SetTexCoord(0.01562500, 0.53125000, 0.46875000, 0.60546875)
elseif texture == 'CUSTOM' then
button.equipIcon:SetTexture(db.customTexture)
button.equipIcon:SetTexCoord(0, 0, 0, 1, 1, 0, 1, 1)
else
-- button.equipIcon:SetTexture(3547163)
button.equipIcon:SetTexture(BI.equipmentmanager.iconLocations[texture] or texture)
button.equipIcon:SetTexCoord(0, 0, 0, 1, 1, 0, 1, 1)
end
-- button.equipIcon:SetVertexColor(1, .82, 0, 1)
button.equipIcon:SetVertexColor(db.color.r, db.color.g, db.color.b, db.color.a)
end
end
end
end
function BI:Initialize()
if not SLE.initialized or not E.private.bags.enable then return end
tinsert(BI.containers, _G["ElvUI_ContainerFrame"])
self:SecureHook(B, "OpenBank", function()
self:Unhook(B, "OpenBank")
tinsert(BI.containers, _G["ElvUI_BankContainerFrame"])
SetupBags()
BI:UpdateSettings()
BI:ToggleSettings()
hooksecurefunc(B, 'OpenBank', function()
SetupBags()
BI:UpdateSettings()
BI:ToggleSettings()
end)
BI:ToggleSettings()
end
SLE:RegisterModule(BI:GetName())
\ No newline at end of file
SLE:RegisterModule(BI:GetName())
local SLE, T, E, L, _, P = unpack(select(2, ...))
local BI = SLE:GetModule('BagInfo')
local function configTable()
if not SLE.initialized then return end
E.Options.args.sle.args.modules.args.bags = {
type = 'group',
order = 1,
name = L["Bags"],
args = {
equipmentmanager = {
order = 1,
type = 'group',
name = L["Equipment Manager"],
guiInline = true,
get = function(info) return E.db.sle.bags.equipmentmanager[info[#info]] end,
set = function(info, value) E.db.sle.bags.equipmentmanager[info[#info]] = value; BI:UpdateSettings() end,
args = {
enable = {
order = 1,
type = 'toggle',
name = L["Enable"],
desc = L["Enables an indicator on equipment icons located in your bags to show if they are part of an equipment set."],
set = function(info, value) E.db.sle.bags.equipmentmanager[info[#info]] = value; BI:ToggleSettings() end,
},
size = {
order = 2,
type = 'range',
name = L["Size"],
min = 8, max = 64, step = 1,
},
point = {
order = 3,
type = 'select',
name = L["Anchor Point"],
values = T.Values.positionValues,
},
xOffset = {
order = 4,
type = 'range',
name = L["X-Offset"],
min = -64, max = 64, step = 1,
},
yOffset = {
order = 5,
type = 'range',
name = L["Y-Offset"],
min = -64, max = 64, step = 1,
},
icon = {
order = 6,
type = 'select',
name = L["Icon"],
values = function() return BI.equipmentmanager.icons end,
},
customTexture = {
order = 7,
type = 'input',
name = L["Custom Texture"],
desc = L["You can use a file id or path.\nFile id as an example.\niconFileID: 3547163\n\nAlready an option but showing as a path example.\nPath: Interface\\AddOns\\ElvUI_SLE\\media\\textures\\lock"],
width = 'double',
hidden = function() return E.db.sle.bags.equipmentmanager.icon ~= 'CUSTOM' end
},
color = {
order = 8,
type = 'color',
name = COLOR,
hasAlpha = true,
get = function(info)
local t = E.db.sle.bags.equipmentmanager[info[#info]]
local d = P.sle.bags.equipmentmanager[info[#info]]
return t.r, t.g, t.b, t.a, d.r, d.g, d.b, d.a
end,
set = function(info, r, g, b, a)
local t = E.db.sle.bags.equipmentmanager[info[#info]]
t.r, t.g, t.b, t.a = r, g, b, a
BI:UpdateSettings()
end,
},
},
},
},
}
end
tinsert(SLE.Configs, configTable)
......@@ -106,15 +106,6 @@ local function configTable()
get = function(info) return EM.db.enable end,
set = function(info, value) EM.db.enable = value; E:StaticPopup_Show("PRIVATE_RL") end
},
setoverlay = {
type = "toggle",
order = 5,
name = L["Equipment Set Overlay"],
desc = L["Show the associated equipment sets for the items in your bags (or bank)."],
disabled = function() return not E.private.bags.enable end,
get = function(info) return EM.db.setoverlay end,
set = function(info, value) EM.db.setoverlay = value; SLE:GetModule('BagInfo'):ToggleSettings(); end,
},
lockbutton = {
order = 6,
type = "toggle",
......
......@@ -13,6 +13,7 @@
<Include file='minimap\load_minimap.xml'/>
<Include file='datatexts\load_datatexts.xml'/>
<Script file='actionbars_c.lua'/>
<Script file='bags_c.lua'/>
<Script file='blizzard_c.lua'/>
<Script file='help_c.lua'/>
<Script file='media_c.lua'/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment