diff --git a/ElvUI_SLE/modules/dashboard/dashboard.lua b/ElvUI_SLE/modules/dashboard/dashboard.lua new file mode 100644 index 0000000..ffe016a --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/dashboard.lua @@ -0,0 +1,87 @@ +--[[ Dashboard for ElvUI +Credits : Sinaris, Elv +made for ElvUI under Sinaris permission. Big thanks :) +]] + +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB +local DTP = E:GetModule('SLE_DTPanels') +local DT = E:GetModule('DataTexts') +local LSM = LibStub("LibSharedMedia-3.0") +if E.db.sle == nil then E.db.sle = {} end +if E.db.sle.datatext == nil then E.db.sle.datatext = {} end +if E.db.sle.datatext.dashboard == nil then E.db.sle.datatext.dashboard = {} end +if E.db.sle.datatext.dashboard.width == nil then E.db.sle.datatext.dashboard.width = 100 end +local DTPANELS_WIDTH = E.db.sle.datatext.dashboard.width +local DTPANELS_HEIGHT = 20 +local PANEL_SPACING = 1 +local font = LSM:Fetch("font", E.db.datatexts.font) +local fontsize = E.db.datatexts.fontSize +local outline = E.db.datatexts.fontOutline + +local board = {} + +local bholder = CreateFrame("Frame", "BoardsHolder", E.UIParent) +bholder:Point('TOPLEFT', E.UIParent, 'TOPLEFT', 0, -21) +bholder:Size(((DTPANELS_WIDTH*4)+(PANEL_SPACING*3)), DTPANELS_HEIGHT) + +E:CreateMover(BoardsHolder, "Dashboard", L["Dashboard"], nil, nil, nil, "ALL,S&L,S&L MISC") + +local board = CreateFrame('frame', 'board', BoardsHolder) + +for i = 1, 4 do + board[i] = CreateFrame('frame', 'board'..i, bholder) + board[i]:SetFrameLevel(2) + board[i]:Size(DTPANELS_WIDTH, DTPANELS_HEIGHT) + board[i]:SetTemplate('Default', true) + board[i]:CreateShadow('Default') + + if i == 1 then + board[i]:Point('TOPLEFT', bholder, 'TOPLEFT', 0, 0) + else + board[i]:Point('LEFT', board[i-1], 'RIGHT', PANEL_SPACING, 0) + end + + board[i].Status = CreateFrame("StatusBar", "PanelStatus" .. i, board[i]) + board[i].Status:SetFrameLevel(12) + board[i].Status:SetStatusBarTexture(E["media"].normTex) + board[i].Status:SetMinMaxValues(0, 100) + board[i].Status:SetStatusBarColor(.4, .4, .4, 1) + board[i].Status:Point("TOPLEFT", board[i], "TOPLEFT", 2, -2) + board[i].Status:Point("BOTTOMRIGHT", board[i], "BOTTOMRIGHT", -2, 2) + + board[i].Text = board[i].Status:CreateFontString( nil, "OVERLAY" ) + board[i].Text:FontTemplate() + board[i].Text:SetFont(font, fontsize, outline) + board[i].Text:Point("LEFT", board[i], "LEFT", 3, 0) + board[i].Text:SetJustifyV('MIDDLE') + board[i].Text:SetShadowColor(0, 0, 0) + board[i].Text:SetShadowOffset(1.25, -1.25) +end + +function DTP:DashboardShow() + if E.db.sle.datatext.dashboard.enable then + E.FrameLocks['BoardsHolder'] = true + BoardsHolder:Show() + else + E.FrameLocks['BoardsHolder'] = nil + BoardsHolder:Hide() + end +end + +DT.LoadDataTextsSLE = DT.LoadDataTexts +function DT:LoadDataTexts() + DT.LoadDataTextsSLE(self) + font = LSM:Fetch("font", E.db.datatexts.font) + fontsize = E.db.datatexts.fontSize + outline = E.db.datatexts.fontOutline + for i = 1, 4 do + board[i].Text:SetFont(font, fontsize, outline) + end +end + +function DTP:DashWidth() + for i = 1, 4 do + board[i]:Size(E.db.sle.datatext.dashboard.width, DTPANELS_HEIGHT) + end + bholder:Size(((E.db.sle.datatext.dashboard.width*4)+(PANEL_SPACING*3)), DTPANELS_HEIGHT) +end \ No newline at end of file diff --git a/ElvUI_SLE/modules/dashboard/datapanels/bags.lua b/ElvUI_SLE/modules/dashboard/datapanels/bags.lua new file mode 100644 index 0000000..5545571 --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/datapanels/bags.lua @@ -0,0 +1,25 @@ +local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB + +local LastUpdate = 1 + +board[2].Status:SetScript("OnUpdate", function(self) + local free, total, used = 0, 0, 0 + for i = 0, NUM_BAG_SLOTS do + free, total = free + GetContainerNumFreeSlots(i), total + GetContainerNumSlots(i) + end + used = total - free + value = (used * 120 / total) + + self:SetMinMaxValues(0, total) + self:SetValue(used) + board[2].Text:SetText(L["Bags"]..": " .. used .. " /" .. total) + if(used * 100 / total >= 75) then + self:SetStatusBarColor(1, 75 / 255, 75 / 255, 0.5, .8) + elseif used * 100 / total < 75 and used * 100 / total > 40 then + self:SetStatusBarColor(1, 180 / 255, 0, .8) + else + self:SetStatusBarColor(30 / 255, 1, 30 / 255, .8) + end +end) + +board[2].Status:RegisterEvent("BAG_UPDATE") diff --git a/ElvUI_SLE/modules/dashboard/datapanels/durability.lua b/ElvUI_SLE/modules/dashboard/datapanels/durability.lua new file mode 100644 index 0000000..81ac536 --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/datapanels/durability.lua @@ -0,0 +1,65 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB + +local displayString = "" +local total, totalDurability, totalPerc = 0, 0, 0 +local current, max, lastPanel +local invDurability = {} + +local slots = { + ["SecondaryHandSlot"] = L['Offhand'], + ["MainHandSlot"] = L['Main Hand'], + ["FeetSlot"] = L['Feet'], + ["LegsSlot"] = L['Legs'], + ["HandsSlot"] = L['Hands'], + ["WristSlot"] = L['Wrist'], + ["WaistSlot"] = L['Waist'], + ["ChestSlot"] = L['Chest'], + ["ShoulderSlot"] = L['Shoulder'], + ["HeadSlot"] = L['Head'], +} + +board[1].Status:SetScript("OnEvent", function( self, ...) + + lastPanel = self + total = 0 + totalDurability = 0 + totalPerc = 0 + + for index, value in pairs(slots) do + local slot = GetInventorySlotInfo(index) + current, max = GetInventoryItemDurability(slot) + + if current then + totalDurability = totalDurability + current + invDurability[value] = (current/max)*100 + totalPerc = totalPerc + (current/max)*100 + total = total + 1 + end + end + + result = totalPerc/total + + if total > 0 then + board[1].Text:SetFormattedText(displayString, result) + end + + self:SetMinMaxValues(0, 100) + self:SetValue(result) + + if( result >= 75 ) then + self:SetStatusBarColor(30 / 255, 1, 30 / 255, .8) + elseif result < 75 and result > 40 then + self:SetStatusBarColor(1, 180 / 255, 0, .8) + else + self:SetStatusBarColor(1, 75 / 255, 75 / 255, 0.5, .8) + end +end) + +local function ValueColorUpdate(hex, r, g, b) + displayString = string.join("", DURABILITY, ": ", hex, "%d%%|r") +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +board[1].Status:RegisterEvent("UPDATE_INVENTORY_DURABILITY") +board[1].Status:RegisterEvent("MERCHANT_SHOW") +board[1].Status:RegisterEvent("PLAYER_ENTERING_WORLD") \ No newline at end of file diff --git a/ElvUI_SLE/modules/dashboard/datapanels/fps.lua b/ElvUI_SLE/modules/dashboard/datapanels/fps.lua new file mode 100644 index 0000000..73be1b0 --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/datapanels/fps.lua @@ -0,0 +1,23 @@ +local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB + +local LastUpdate = 1 + +board[3].Status:SetScript("OnUpdate", function( self, elapsed) + LastUpdate = LastUpdate - elapsed + + if(LastUpdate < 0) then + self:SetMinMaxValues(0, 200) + local value = floor(GetFramerate()) + local max = 120 + self:SetValue(value) + board[3].Text:SetText("FPS: " .. value) + if(value * 100 / max >= 75) then + self:SetStatusBarColor(30 / 255, 1, 30 / 255, .8) + elseif value * 100 / max < 75 and value * 100 / max > 40 then + self:SetStatusBarColor(1, 180 / 255, 0, .8) + else + self:SetStatusBarColor(1, 75 / 255, 75 / 255, 0.5, .8) + end + LastUpdate = 1 + end +end) diff --git a/ElvUI_SLE/modules/dashboard/datapanels/ms.lua b/ElvUI_SLE/modules/dashboard/datapanels/ms.lua new file mode 100644 index 0000000..11653d5 --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/datapanels/ms.lua @@ -0,0 +1,24 @@ +local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB + +local LastUpdate = 1 + +board[4].Status:SetScript("OnUpdate", function(self, elapsed) + LastUpdate = LastUpdate - elapsed + + if(LastUpdate < 0) then + self:SetMinMaxValues(0, 200) + local value = (select( 3, GetNetStats())) + local max = 200 + self:SetValue(value) + board[4].Text:SetText("MS: " .. value) + + if( value * 100 / max <= 35) then + self:SetStatusBarColor(30 / 255, 1, 30 / 255, .8) + elseif value * 100 / max > 35 and value * 100 / max < 75 then + self:SetStatusBarColor(1, 180 / 255, 0, .8) + else + self:SetStatusBarColor(1, 75 / 255, 75 / 255, 0.5, .8) + end + LastUpdate = 1 + end +end) diff --git a/ElvUI_SLE/modules/dashboard/load_dashboard.xml b/ElvUI_SLE/modules/dashboard/load_dashboard.xml new file mode 100644 index 0000000..c77944e --- /dev/null +++ b/ElvUI_SLE/modules/dashboard/load_dashboard.xml @@ -0,0 +1,7 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file="dashboard.lua"/> + <Script file="datapanels\durability.lua"/> + <Script file="datapanels\bags.lua"/> + <Script file="datapanels\fps.lua"/> + <Script file="datapanels\ms.lua"/> +</Ui> \ No newline at end of file diff --git a/ElvUI_SLE/modules/datatexts.lua b/ElvUI_SLE/modules/datatexts.lua new file mode 100644 index 0000000..a3f2c16 --- /dev/null +++ b/ElvUI_SLE/modules/datatexts.lua @@ -0,0 +1,110 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +-- local DTP = E:NewModule('SLE_DTPanels', 'AceHook-3.0', 'AceEvent-3.0'); +local DTP = E:GetModule('SLE_DTPanels'); +local DT = E:GetModule('DataTexts'); +local LO = E:GetModule('Layout'); +local dp1 = CreateFrame('Frame', "DP_1", E.UIParent) +local dp2 = CreateFrame('Frame', "DP_2", E.UIParent) +local dp3 = CreateFrame('Frame', "DP_3", E.UIParent) +local dp4 = CreateFrame('Frame', "DP_4", E.UIParent) +local dp5 = CreateFrame('Frame', "DP_5", E.UIParent) +local dp6 = CreateFrame('Frame', "DP_6", E.UIParent) +local top = CreateFrame('Frame', "Top_Center", E.UIParent) +local bottom = CreateFrame('Frame', "Bottom_Panel", E.UIParent) +local rchat = CreateFrame('Frame', "Right_Chat_SLE", E.UIParent) +local lchat = CreateFrame('Frame', "Left_Chat_SLE", E.UIParent) + +local panels = { + --Panel = short, name, point, x, panel, slot + DP_1 = {"dp1", "DP_1", "TOPLEFT", 0, DP_1, 3}, + DP_2 = {"dp2", "DP_2", "TOP", -(E.screenwidth/5), DP_2, 3}, + DP_3 = {"dp3", "DP_3", "TOP", (E.screenwidth/5), DP_3, 3}, + DP_4 = {"dp4", "DP_4", "TOPRIGHT", 0, DP_4, 3}, + DP_5 = {"dp5", "DP_5", "BOTTOM", -(E.screenwidth/6 - 15), DP_5, 3}, + DP_6 = {"dp6", "DP_6", "BOTTOM", (E.screenwidth/6 - 15), DP_6, 3}, + Top_Center = {"top", "Top_Center", "TOP", 0, Top_Center, 1}, + Bottom_Panel = {"bottom", "Bottom_Panel", "BOTTOM", 0, Bottom_Panel, 1}, +} + +--Added function to create new panels +LO.InitializeSLE = LO.Initialize +function LO:Initialize() + LO.InitializeSLE(self) + for _,v in pairs(panels) do + DTP:CreateDataPanels(v[5], v[2], v[3], v[4], v[6], v[1]) + end + DTP:Resize() + + for _,v in pairs(panels) do + E:CreateMover(v[5], v[2].."_Mover", L[v[2]], nil, nil, nil, "ALL,S&L,S&L DT") + end +end + +-- New panels +function DTP:CreateDataPanels(panel, name, point, x, slot, short) + panel:SetFrameStrata('LOW') + panel:Point(point, E.UIParent, point, x, 0); + DT:RegisterPanel(panel, slot, 'ANCHOR_BOTTOM', 0, -4) + panel:Hide() +end + +function DTP:Resize() + local db = E.db.sle.datatext + for _,v in pairs(panels) do + v[5]:Size(db[v[1]].width, 20) + end + DT:UpdateAllDimensions() +end + +function DTP:ChatResize() + LeftChatDataPanel:Point('TOPRIGHT', LeftChatPanel, 'BOTTOMLEFT', 16 + E.db.sle.datatext.chatleft.width, (E.PixelMode and 1 or -1)) + RightChatDataPanel:Point('BOTTOMLEFT', RightChatPanel, 'BOTTOMRIGHT', - E.db.sle.datatext.chatright.width - 16, (E.PixelMode and -19 or -21)) +end + +--Showing panels +function DTP:ExtraDataBarSetup() + local db = E.db.sle.datatext + for _,v in pairs(panels) do + if db[v[1]].enabled then + v[5]:Show() + else + v[5]:Hide() + end + if not E.private.sle.datatext[v[1].."hide"] then + if db[v[1]].transparent then + v[5]:SetTemplate("Transparent") + else + v[5]:SetTemplate("Default", true) + end + end + end +end + +function DTP:Update() + DTP:ExtraDataBarSetup() + DTP:Resize() +end + +function DTP:RegisterHide() + local db = E.db.sle.datatext + for k,v in pairs(panels) do + if db[v[1]].pethide then + E.FrameLocks[k] = true + else + E.FrameLocks[k] = nil + end + end +end + +--Renew panels after loading screens +function DTP:PLAYER_ENTERING_WORLD(...) + DTP:ExtraDataBarSetup() + DTP:RegisterHide() + self:UnregisterEvent("PLAYER_ENTERING_WORLD"); +end + +function DTP:Initialize() + DTP:RegisterEvent('PLAYER_ENTERING_WORLD') +end + +-- E:RegisterModule(DTP:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/agility.lua b/ElvUI_SLE/modules/sledatatexts/agility.lua new file mode 100644 index 0000000..96d73db --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/agility.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, AGILITY_COLON, select(2, UnitStat("player", 2))) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Agility', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/currency.lua b/ElvUI_SLE/modules/sledatatexts/currency.lua new file mode 100644 index 0000000..59b3057 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/currency.lua @@ -0,0 +1,290 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') +local SLE = E:GetModule('SLE') + +local format, floor, abs, mod, pairs, tinsert = format, floor, abs, mod, pairs, tinsert +local GetMoney, GetCurrencyInfo, GetNumWatchedTokens, GetBackpackCurrencyInfo, UnitLevel, GetCurrencyListInfo = GetMoney, GetCurrencyInfo, GetNumWatchedTokens, GetBackpackCurrencyInfo, UnitLevel, GetCurrencyListInfo + +local join = string.join + +local defaultColor = { 1, 1, 1 } +local Profit = 0 +local Spent = 0 +local copperFormatter = join("", "%d", L.copperabbrev) +local silverFormatter = join("", "%d", L.silverabbrev, " %.2d", L.copperabbrev) +local goldFormatter = join("", "%s", L.goldabbrev, " %.2d", L.silverabbrev, " %.2d", L.copperabbrev) +local resetInfoFormatter = join("", "|cffaaaaaa", L["Reset Data: Hold Shift + Right Click"], "|r") +local JEWELCRAFTING, COOKING, ARCHAEOLOGY + +local ArchaeologyFragments = { 398, 384, 393, 677, 400, 394, 397, 676, 401, 385, 399 } +local CookingAwards = { 81, 402 } +local JewelcraftingTokens = { 61, 361, 698 } +local DungeonRaid = { 776, 752, 697, 738, 615, 614, 395, 396 } +local PvPPoints = { 390, 392, 391 } +local MiscellaneousCurrency = { 241, 416, 515, 777 } + +local _, Faction = UnitFactionGroup('player') +local HordeColor = RAID_CLASS_COLORS['DEATHKNIGHT'] +local AllianceColor = RAID_CLASS_COLORS['SHAMAN'] + +local function OrderedPairs(t, f) + local function orderednext(t, n) + local key = t[t.__next] + if not key then return end + t.__next = t.__next + 1 + return key, t.__source[key] + end + + local keys, kn = {__source = t, __next = 1}, 1 + for k in pairs(t) do + keys[kn], kn = k, kn + 1 + end + sort(keys, f) + return orderednext, keys +end + +V['ElvUI_Currency'] = { + ['Archaeology'] = true, + ['Jewelcrafting'] = true, + ['PvP'] = true, + ['Raid'] = true, + ['Cooking'] = true, + ['Miscellaneous'] = true, + ['Zero'] = true, + ['Icons'] = true, + ['Faction'] = true, + ['Unused'] = true, +} + +local function ToggleOption(name) + if E.private['ElvUI_Currency'][name] then + E.private['ElvUI_Currency'][name] = false + else + E.private['ElvUI_Currency'][name] = true + end +end + +local function GetOption(name) + return E.private['ElvUI_Currency'][name] +end + +local menu = { + { text = L['ElvUI Improved Currency Options'], isTitle = true , notCheckable = true }, + { text = L['Show Archaeology Fragments'], checked = function() return GetOption('Archaeology') end, func = function() ToggleOption('Archaeology') end }, + { text = L['Show Jewelcrafting Tokens'], checked = function() return GetOption('Jewelcrafting') end, func = function() ToggleOption('Jewelcrafting') end }, + { text = L['Show Player vs Player Currency'], checked = function() return GetOption('PvP') end, func = function() ToggleOption('PvP') end }, + { text = L['Show Dungeon and Raid Currency'], checked = function() return GetOption('Raid') end, func = function() ToggleOption('Raid') end }, + { text = L['Show Cooking Awards'], checked = function() return GetOption('Cooking') end, func = function() ToggleOption('Cooking') end }, + { text = L['Show Miscellaneous Currency'], checked = function() return GetOption('Miscellaneous') end, func = function() ToggleOption('Miscellaneous') end }, + { text = L['Show Zero Currency'], checked = function() return GetOption('Zero') end, func = function() ToggleOption('Zero') end }, + { text = L['Show Icons'], checked = function() return GetOption('Icons') end, func = function() ToggleOption('Icons') end }, + { text = L['Show Faction Totals'], checked = function() return GetOption('Faction') end, func = function() ToggleOption('Faction') end }, + { text = L['Show Unsed Currency'], checked = function() return GetOption('Unused') end, func = function() ToggleOption('Unused') end }, +} + +local HiddenCurrency = {} + +local function UnusedCheck() + if GetOption('Unused') then HiddenCurrency = {}; return end + for i = 1, GetCurrencyListSize() do + local name, _, _, isUnused = GetCurrencyListInfo(i) + if isUnused then + if not SLE:SimpleTable(HiddenCurrency, name) then + table.insert(HiddenCurrency,#(HiddenCurrency)+1, name) + end + else + if SLE:SimpleTable(HiddenCurrency, name) then + HiddenCurrency[i] = nil + end + end + end +end + +local menuFrame = CreateFrame("Frame", "ElvUI_CurrencyMenuFrame", UIParent, 'UIDropDownMenuTemplate') + +local function GetCurrency(CurrencyTable, Text) + local Seperator = false + UnusedCheck() + for key, id in pairs(CurrencyTable) do + local name, amount, texture, week, weekmax, maxed, discovered = GetCurrencyInfo(id) + local LeftString = GetOption('Icons') and format('%s %s', format('|T%s:14:14:0:0:64:64:4:60:4:60|t', texture), name) or name + local RightString = amount + local unused = SLE:SimpleTable(HiddenCurrency, name) or nil + + if id == 392 or id == 395 then + maxed = 4000 + elseif id == 396 then + maxed = 3000 + end + + if id == 390 then + discovered = UnitLevel('player') >= SHOW_CONQUEST_LEVEL + RightString = format('%s %s | %s %s / %s', L['Current:'], amount, L['Weekly:'], week, weekmax) + elseif maxed <= 4000 and maxed > 0 then + RightString = format('%s / %s', amount, maxed) + end + + local r1, g1, b1 = 1, 1, 1 + for i = 1, GetNumWatchedTokens() do + local _, _, _, itemID = GetBackpackCurrencyInfo(i) + if id == itemID then + r1, g1, b1 = .24, .54, .78 + end + end + local r2, g2, b2 = r1, g1, b1 + if maxed > 0 and (amount == maxed) or weekmax > 0 and (week == weekmax) then r2, g2, b2 = .77, .12, .23 end + if not (amount == 0 and not GetOption('Zero') and r1 == 1) and discovered and not unused then + if not Seperator then + DT.tooltip:AddLine(' ') + DT.tooltip:AddLine(Text) + Seperator = true + end + DT.tooltip:AddDoubleLine(LeftString, RightString, r1, g1, b1, r2, g2, b2) + end + end +end + +local function FormatMoney(money) + local gold, silver, copper = floor(abs(money / 10000)), abs(mod(money / 100, 100)), abs(mod(money, 100)) + if gold ~= 0 then + return format(goldFormatter, BreakUpLargeNumbers(gold), silver, copper) + elseif silver ~= 0 then + return format(silverFormatter, silver, copper) + else + return format(copperFormatter, copper) + end +end + +local function FormatTooltipMoney(money) + if not money then return end + local gold, silver, copper = floor(abs(money / 10000)), abs(mod(money / 100, 100)), abs(mod(money, 100)) + return format(goldFormatter, BreakUpLargeNumbers(gold), silver, copper) +end + +local function OnEvent(self, event, ...) + if not IsLoggedIn() then return end + local NewMoney = GetMoney(); + ElvDB = ElvDB or { }; + ElvDB['gold'] = ElvDB['gold'] or {}; + ElvDB['gold'][E.myrealm] = ElvDB['gold'][E.myrealm] or {}; + ElvDB['gold'][E.myrealm][E.myname] = ElvDB['gold'][E.myrealm][E.myname] or NewMoney; + ElvDB['class'] = ElvDB['class'] or {}; + ElvDB['class'][E.myrealm] = ElvDB['class'][E.myrealm] or {}; + ElvDB['class'][E.myrealm][E.myname] = select(2, UnitClass('player')) + ElvDB['faction'] = ElvDB['faction'] or {}; + ElvDB['faction'][E.myrealm] = ElvDB['faction'][E.myrealm] or {}; + ElvDB['faction'][E.myrealm][FACTION_HORDE] = ElvDB['faction'][E.myrealm][FACTION_HORDE] or {}; + ElvDB['faction'][E.myrealm][FACTION_ALLIANCE] = ElvDB['faction'][E.myrealm][FACTION_ALLIANCE] or {}; + + local OldMoney = ElvDB['gold'][E.myrealm][E.myname] or NewMoney + + local Change = NewMoney-OldMoney -- Positive if we gain money + if OldMoney>NewMoney then -- Lost Money + Spent = Spent - Change + else -- Gained Moeny + Profit = Profit + Change + end + + self.text:SetText(FormatMoney(NewMoney)) + + ElvDB['gold'][E.myrealm][E.myname] = NewMoney + ElvDB['faction'][E.myrealm][Faction][E.myname] = NewMoney + if event == 'PLAYER_ENTERING_WORLD' or event == 'SPELLS_CHANGED' then + JEWELCRAFTING = nil + for k, v in pairs({GetProfessions()}) do + if v then + local name, _, _, _, _, _, skillid = GetProfessionInfo(v) + if skillid == 755 then + JEWELCRAFTING = name + elseif skillid == 185 then + COOKING = name + elseif skillid == 794 then + ARCHAEOLOGY = name + end + end + end + end +end + +local function Click(self, btn) + if btn == "RightButton" then + if IsShiftKeyDown() then + ElvDB.gold = nil; + OnEvent(self) + DT.tooltip:Hide(); + else + EasyMenu(menu, menuFrame, 'cursor', 0, 0, 'MENU', 2) + --[[ + menuFrame.point = 'CENTER' + menuFrame.relativePoint = 'CENTER' + E:DropDown(menu, menuFrame);]] + end + else + ToggleAllBags() + end +end + +local function OnEnter(self) + DT:SetupTooltip(self) + + DT.tooltip:AddLine(L['Session:']) + DT.tooltip:AddDoubleLine(L["Earned:"], FormatMoney(Profit), 1, 1, 1, 1, 1, 1) + DT.tooltip:AddDoubleLine(L["Spent:"], FormatMoney(Spent), 1, 1, 1, 1, 1, 1) + if Profit < Spent then + DT.tooltip:AddDoubleLine(L["Deficit:"], FormatMoney(Profit-Spent), 1, 0, 0, 1, 1, 1) + elseif (Profit-Spent)>0 then + DT.tooltip:AddDoubleLine(L["Profit:"], FormatMoney(Profit-Spent), 0, 1, 0, 1, 1, 1) + end + DT.tooltip:AddLine' ' + + local totalGold, AllianceGold, HordeGold = 0, 0, 0 + DT.tooltip:AddLine(L["Character: "]) + for k,_ in OrderedPairs(ElvDB['gold'][E.myrealm]) do + if ElvDB['gold'][E.myrealm][k] then + local class = ElvDB['class'][E.myrealm][k] + local color = RAID_CLASS_COLORS[class or 'PRIEST'] + DT.tooltip:AddDoubleLine(k, FormatTooltipMoney(ElvDB['gold'][E.myrealm][k]), color.r, color.g, color.b, 1, 1, 1) + if ElvDB['faction'][E.myrealm][FACTION_ALLIANCE][k] then + AllianceGold = AllianceGold + ElvDB['gold'][E.myrealm][k] + end + if ElvDB['faction'][E.myrealm][FACTION_HORDE][k] then + HordeGold = HordeGold + ElvDB['gold'][E.myrealm][k] + end + totalGold = totalGold + ElvDB['gold'][E.myrealm][k] + end + end + + DT.tooltip:AddLine' ' + DT.tooltip:AddLine(L["Server: "]) + if GetOption('Faction') then + DT.tooltip:AddDoubleLine(format('%s: ', FACTION_HORDE), FormatTooltipMoney(HordeGold), HordeColor.r, HordeColor.g, HordeColor.b, 1, 1, 1) + DT.tooltip:AddDoubleLine(format('%s: ', FACTION_ALLIANCE), FormatTooltipMoney(AllianceGold), AllianceColor.r, AllianceColor.g, AllianceColor.b, 1, 1, 1) + end + DT.tooltip:AddDoubleLine(L["Total: "], FormatTooltipMoney(totalGold), 1, 1, 1, 1, 1, 1) + + if ARCHAEOLOGY ~= nil and GetOption('Archaeology') then + GetCurrency(ArchaeologyFragments, format('%s %s:', ARCHAEOLOGY, ARCHAEOLOGY_RUNE_STONES)) + end + if COOKING ~= nil and GetOption('Cooking') then + GetCurrency(CookingAwards, format("%s:", COOKING)) + end + if JEWELCRAFTING ~= nil and GetOption('Jewelcrafting') then + GetCurrency(JewelcraftingTokens, format("%s:", JEWELCRAFTING)) + end + if GetOption('Raid') then + GetCurrency(DungeonRaid, format('%s & %s:', CALENDAR_TYPE_DUNGEON, CALENDAR_TYPE_RAID)) + end + if GetOption('PvP') then + GetCurrency(PvPPoints, format("%s:", PLAYER_V_PLAYER)) + end + if GetOption('Miscellaneous') then + GetCurrency(MiscellaneousCurrency, format("%s:", MISCELLANEOUS)) + end + + DT.tooltip:AddLine' ' + DT.tooltip:AddLine(resetInfoFormatter) + + DT.tooltip:Show() +end + +DT:RegisterDatatext('S&L Currency', {'PLAYER_ENTERING_WORLD', 'PLAYER_MONEY', 'SEND_MAIL_MONEY_CHANGED', 'SEND_MAIL_COD_CHANGED', 'PLAYER_TRADE_MONEY', 'TRADE_MONEY_CHANGED', 'SPELLS_CHANGED'}, OnEvent, nil, Click, OnEnter) \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/energyregen.lua b/ElvUI_SLE/modules/sledatatexts/energyregen.lua new file mode 100644 index 0000000..5e56dd9 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/energyregen.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, STAT_ENERGY_REGEN, GetPowerRegen()) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s: ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Energy Regen', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/friends.lua b/ElvUI_SLE/modules/sledatatexts/friends.lua new file mode 100644 index 0000000..fda3df0 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/friends.lua @@ -0,0 +1,564 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local LibQTip = LibStub('LibQTip-1.0') +local ACD = LibStub("AceConfigDialog-3.0") +local DT = E:GetModule('DataTexts') +local LDB = LibStub("LibDataBroker-1.1"):NewDataObject("S&L Friends", +{ + type = "data source", + icon = "Interface\\Icons\\INV_Drink_08.png", + label = "S&L Friends", + text = "S&L Friends" +}) +local _G = getfenv(0) +local string = _G.string +local pairs = _G.pairs +local ONE_MINUTE = 60; +local ONE_HOUR = 60 * ONE_MINUTE; +local ONE_DAY = 24 * ONE_HOUR; +local ONE_MONTH = 30 * ONE_DAY; +local ONE_YEAR = 12 * ONE_MONTH; + +local function sletime_Conversion(timeDifference, isAbsolute) + if ( not isAbsolute ) then + timeDifference = time() - timeDifference; + end + local year, month, day, hour, minute; + + if ( timeDifference < ONE_MINUTE ) then + return LASTONLINE_SECS; + elseif ( timeDifference >= ONE_MINUTE and timeDifference < ONE_HOUR ) then + return format(LASTONLINE_MINUTES, floor(timeDifference / ONE_MINUTE)); + elseif ( timeDifference >= ONE_HOUR and timeDifference < ONE_DAY ) then + return format(LASTONLINE_HOURS, floor(timeDifference / ONE_HOUR)); + elseif ( timeDifference >= ONE_DAY and timeDifference < ONE_MONTH ) then + return format(LASTONLINE_DAYS, floor(timeDifference / ONE_DAY)); + elseif ( timeDifference >= ONE_MONTH and timeDifference < ONE_YEAR ) then + return format(LASTONLINE_MONTHS, floor(timeDifference / ONE_MONTH)); + else + return format(LASTONLINE_YEARS, floor(timeDifference / ONE_YEAR)); + end +end + +local frame = CreateFrame("frame") +local tooltip +local LDB_ANCHOR +local wtcgString = BNET_CLIENT_WTCG +local GROUP_CHECKMARK = "|TInterface\\Buttons\\UI-CheckBox-Check:0|t" +local AWAY_ICON = "|TInterface\\FriendsFrame\\StatusIcon-Away:18|t" +local BUSY_ICON = "|TInterface\\FriendsFrame\\StatusIcon-DnD:18|t" +local MOBILE_ICON = "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:18|t" +local MINIMIZE = "|TInterface\\BUTTONS\\UI-PlusButton-Up:0|t" +local BROADCAST_ICON = "|TInterface\\FriendsFrame\\BroadcastIcon:0|t" + +-- Setup the Title Font. 14 +local ssTitleFont = CreateFont("ssTitleFont") +ssTitleFont:SetTextColor(1,0.823529,0) +ssTitleFont:SetFont(GameTooltipText:GetFont(), 14) + +-- Setup the Header Font. 12 +local ssHeaderFont = CreateFont("ssHeaderFont") +ssHeaderFont:SetTextColor(1,0.823529,0) +ssHeaderFont:SetFont(GameTooltipHeaderText:GetFont(), 12) + +-- Setup the Regular Font. 12 +local ssRegFont = CreateFont("ssRegFont") +ssRegFont:SetTextColor(1,0.823529,0) +ssRegFont:SetFont(GameTooltipText:GetFont(), 12) + +local list_sort = { + TOONNAME = function(a, b) + return a["TOONNAME"] < b["TOONNAME"] + end, + LEVEL = function(a, b) + if a["LEVEL"] < b["LEVEL"] then + return true + elseif a["LEVEL"] > b["LEVEL"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + RANKINDEX = function(a, b) + if a["RANKINDEX"] > b["RANKINDEX"] then + return true + elseif a["RANKINDEX"] < b["RANKINDEX"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + ZONENAME = function(a, b) + if a["ZONENAME"] < b["ZONENAME"] then + return true + elseif a["ZONENAME"] > b["ZONENAME"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + REALMNAME = function(a, b) + if a["REALMNAME"] < b["REALMNAME"] then + return true + elseif a["REALMNAME"] > b["REALMNAME"] then + return false + else -- TOONNAME + return a["ZONENAME"] < b["ZONENAME"] + end + end, + revTOONNAME = function(a, b) + return a["TOONNAME"] > b["TOONNAME"] + end, + revLEVEL = function(a, b) + if a["LEVEL"] > b["LEVEL"] then + return true + elseif a["LEVEL"] < b["LEVEL"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revRANKINDEX = function(a, b) + if a["RANKINDEX"] < b["RANKINDEX"] then + return true + elseif a["RANKINDEX"] > b["RANKINDEX"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revZONENAME = function(a, b) + if a["ZONENAME"] > b["ZONENAME"] then + return true + elseif a["ZONENAME"] < b["ZONENAME"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revREALMNAME = function(a, b) + if a["REALMNAME"] > b["REALMNAME"] then + return true + elseif a["REALMNAME"] < b["REALMNAME"] then + return false + else -- TOONNAME + return a["ZONENAME"] < b["ZONENAME"] + end + end +} + +local function inGroup(name) + if GetNumSubgroupMembers() > 0 and UnitInParty(name) then + return true + elseif GetNumGroupMembers() > 0 and UnitInRaid(name) then + return true + end + + return false +end + +local function nameIndex(name) + local lookupname + + for i = 1, GetNumFriends() do + lookupname = GetFriendInfo(i) + if lookupname == name then + return i + end + end +end + +local function ColoredLevel(level) + if level ~= "" then + local color = GetQuestDifficultyColor(level) + return string.format("|cff%02x%02x%02x%d|r", color.r * 255, color.g * 255, color.b * 255, level) + end +end + +local CLASS_COLORS, color = {} +local classes_female, classes_male = {}, {} + +FillLocalizedClassList(classes_female, true) +FillLocalizedClassList(classes_male, false) + +for token, localizedName in pairs(classes_female) do + color = RAID_CLASS_COLORS[token] + CLASS_COLORS[localizedName] = string.format("%02x%02x%02x", color.r * 255, color.g * 255, color.b * 255) +end + +for token, localizedName in pairs(classes_male) do + color = RAID_CLASS_COLORS[token] + CLASS_COLORS[localizedName] = string.format("%02x%02x%02x", color.r * 255, color.g * 255, color.b * 255) +end + +local function valueColor(totals) + if totals ~= "" then + local color = E.db.general.valuecolor + return string.format("|cff%02x%02x%02x%d|r", color.r * 255, color.g * 255, color.b * 255, totals) + end +end + +function DT:update_Friends() + ShowFriends() + local friendsTotal, friendsOnline = GetNumFriends() + local bnTotal, bnOnline = BNGetNumFriends() + local totalOnline = friendsOnline + bnOnline + local totalFriends = friendsTotal + bnTotal + + if E.db.sle.dt.friends.totals then + LDB.text = "|cffffffff"..L['Friends']..": |r"..valueColor(totalOnline).."/"..valueColor(totalFriends) + else + LDB.text = "|cffffffff"..L['Friends']..": |r"..valueColor(totalOnline) + end +end + +local function Entry_OnMouseUp(frame, info, button) + local i_type, toon_name, full_name, presence_id = string.split(":", info) + + if button == "LeftButton" then + if IsAltKeyDown() then + if i_type == "realid" then + local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID = BNGetFriendInfo(BNGetFriendIndex(presence_id)) + --local _, toonName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText = BNGetFriendToonInfo(BNGetFriendIndex(presence_id), 1) + local _, toonName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText = BNGetToonInfo(toonID or 0) + + InviteUnit(toon_name.."-"..realmName) + return + else + InviteUnit(toon_name) + return + end + end + + if IsShiftKeyDown() then + SetItemRef("player:"..toon_name, "|Hplayer:"..toon_name.."|h["..toon_name.."|h", "LeftButton") + return + end + + if IsControlKeyDown() then + if i_type == "friends" then + FriendsFrame.NotesID = nameIndex(toon_name) + StaticPopup_Show("SET_FRIENDNOTE", GetFriendInfo(FriendsFrame.NotesID)) + return + end + + if i_type == "realid" then + FriendsFrame.NotesID = presence_id + StaticPopup_Show("SET_BNFRIENDNOTE", full_name) + return + end + end + + if i_type == "realid" then + local name = full_name..":"..presence_id + SetItemRef( "BNplayer:"..name, ("|HBNplayer:%1$s|h[%1$s]|h"):format(name), "LeftButton" ) + else + SetItemRef( "player:"..full_name, ("|Hplayer:%1$s|h[%1$s]|h"):format(full_name), "LeftButton" ) + end + elseif button == "RightButton" then + if IsControlKeyDown() then + --Possibly Set BNetBroadcast + -- E:StaticPopup_Show("SET_BN_BROADCAST") + end + elseif button == "MiddleButton" then + E.db.sle.dt.friends.expandBNBroadcast = not E.db.sle.dt.friends.expandBNBroadcast + LDB.OnEnter(LDB_ANCHOR) + end +end + +local function HideOnMouseUp(cell, section) + E.db.sle.dt.friends[section] = not E.db.sle.dt.friends[section] + LDB.OnEnter(LDB_ANCHOR) +end + +local function SetRealIDSort(cell, sortsection) + if E.db.sle.dt.friends["sortBN"] == sortsection then + E.db.sle.dt.friends["sortBN"] = "rev" .. sortsection + else + E.db.sle.dt.friends["sortBN"] = sortsection + end + LDB.OnEnter(LDB_ANCHOR) +end + +function LDB:OnClick(button) + if button == "LeftButton" then + ToggleFriendsFrame() + end + + if button == "RightButton" then + ElvConfigToggle:Click(); + ACD:SelectGroup("ElvUI", "sle", "sldatatext", "slfriends") + end +end + +function LDB.OnLeave() end + +function LDB.OnEnter(self) + if E.db.sle.dt.friends.combat and InCombatLockdown() then return end + LDB_ANCHOR = self + + if LibQTip:IsAcquired("ShadowLightFriends") then + tooltip:Clear() + else + tooltip = LibQTip:Acquire("ShadowLightFriends", 8, "RIGHT", "RIGHT", "LEFT", "LEFT", "CENTER", "CENTER", "RIGHT") + + tooltip:SetBackdropColor(0,0,0,1) + + tooltip:SetHeaderFont(ssHeaderFont) + tooltip:SetFont(ssRegFont) + + tooltip:SmartAnchorTo(self) + tooltip:SetAutoHideDelay(E.db.sle.dt.friends.tooltipAutohide, self) + tooltip:SetScript("OnShow", function(ttskinself) ttskinself:SetTemplate('Transparent') end) + end + + local line = tooltip:AddLine() + tooltip:SetCell(line, 1, "Shadow & Light Friends", ssTitleFont, "CENTER", 0) + tooltip:AddLine(" ") + + local _, numBNOnline = BNGetNumFriends() + local _, numFriendsOnline = GetNumFriends() + + if (numBNOnline > 0) or (numFriendsOnline > 0) then + line = tooltip:AddLine() + if not E.db.sle.dt.friends.hideFriends then + tooltip:SetCell(line, 1, "|cffffffff" .. _G.FRIENDS .. "|r", "LEFT", 3) + else + tooltip:SetCell(line, 1, "|cffffffff" .. MINIMIZE .. _G.FRIENDS .. "|r", "LEFT", 3) + end + tooltip:SetCellScript(line, 1, "OnMouseUp", HideOnMouseUp, "hideFriends") + + if not E.db.sle.dt.friends.hideFriends then + line = tooltip:AddHeader() + line = tooltip:SetCell(line, 1, " ") + tooltip:SetCellScript(line, 1, "OnMouseUp", SetRealIDSort, "LEVEL") + line = tooltip:SetCell(line, 3, _G.NAME) + tooltip:SetCellScript(line, 3, "OnMouseUp", SetRealIDSort, "TOONNAME") + line = tooltip:SetCell(line, 4, _G.BATTLENET_FRIEND) + tooltip:SetCellScript(line, 4, "OnMouseUp", SetRealIDSort, "REALID") + line = tooltip:SetCell(line, 5, _G.LOCATION_COLON) + tooltip:SetCellScript(line, 5, "OnMouseUp", SetRealIDSort, "ZONENAME") + line = tooltip:SetCell(line, 6, _G.FRIENDS_LIST_REALM) + tooltip:SetCellScript(line, 6, "OnMouseUp", SetRealIDSort, "REALMNAME") + if not E.db.sle.dt.friends.hideFriendsNotes then + line = tooltip:SetCell(line, 7, _G.NOTE_COLON) + else + line = tooltip:SetCell(line, 7, MINIMIZE .. _G.NOTE_COLON) + end + tooltip:SetCellScript(line, 7, "OnMouseUp", HideOnMouseUp, "hideFriendsNotes") + + tooltip:AddSeparator() + + if numBNOnline > 0 then + local realid_table = {} + for i = 1, numBNOnline do + --local presenceID, givenName, surname = BNGetFriendInfo(i) + local presenceID, givenName, bTag, _, _, toonID, gameClient, isOnline, lastOnline, isAFK, isDND, broadcast, note, _, castTime = BNGetFriendInfo(i) + local _, toonName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText = BNGetToonInfo(toonID or 0) + local broadcastTime = "" + if castTime then + broadcastTime = string.format(BNET_BROADCAST_SENT_TIME, sletime_Conversion(castTime)); + end + --for toonidx = 1, BNGetNumFriendToons(i) do + local fcolor + local status = "" + --local _, _, _, _, _, _, _, isOnline, lastOnline, isAFK, isDND, broadcast, note = BNGetFriendInfoByID(presenceID) + --local _, toonName, client, realmName, realmID, faction, race, class, guild, zoneName, level, gameText = BNGetFriendToonInfo(i, toonidx) + + if toonName then + if faction then + if faction == "Horde" then + fcolor = RED_FONT_COLOR_CODE + else + fcolor = "|cff0070dd" + end + end + + if isAFK then + status = AWAY_ICON + end + + if isDND then + status = BUSY_ICON + end + + if note and note ~= "" then note = "|cffff8800{"..note.."}|r" end + + table.insert(realid_table, { + GIVENNAME = givenName, + SURNAME = bTag or "", + LEVEL = level, + CLASS = class, + FCOLOR = fcolor, + STATUS = status, + BROADCAST_TEXT = broadcast or "", + BROADCAST_TIME = broadcastTime or "", + TOONNAME = toonName, + CLIENT = client, + ZONENAME = zoneName, + REALMNAME = realmName, + GAMETEXT = gameText, + NOTE = note, + PRESENCEID = presenceID + }) + end + --end + end + + if (E.db.sle.dt.friends["sortBN"] ~= "REALID") and (E.db.sle.dt.friends["sortBN"] ~= "revREALID") then + table.sort(realid_table, list_sort[E.db.sle.dt.friends["sortBN"]]) + end + + for _, player in ipairs(realid_table) do + local broadcast_flag + if not E.db.sle.dt.friends.expandBNBroadcast and player["BROADCAST_TEXT"] ~= "" then + broadcast_flag = " " .. BROADCAST_ICON + else + broadcast_flag = "" + end + + line = tooltip:AddLine() + line = tooltip:SetCell(line, 1, ColoredLevel(player["LEVEL"])) + line = tooltip:SetCell(line, 2, player["STATUS"]) + line = tooltip:SetCell(line, 3, + string.format("|cff%s%s",CLASS_COLORS[player["CLASS"]] or "B8B8B8", player["TOONNAME"] .. "|r").. + (inGroup(player["TOONNAME"]) and GROUP_CHECKMARK or "")) + line = tooltip:SetCell(line, 4, + "|cff82c5ff" .. player["GIVENNAME"] .. "|r" .. broadcast_flag) + + if player["CLIENT"] == "WoW" then + line = tooltip:SetCell(line, 5, player["ZONENAME"]) + line = tooltip:SetCell(line, 6, player["FCOLOR"] .. player["REALMNAME"] .. "|r") + elseif player["CLIENT"] == "App" then + --if player["CLIENT"] == "App" then + line = tooltip:SetCell(line, 5, "|cff82c5ffDesktop Application|r") + line = tooltip:SetCell(line, 6, "|cff01b2f1Battle.net|r") + --end + else + line = tooltip:SetCell(line, 5, player["GAMETEXT"]) + if player["CLIENT"] == "S2" then + line = tooltip:SetCell(line, 6, "|cff82c5ffStarCraft 2|r") + end + + if player["CLIENT"] == "D3" then + line = tooltip:SetCell(line, 6, "|cffad835aDiablo 3|r") + end + + if player["CLIENT"] == wtcgString then + line = tooltip:SetCell(line, 6, "|cff82c5ffHearthstone|r") + end + + end + + if not E.db.sle.dt.friends.hideFriendsNotes then + line = tooltip:SetCell(line, 7, player["NOTE"]) + end + + tooltip:SetLineScript(line, "OnMouseUp", Entry_OnMouseUp, string.format("realid:%s:%s:%d", player["TOONNAME"], player["GIVENNAME"], player["PRESENCEID"])) + + if E.db.sle.dt.friends.expandBNBroadcast and player["BROADCAST_TEXT"] ~= "" then + line = tooltip:AddLine() + line = tooltip:SetCell(line, 1, BROADCAST_ICON .. " |cff7b8489" .. player["BROADCAST_TEXT"] .. "|r "..player["BROADCAST_TIME"], "LEFT", 0) + tooltip:SetLineScript(line, "OnMouseUp", Entry_OnMouseUp, string.format("realid:%s:%s:%d", player["TOONNAME"], player["GIVENNAME"], player["PRESENCEID"])) + end + end + tooltip:AddLine(" ") + end + + if numFriendsOnline > 0 then + local friend_table = {} + for i = 1,numFriendsOnline do + local toonName, level, class, zoneName, connected, status, note = GetFriendInfo(i) + note = note and "|cffff8800{"..note.."}|r" or "" + + if status == CHAT_FLAG_AFK then + status = AWAY_ICON + elseif status == CHAT_FLAG_DND then + status = BUSY_ICON + end + + table.insert(friend_table, { + TOONNAME = toonName, + LEVEL = level, + CLASS = class, + ZONENAME = zoneName, + REALMNAME = "", + STATUS = status, + NOTE = note + }) + end + + if (E.db.sle.dt.friends["sortBN"] ~= "REALID") and (E.db.sle.dt.friends["sortBN"] ~= "revREALID") then + table.sort(friend_table, list_sort[E.db.sle.dt.friends["sortBN"]]) + else + table.sort(friend_table, list_sort["TOONNAME"]) + end + + for _, player in ipairs(friend_table) do + line = tooltip:AddLine() + line = tooltip:SetCell(line, 1, ColoredLevel(player["LEVEL"])) + line = tooltip:SetCell(line, 2, player["STATUS"]) + line = tooltip:SetCell(line, 3, + string.format("|cff%s%s", CLASS_COLORS[player["CLASS"]] or "ffffff", player["TOONNAME"] .. "|r") .. (inGroup(player["TOONNAME"]) and GROUP_CHECKMARK or "")); + line = tooltip:SetCell(line, 5, player["ZONENAME"]) + if not E.db.sle.dt.friends.hideFriendsNotes then + line = tooltip:SetCell(line, 7, player["NOTE"]) + end + tooltip:SetLineScript(line, "OnMouseUp", Entry_OnMouseUp, string.format("friends:%s:%s", player["TOONNAME"], player["TOONNAME"])) + end + end + end + tooltip:AddLine(" ") + end + + if not E.db.sle.dt.friends.hide_hintline then + line = tooltip:AddLine() + if not E.db.sle.dt.friends.minimize_hintline then + tooltip:SetCell(line, 1, "Hint:", "LEFT", 3) + else + tooltip:SetCell(line, 1, MINIMIZE .. "Hint:", "LEFT", 3) + end + tooltip:SetCellScript(line, 1, "OnMouseUp", HideOnMouseUp, "minimize_hintline") + + if not E.db.sle.dt.friends.minimize_hintline then + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fLeft Click|r to open the friends panel.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fRight Click|r to open configuration panel.", "LEFT", 3) + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fLeft Click|r a line to whisper a player.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fShift+Left Click|r a line to lookup a player.", "LEFT", 3) + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fCtrl+Left Click|r a line to edit a note.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fMiddleClick|r a line to expand RealID.", "LEFT", 3) + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fAlt+Left Click|r a line to invite.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fLeft Click|r a Header to hide it or sort it.", "LEFT", 3) + end + end + + tooltip:UpdateScrolling() + tooltip:Show() +end + +frame:SetScript("OnEvent", function(self, event, ...) + if self[event] then + return self[event](self, event, ...) + end +end) + +local DELAY = 15 -- Update every 15 seconds +local elapsed = DELAY - 5 + +frame:SetScript("OnUpdate", function (self, elapse) + elapsed = elapsed + elapse + + if elapsed >= DELAY then + elapsed = 0 + DT:update_Friends() + end +end) + +frame:RegisterEvent("PLAYER_LOGIN") \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/guild.lua b/ElvUI_SLE/modules/sledatatexts/guild.lua new file mode 100644 index 0000000..f981505 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/guild.lua @@ -0,0 +1,469 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local LibQTip = LibStub('LibQTip-1.0') +local ACD = LibStub("AceConfigDialog-3.0") +local DT = E:GetModule('DataTexts') +local LDB = LibStub("LibDataBroker-1.1"):NewDataObject("S&L Guild", +{ + type = "data source", + icon = "Interface\\Icons\\INV_Drink_08.png", + label = "S&L Guild", + text = "S&L Guild" +}) +local _G = getfenv(0) +local string = _G.string +local pairs = _G.pairs +local MyRealm = E.myrealm +local frame = CreateFrame("frame") + +local tooltip +local LDB_ANCHOR + +local GROUP_CHECKMARK = "|TInterface\\Buttons\\UI-CheckBox-Check:0|t" +local AWAY_ICON = "|TInterface\\FriendsFrame\\StatusIcon-Away:18|t" +local BUSY_ICON = "|TInterface\\FriendsFrame\\StatusIcon-DnD:18|t" +local MOBILE_ICON = "|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:18|t" +local MINIMIZE = "|TInterface\\BUTTONS\\UI-PlusButton-Up:0|t" + +local FACTION_COLOR_HORDE = RED_FONT_COLOR_CODE +local FACTION_COLOR_ALLIANCE = "|cff0070dd" + +local GetGuildLevel = GetGuildLevel +local UnitGetGuildXP = UnitGetGuildXP +local guildXP= {} +local join = string.join +local tthead, ttsubh, ttoff = {r=0.4, g=0.78, b=1}, {r=0.75, g=0.9, b=1}, {r=.3,g=1,b=.3} +local guildXpCurrentString = gsub(join("", E:RGBToHex(ttsubh.r, ttsubh.g, ttsubh.b), COMBAT_XP_GAIN..": ".."%s/%s (%s%%)"), ": ", ":|r |cffffffff", 1) +local function UpdateGuildXP() + local currentXP, remainingXP = UnitGetGuildXP("player") + local nextLevelXP = currentXP + remainingXP + local percentTotal + if currentXP > 0 and nextLevelXP > 0 then + percentTotal = ceil((currentXP / nextLevelXP) * 100) + else + percentTotal = 0 + end + + guildXP[0] = { currentXP, nextLevelXP, percentTotal } +end + +-- Setup the Title Font. 14 +local ssTitleFont = CreateFont("ssTitleFont") +ssTitleFont:SetTextColor(1,0.823529,0) +ssTitleFont:SetFont(GameTooltipText:GetFont(), 14) + +-- Setup the Header Font. 12 +local ssHeaderFont = CreateFont("ssHeaderFont") +ssHeaderFont:SetTextColor(1,0.823529,0) +ssHeaderFont:SetFont(GameTooltipHeaderText:GetFont(), 12) + +-- Setup the Regular Font. 12 +local ssRegFont = CreateFont("ssRegFont") +ssRegFont:SetTextColor(1,0.823529,0) +ssRegFont:SetFont(GameTooltipText:GetFont(), 12) + +local list_sort = { + TOONNAME = function(a, b) + return a["TOONNAME"] < b["TOONNAME"] + end, + LEVEL = function(a, b) + if a["LEVEL"] < b["LEVEL"] then + return true + elseif a["LEVEL"] > b["LEVEL"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + RANKINDEX = function(a, b) + if a["RANKINDEX"] > b["RANKINDEX"] then + return true + elseif a["RANKINDEX"] < b["RANKINDEX"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + ZONENAME = function(a, b) + if a["ZONENAME"] < b["ZONENAME"] then + return true + elseif a["ZONENAME"] > b["ZONENAME"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revTOONNAME = function(a, b) + return a["TOONNAME"] > b["TOONNAME"] + end, + revLEVEL = function(a, b) + if a["LEVEL"] > b["LEVEL"] then + return true + elseif a["LEVEL"] < b["LEVEL"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revRANKINDEX = function(a, b) + if a["RANKINDEX"] < b["RANKINDEX"] then + return true + elseif a["RANKINDEX"] > b["RANKINDEX"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end, + revZONENAME = function(a, b) + if a["ZONENAME"] > b["ZONENAME"] then + return true + elseif a["ZONENAME"] < b["ZONENAME"] then + return false + else -- TOONNAME + return a["TOONNAME"] < b["TOONNAME"] + end + end +} + +local function inGroup(name) + if GetNumSubgroupMembers() > 0 and UnitInParty(name) then + return true + elseif GetNumGroupMembers() > 0 and UnitInRaid(name) then + return true + end + + return false +end + +local function guild_name_to_index(name) + local lookupname + + for i = 1, GetNumGuildMembers() do + lookupname = GetGuildRosterInfo(i) + + if lookupname == name then + return i + end + end +end + +local function ColoredLevel(level) + if level ~= "" then + local color = GetQuestDifficultyColor(level) + return string.format("|cff%02x%02x%02x%d|r", color.r * 255, color.g * 255, color.b * 255, level) + end +end + +local CLASS_COLORS, color = {} +local classes_female, classes_male = {}, {} + +FillLocalizedClassList(classes_female, true) +FillLocalizedClassList(classes_male, false) + +for token, localizedName in pairs(classes_female) do + color = RAID_CLASS_COLORS[token] + CLASS_COLORS[localizedName] = string.format("%02x%02x%02x", color.r * 255, color.g * 255, color.b * 255) +end + +for token, localizedName in pairs(classes_male) do + color = RAID_CLASS_COLORS[token] + CLASS_COLORS[localizedName] = string.format("%02x%02x%02x", color.r * 255, color.g * 255, color.b * 255) +end + +local function valueColor(totals) + if totals ~= "" then + local color = E.db.general.valuecolor + return string.format("|cff%02x%02x%02x%d|r", color.r * 255, color.g * 255, color.b * 255, totals) + end +end + +function DT:update_Guild() + if IsInGuild() then + GuildRoster() + local guildTotal, online = GetNumGuildMembers() + for i = 1, GetNumGuildMembers() do + local _, _, _, _, _, _, _, _, connected, _, _, _, _, isMobile = GetGuildRosterInfo(i) + if isMobile then + online = online + 1 + end + end + if E.db.sle.dt.guild.totals then + LDB.text = --[["|cff82c5ff"]]"|cffffffff"..GUILD..": |r"..valueColor(online).."/"..valueColor(guildTotal)--[["|r"]] + else + LDB.text = "|cffffffff"..GUILD..": |r"..valueColor(online) + end + else + LDB.text = "|cffffffff"..L['No Guild'].."|r" + end +end + +local function Entry_OnMouseUp(frame, info, button) + local i_type, toon_name, full_name, presence_id = string.split(":", info) + + if button == "LeftButton" then + if IsAltKeyDown() then + InviteUnit(toon_name) + return + end + + if IsShiftKeyDown() then + SetItemRef("player:"..toon_name, "|Hplayer:"..toon_name.."|h["..toon_name.."|h", "LeftButton") + return + end + + if IsControlKeyDown() then + if i_type == "guild" and CanEditPublicNote() then + SetGuildRosterSelection(guild_name_to_index(toon_name)) + StaticPopup_Show("SET_GUILDPLAYERNOTE") + return + end + end + + SetItemRef( "player:"..full_name, ("|Hplayer:%1$s|h[%1$s]|h"):format(full_name), "LeftButton" ) + elseif button == "RightButton" then + if IsControlKeyDown() then + if i_type == "guild" and CanEditOfficerNote() then + SetGuildRosterSelection(guild_name_to_index(toon_name)) + StaticPopup_Show("SET_GUILDOFFICERNOTE") + end + end + end +end + +local function HideOnMouseUp(cell, section) + E.db.sle.dt.guild[section] = not E.db.sle.dt.guild[section] + LDB.OnEnter(LDB_ANCHOR) +end + +local function SetGuildSort(cell, sortsection) + if E.db.sle.dt.guild["sortGuild"] == sortsection then + E.db.sle.dt.guild["sortGuild"] = "rev" .. sortsection + else + E.db.sle.dt.guild["sortGuild"] = sortsection + end + LDB.OnEnter(LDB_ANCHOR) +end + +function LDB:OnClick(button) + if button == "LeftButton" then + ToggleGuildFrame(1) + end + + if button == "RightButton" then + ElvConfigToggle:Click(); + ACD:SelectGroup("ElvUI", "sle", "sldatatext", "slguild") + end +end + +function LDB.OnLeave() end + +function LDB.OnEnter(self) + if E.db.sle.dt.guild.combat and InCombatLockdown() then return end + LDB_ANCHOR = self + + if LibQTip:IsAcquired("ShadowLightGuild") then + tooltip:Clear() + else + tooltip = LibQTip:Acquire("ShadowLightGuild", 8, "RIGHT", "RIGHT", "LEFT", "LEFT", "CENTER", "CENTER", "RIGHT") + + tooltip:SetBackdropColor(0,0,0,1) + + tooltip:SetHeaderFont(ssHeaderFont) + tooltip:SetFont(ssRegFont) + + tooltip:SmartAnchorTo(self) + tooltip:SetAutoHideDelay(E.db.sle.dt.guild.tooltipAutohide, self) + tooltip:SetScript("OnShow", function(ttskinself) ttskinself:SetTemplate('Transparent') end) + end + + local Glevel = GetGuildLevel() + + local line = tooltip:AddLine() + tooltip:SetCell(line, 1, "Shadow & Light Guild", ssTitleFont, "CENTER", 0) + tooltip:AddLine(" ") + + local XPline + + if IsInGuild() then + if Glevel ~= 25 then + if guildXP[0] then + local currentXP, nextLevelXP, percentTotal = unpack(guildXP[0]) + + XPline = " ["..Glevel.."]|r | "..format(guildXpCurrentString, E:ShortValue(currentXP), E:ShortValue(nextLevelXP), percentTotal) + end + else + XPline = " ["..Glevel.."]|r" + end + local guild_table = {} + if not E.db.sle.dt.guild.hide_gmotd then + line = tooltip:AddLine() + if not E.db.sle.dt.guild.minimize_gmotd then + tooltip:SetCell(line, 1, "|cffffffff" .. _G.CHAT_GUILD_MOTD_SEND .. "|r", "LEFT", 3) + else + tooltip:SetCell(line, 1, "|cffffffff".. MINIMIZE .. _G.CHAT_GUILD_MOTD_SEND .. "|r", "LEFT", 3) + end + tooltip:SetCellScript(line, 1, "OnMouseUp", HideOnMouseUp, "minimize_gmotd") + + if not E.db.sle.dt.guild.minimize_gmotd then + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "|cff00ff00"..GetGuildRosterMOTD().."|r", "LEFT", 0, nil, nil, nil, 100) + end + + tooltip:AddLine(" ") + end + + local ssGuildName + if not E.db.sle.dt.guild.hide_guildname then + ssGuildName = GetGuildInfo("player") + else + ssGuildName = _G.GUILD + end + + line = tooltip:AddLine() + if not E.db.sle.dt.guild.hideGuild then + tooltip:SetCell(line, 1, "|cffffffff" .. ssGuildName ..XPline , "LEFT", 0) + else + line = tooltip:SetCell(line, 1, MINIMIZE .. "|cffffffff" .. ssGuildName .. XPline, "LEFT", 0) + end + tooltip:SetCellScript(line, 1, "OnMouseUp", HideOnMouseUp, "hideGuild") + + if not E.db.sle.dt.guild.hideGuild then + line = tooltip:AddHeader() + line = tooltip:SetCell(line, 1, " ") + tooltip:SetCellScript(line, 1, "OnMouseUp", SetGuildSort, "LEVEL") + line = tooltip:SetCell(line, 3, _G.NAME) + tooltip:SetCellScript(line, 3, "OnMouseUp", SetGuildSort, "TOONNAME") + line = tooltip:SetCell(line, 5, _G.ZONE) + tooltip:SetCellScript(line, 5, "OnMouseUp", SetGuildSort, "ZONENAME") + line = tooltip:SetCell(line, 6, _G.RANK) + tooltip:SetCellScript(line, 6, "OnMouseUp", SetGuildSort, "RANKINDEX") + + if not E.db.sle.dt.guild.hide_guild_onotes then + line = tooltip:SetCell(line, 7, _G.NOTE_COLON) + else + line = tooltip:SetCell(line, 7, MINIMIZE .. _G.NOTE_COLON) + end + tooltip:SetCellScript(line, 7, "OnMouseUp", HideOnMouseUp, "hide_guild_onotes") + + tooltip:AddSeparator() + + for i = 1, GetNumGuildMembers() do + local toonName, rank, rankindex, level, class, zoneName, note, onote, connected, status, classFileName, achievementPoints, achievementRank, isMobile = GetGuildRosterInfo(i) + local toonShortName, toonRealm = string.split("-", toonName) + if MyRealm == toonRealm then toonName = toonShortName end + if connected or isMobile then + if note and note ~= '' then note="|cff00ff00["..note.."]|r" end + if onote and onote ~= '' then onote = "|cff00ffff["..onote.."]|r" end + + if status == 1 then + status = AWAY_ICON + elseif status == 2 then + status = BUSY_ICON + elseif status == 0 then + status = '' + end + + if isMobile then + status = MOBILE_ICON + zoneName = "Remote Chat" + end + + table.insert(guild_table, { + TOONNAME = toonName, + RANK = rank, + RANKINDEX = rankindex, + LEVEL = level, + CLASS = class, + ZONENAME = zoneName, + NOTE = note, + ONOTE = onote, + STATUS = status + }) + end + end + + table.sort(guild_table, list_sort[E.db.sle.dt.guild["sortGuild"]]) + + for _, player in ipairs(guild_table) do + line = tooltip:AddLine() + line = tooltip:SetCell(line, 1, ColoredLevel(player["LEVEL"])) + line = tooltip:SetCell(line, 2, player["STATUS"]) + line = tooltip:SetCell(line, 3, + string.format("|cff%s%s", CLASS_COLORS[player["CLASS"]] or "ffffff", player["TOONNAME"] .. "|r") .. (inGroup(player["TOONNAME"]) and GROUP_CHECKMARK or "")) + line = tooltip:SetCell(line, 5, player["ZONENAME"] or "???") + line = tooltip:SetCell(line, 6, player["RANK"]) + if not E.db.sle.dt.guild.hide_guild_onotes then + line = tooltip:SetCell(line, 7, player["NOTE"] .. player["ONOTE"]) + end + + tooltip:SetLineScript(line, "OnMouseUp", Entry_OnMouseUp, string.format("guild:%s:%s", player["TOONNAME"], player["TOONNAME"])) + end + end + tooltip:AddLine(" ") + end + + if not E.db.sle.dt.guild.hide_hintline then + line = tooltip:AddLine() + if not E.db.sle.dt.guild.minimize_hintline then + tooltip:SetCell(line, 1, "Hint:", "LEFT", 3) + else + tooltip:SetCell(line, 1, MINIMIZE .. "Hint:", "LEFT", 3) + end + tooltip:SetCellScript(line, 1, "OnMouseUp", HideOnMouseUp, "minimize_hintline") + + if not E.db.sle.dt.guild.minimize_hintline then + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fLeft Click|r to open the guild panel.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fRight Click|r to open configuration panel.", "LEFT", 3) + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fLeft Click|r a line to whisper a player.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fShift+Left Click|r a line to lookup a player.", "LEFT", 3)-- + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fCtrl+Left Click|r a line to edit note.", "LEFT", 3) + tooltip:SetCell(line, 5, "|cffeda55fCtrl+Right Click|r a line to edit officer note.", "LEFT", 3) + line = tooltip:AddLine() + tooltip:SetCell(line, 1, "", "LEFT", 1) + tooltip:SetCell(line, 2, "|cffeda55fAlt+Left Click|r a line to invite.", "LEFT", 3)-- + tooltip:SetCell(line, 5, "|cffeda55fLeft Click|r a Header to hide it or sort it.", "LEFT", 3)-- + end + end + + tooltip:UpdateScrolling() + tooltip:Show() +end + +frame:SetScript("OnEvent", function(self, event, ...) + if self[event] then + return self[event](self, event, ...) + end +end) + +function frame:PLAYER_ENTERING_WORLD(self, event, ...) + if not GuildFrame and IsInGuild() then + LoadAddOn("Blizzard_GuildUI") + UpdateGuildXP() + GuildRoster() + end +end + +function frame:GUILD_XP_UPDATE(self, event, ...) + UpdateGuildXP() +end + +local DELAY = 15 -- Update every 15 seconds +local elapsed = DELAY - 5 + +frame:SetScript("OnUpdate", function (self, elapse) + elapsed = elapsed + elapse + + if elapsed >= DELAY then + elapsed = 0 + DT:update_Guild() + end +end) + +frame:RegisterEvent("PLAYER_LOGIN") +frame:RegisterEvent("PLAYER_ENTERING_WORLD") +frame:RegisterEvent("GUILD_XP_UPDATE") \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/intellect.lua b/ElvUI_SLE/modules/sledatatexts/intellect.lua new file mode 100644 index 0000000..8665bfb --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/intellect.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, INTELLECT_COLON, select(2, UnitStat("player", 4))) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Intellect', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/itemlevel.lua b/ElvUI_SLE/modules/sledatatexts/itemlevel.lua new file mode 100644 index 0000000..3d74ff6 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/itemlevel.lua @@ -0,0 +1,263 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayString = '' +local lastPanel +local floor = floor +local GetInventoryItemLink, GetInventorySlotInfo = GetInventoryItemLink, GetInventorySlotInfo + +local slots = { + [1] = { "HeadSlot", HEADSLOT }, + [2] = { "NeckSlot", NECKSLOT }, + [3] = { "ShoulderSlot", SHOULDERSLOT }, + [4] = { "BackSlot", BACKSLOT }, + [5] = { "ChestSlot", CHESTSLOT }, + [6] = { "WristSlot", WRISTSLOT }, + [7] = { "HandsSlot", HANDSSLOT }, + [8] = { "WaistSlot", WAISTSLOT }, + [9] = { "LegsSlot", LEGSSLOT }, + [10] = { "FeetSlot", FEETSLOT }, + [11] = { "Finger0Slot", FINGER0SLOT_UNIQUE }, + [12] = { "Finger1Slot", FINGER1SLOT_UNIQUE }, + [13] = { "Trinket0Slot", TRINKET0SLOT_UNIQUE }, + [14] = { "Trinket1Slot", TRINKET1SLOT_UNIQUE }, + [15] = { "MainHandSlot", MAINHANDSLOT }, + [16] = { "SecondaryHandSlot", SECONDARYHANDSLOT }, +} + +local levelColors = { + [0] = { 1, 0, 0 }, + [1] = { 0, 1, 0 }, + [2] = { 1, 1, .5 }, +} + +local levelAdjust = { + ["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, + ["465"]=0,["466"]=4,["467"]=8,["468"] = 0,["469"] = 4,["470"] = 8,["471"] = 12,["472"] = 16, + ["491"]=0,["492"]=4,["493"]=8,["494"]=4,["495"]=8,["496"]=8,["497"]=12,["498"]=16 +} + +local heirlooms = { + [80] = { + 42943, --Bloodied Arcanite Reaper + 42944, --Balanced Heartseeker + 42945, --Venerable Dal'Rend's Sacred Charge + 42946, --Charmed Ancient Bone Bow + 42947, --Dignified Headmaster's Charge + 42948, --Devout Aurastone Hammer + 42949, --Polished Spaulders of Valor + 42950, --Champion Herod's Shoulder + 42951, --Mystical Pauldrons of Elements + 42952, --Stained Shadowcraft Spaulders + 42984, --Preened Ironfeather Shoulders + 42985, --Tattered Dreadmist Mantle + 42991, --Swift Hand of Justice + 42992, --Discerning Eye of the Beast + 44091, --Sharpened Scarlet Kris + 44092, --Reforged Truesilver Champion + 44093, --Upgraded Dwarven Hand Cannon + 44094, --The Blessed Hammer of Grace + 44095, --Grand Staff of Jordan + 44096, --Battleworn Thrash Blade + 44097, --Inherited Insignia of the Horde + 44098, --Inherited Insignia of the Alliance + 44099, --Strengthened Stockade Pauldrons + 44100, --Pristine Lightforge Spaulders + 44101, --Prized Beastmaster's Mantle + 44102, --Aged Pauldrons of The Five Thunders + 44103, --Exceptional Stormshroud Shoulders + 44105, --Lasting Feralheart Spaulders + 44107, --Exquisite Sunderseer Mantle + 48677, --Champion's Deathdealer Breastplate + 48683, --Mystical Vest of Elements + 48685, --Polished Breastplate of Valor + 48687, --Preened Ironfeather Breastplate + 48689, --Stained Shadowcraft Tunic + 48691, --Tattered Dreadmist Robe + 48716, --Venerable Mass of McGowan + 48718, --Repurposed Lava Dredger + 50255, --Dread Pirate Ring + 69889, --Burnished Breastplate of Might + 69890, --Burnished Pauldrons of Might + 69893, --Bloodsoaked Skullforge Reaver + 79131, --Burnished Warden Staff + }, + [85] = { + 61931, --Polished Helm of Valor + 61935, --Tarnished Raging Berserker's Helm + 61936, --Mystical Coif of Elements + 61937, --Stained Shadowcraft Cap + 61942, --Preened Tribal War Feathers + 61958, --Tattered Dreadmist Mask + 62023, --Polished Legplates of Valor + 62024, --Tarnished Leggings of Destruction + 62025, --Mystical Kilt of Elements + 62026, --Stained Shadowcraft Pants + 62027, --Preened Wildfeather Leggings + 62029, --Tattered Dreadmist Leggings + 62038, --Worn Stoneskin Gargoyle Cape + 62039, --Inherited Cape of the Black Baron + 62040, --Ancient Bloodmoon Cloak + 69887, --Burnished Helm of Might + 69888, --Burnished Legplates of Might + 69892, --Ripped Sandstorm Cloak + 93841, --Smoothbore Dwarven Hand Cannon + 93843, --Hardened Arcanite Reaper + 93844, --Refinished Warden Staff + 93845, --Gore-Steeped Skullforge Reaver + 93846, --Re-Engineered Lava Dredger + 93847, --Crushing Mass of McGowan + 93848, --Battle-Hardened Thrash Blade + 93849, --Elder Staff of Jordan + 93850, --The Sanctified hammer of Grace + 93851, --Battle-Forged Truesilver Champion + 93852, --Deadly Scarlet Kris + 93853, --Pious Aurastone hammer + 93854, --Scholarly Headmaster's Charge + 93855, --War-Torn Ancient Bone Bow + 93856, --Noble Dal'Rend's Sacred Charge + 93857, --Vengeful Heartseeker + 93859, --Bloodstained Dreadmist Mantle + 93860, --Bloodstained Dreadmist Robe + 93861, --Prestigious Sunderseer Mantle + 93862, --Supple Shadowcraft Spaulders + 93863, --Supple Shadowcraft Tunic + 93864, --Majestic Ironfeather Shoulders + 93865, --Majestic Ironfeather Breastplate + 93866, --Wild Feralheart Spaulders + 93867, --Superior Stormshroud Shoulders + 93876, --Awakened Pauldrons of Elements + 93885, --Awakened Vest of Elements + 93886, --Adorned Beastmaster's Mantle + 93887, --Grand Champion Herod's Shoulder + 93888, --Furious Deathdealer Breastplate + 93889, --Venerated Pauldrons of The Five Thunders + 93890, --Gleaming Spaulders of Valor + 93891, --Gleaming Breastplate of Valor + 93892, --Brushed Breaastplate of Might + 93893, --Brushed Pauldrons of Might + 93894, --Immaculate Lightforge Spaulders + 93895, --Reinforced Stockade Pauldrons + 93896, --Forceful Hand of Justice + 93897, --Piercing Eye of the Beast + 93899, --Bequeathed Insignia of the Alliance + 93900, --Inherited Mark of Tyranny + 93902, --Flamescarred Draconian Deflector + 93903, --Weathered Observer's Shield + 93904, --Musty Tome of the Lost + }, + [90] = { + 104399, --Hellscream's Warbow (Normal) + 104400, --Hellscream's Razor (Normal) + 104401, --Hellscream's Doomblade (Normal) + 104402, --Hellscream's Warmace (Normal) + 104403, --Hellscream's Pig Sticker (Normal) + 104404, --Hellscream's Cleaver (Normal) + 104405, --Hellscream's Decapitator (Normal) + 104406, --Hellscream's War Staff (Normal) + 104407, --Hellscream's Shield Wall (Normal) + 104408, --Hellscream's Tome of Destruction (Normal) + 104409, --Hellscream's Barrier (Normal) + 105670, --Hellscream's Warbow (Flex) + 105671, --Hellscream's Razor (Flex) + 105672, --Hellscream's Cleaver (Flex) + 105673, --Hellscream's Pig Sticker (Flex) + 105674, --Hellscream's Barrier (Flex) + 105675, --Hellscream's Warmace (Flex) + 105676, --Hellscream's Tome of Destruction (Flex) + 105677, --Hellscream's War Staff (Flex) + 105678, --Hellscream's Doomblade (Flex) + 105679, --Hellscream's Decapitator (Flex) + 105680, --Hellscream's Shield Wall (Flex) + 105683, --Hellscream's Warbow (Heroic) + 105684, --Hellscream's Razor (Heroic) + 105685, --Hellscream's Cleaver (Heroic) + 105686, --Hellscream's Pig Sticker (Heroic) + 105687, --Hellscream's Barrier (Heroic) + 105688, --Hellscream's Warmace (Heroic) + 105689, --Hellscream's Tome of Destruction (Heroic) + 105690, --Hellscream's War Staff (Heroic) + 105691, --Hellscream's Doomblade (Heroic) + 105692, --Hellscream's Decapitator (Heroic) + 105693, --Hellscream's Shield Wall (Heroic) + }, +} + +local function HeirLoomLevel(itemLink) + local ItemID, _, _, _, _, _, _, _, level = strmatch(itemLink, '|Hitem:(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)') + ItemID, level = tonumber(ItemID), tonumber(level) + for _, ID in pairs(heirlooms[90]) do + if ID == ItemID then + return select(4, GetItemInfo(itemLink)) + end + end + for _, ID in pairs(heirlooms[85]) do + if ID == ItemID and level > 85 then + level = 85 + break + end + end + for _, ID in pairs(heirlooms[80]) do + if ID == ItemID and level > 80 then + level = 80 + break + end + end + + if level > 80 then + return (( level - 81) * 12) + 285; + elseif level > 67 then + return (( level - 68) * 6) + 115; + elseif level > 59 then + return (( level - 60) * 3) + 85; + else + return level + end +end + +local function GetItemLevel(itemLink) + local rarity, itemLevel = select(3, GetItemInfo(itemLink)) + if rarity == 7 then + itemLevel = HeirLoomLevel(itemLink) + end + local upgrade = strmatch(itemLink, ":(%d+)\124h%[") + if itemLevel and upgrade and levelAdjust[upgrade] then + itemLevel = itemLevel + levelAdjust[upgrade] + end + return itemLevel +end + +local function OnEvent(self) + self.avgItemLevel, self.avgEquipItemLevel = GetAverageItemLevel() + self.text:SetFormattedText(displayString, ITEM_LEVEL_ABBR, floor(self.avgEquipItemLevel), floor(self.avgItemLevel)) +end + +local function OnEnter(self) + local avgItemLevel, avgEquipItemLevel = self.avgItemLevel, self.avgEquipItemLevel + + DT:SetupTooltip(self) + DT.tooltip:AddDoubleLine(TOTAL, floor(avgItemLevel), 1, 1, 1, 0, 1, 0) + DT.tooltip:AddDoubleLine(GMSURVEYRATING3, floor(avgEquipItemLevel), 1, 1, 1, 0, 1, 0) + DT.tooltip:AddLine(" ") + for i = 1, 16 do + local itemLink = GetInventoryItemLink("player", GetInventorySlotInfo(slots[i][1])) + if itemLink then + itemLevel = GetItemLevel(itemLink) + if itemLevel and avgEquipItemLevel then + local color = levelColors[(itemLevel < avgEquipItemLevel - 10 and 0 or (itemLevel > avgEquipItemLevel + 10 and 1 or (2)))] + DT.tooltip:AddDoubleLine(slots[i][2], itemLevel, 1, 1, 1, color[1], color[2], color[3]) + end + end + end + DT.tooltip:Show() +end + +local function ValueColorUpdate(hex, r, g, b) + displayString = string.join("", "|cffffffff%s:|r", " ", hex, "%d / %d|r") + if lastPanel ~= nil then OnEvent(lastPanel) end +end +E["valueColorUpdateFuncs"][ValueColorUpdate] = true + +DT:RegisterDatatext("S&L Item Level", {"PLAYER_ENTERING_WORLD", "PLAYER_EQUIPMENT_CHANGED", "UNIT_INVENTORY_CHANGED"}, OnEvent, nil, nil, OnEnter) diff --git a/ElvUI_SLE/modules/sledatatexts/lfr.lua b/ElvUI_SLE/modules/sledatatexts/lfr.lua new file mode 100644 index 0000000..cb4c4e7 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/lfr.lua @@ -0,0 +1,407 @@ +--LFR boss status calculations-- +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local DT = E:GetModule('DataTexts') + +local GetLFGDungeonEncounterInfo = GetLFGDungeonEncounterInfo +local AddLine = AddLine +local AddDoubleLine = AddDoubleLine +local GetMapNameByID = GetMapNameByID + +--For 4 boss raid +function DT:FourKill(id) + local killNum = 0 + for i =1,4 do + _, _, isKilled = GetLFGDungeonEncounterInfo(id, i); + if (isKilled) then + killNum = killNum + 1 + end + end + if killNum == 4 then + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/4", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) + else + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/4", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + end +end + +function DT:FourShift(id) + for i =1,4 do --1st part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end +end + +--For 6 boss raid +function DT:SixKill(id1, id2) + local killNum = 0 + for i =1,3 do --1st part + _, _, isKilled = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =4,6 do --2nd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + killNum = killNum + 1 + end + end + if killNum == 6 then + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/6", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) + else + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/6", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + end +end + +function DT:SixShift(id1, id2) + for i =1,3 do --1st part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif ( isIneligible ) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =4,6 do --2nd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end +end + +--For 8 boss raid +function DT:EightKill(id1, id2) + local killNum = 0 + for i =1,4 do --1st part + _, _, isKilled = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =5,8 do --2nd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + killNum = killNum + 1 + end + end + if killNum == 8 then + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/8", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) + else + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/8", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + end +end + +function DT:EightShift(id1, id2) + for i =1,4 do --1st part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =5,8 do --2nd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end +end + +--For 12 boss raid +function DT:TwelveKill(id1, id2, id3, id4) + local killNum = 0 + for i =1,3 do --1st part + _, _, isKilled = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =4,6 do --2nd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =7,9 do --3rd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id3, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =10,12 do --4th part + _, _, isKilled = GetLFGDungeonEncounterInfo(id4, i); + if (isKilled) then + killNum = killNum + 1 + end + end + if killNum == 12 then + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/12", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) + else + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/12", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + end +end + +function DT:TwelveShift(id1, id2, id3, id4) + for i =1,3 do --1st part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif ( isIneligible ) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =4,6 do --2nd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =7,9 do --3rd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id3, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =10,12 do --4th part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id4, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end +end + +--For 14 boss raid +function DT:FourteenKill(id1, id2, id3, id4) + local killNum = 0 + for i =1,4 do --1st part + _, _, isKilled = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =5,8 do --2nd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =9,11 do --3rd part + _, _, isKilled = GetLFGDungeonEncounterInfo(id3, i); + if (isKilled) then + killNum = killNum + 1 + end + end + for i =12,14 do --4th part + _, _, isKilled = GetLFGDungeonEncounterInfo(id4, i); + if (isKilled) then + killNum = killNum + 1 + end + end + if killNum == 14 then + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/14", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b) + else + DT.tooltip:AddLine(" "..L["Bosses killed: "]..killNum.."/14", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b) + end +end + +function DT:FourteenShift(id1, id2, id3, id4) + for i =1,4 do --1st part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =5,8 do --2nd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =9,11 do --3rd part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id3, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end + for i =12,14 do --4th part + bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id4, i); + if (isKilled) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b); + elseif (isIneligible) then + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + else + DT.tooltip:AddDoubleLine(" "..bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b); + end + end +end + +function DT:DragonSoul(id1, id2) + if IsShiftKeyDown() then + DT:EightShift(id1, id2) + else + DT:EightKill(id1, id2) + end +end + +function DT:Mogushan(id1, id2) + if IsShiftKeyDown() then + DT:SixShift(id1, id2) + else + DT:SixKill(id1, id2) + end +end + +function DT:HoF(id1, id2) + if IsShiftKeyDown() then + DT:SixShift(id1, id2) + else + DT:SixKill(id1, id2) + end +end + +function DT:ToES(id) + if IsShiftKeyDown() then + DT:FourShift(id) + else + DT:FourKill(id) + end +end + +function DT:ToT(id1, id2, id3, id4) + if IsShiftKeyDown() then + DT:TwelveShift(id1, id2, id3, id4) + else + DT:TwelveKill(id1, id2, id3, id4) + end +end + +function DT:SoO(id1, id2, id3, id4) + if IsShiftKeyDown() then + DT:FourteenShift(id1, id2, id3, id4) + else + DT:FourteenKill(id1, id2, id3, id4) + end +end + +function DT:LFRShow() + local lvl = UnitLevel("player") + local ilvl = GetAverageItemLevel() + DT.tooltip:AddLine(" ") + DT.tooltip:AddLine(RAID_FINDER) + if E.db.sle.lfrshow.ds then + DT.tooltip:AddLine(" "..GetMapNameByID(824)) + if lvl == 85 and ilvl >= 372 then + DT:DragonSoul(416, 417) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + if E.db.sle.lfrshow.mv then + DT.tooltip:AddLine(" "..GetMapNameByID(896)) + if lvl == 90 and ilvl >= 460 then + DT:Mogushan(527, 528) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + + if E.db.sle.lfrshow.hof then + DT.tooltip:AddLine(" "..GetMapNameByID(897)) + if lvl == 90 and ilvl >= 470 then + DT:HoF(529, 530) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + + if E.db.sle.lfrshow.toes then + DT.tooltip:AddLine(" "..GetMapNameByID(886)) + if lvl == 90 and ilvl >= 470 then + DT:ToES(526) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + + if E.db.sle.lfrshow.tot then + DT.tooltip:AddLine(" "..GetMapNameByID(930)) + if lvl == 90 and ilvl >= 480 then + DT:ToT(610, 611, 612, 613) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + + if E.db.sle.lfrshow.soo then + DT.tooltip:AddLine(" "..GetMapNameByID(953)) + if lvl == 90 and ilvl >= 496 then + DT:SoO(716, 717, 724, 725) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + + if E.db.sle.lfrshow.soof then + DT.tooltip:AddLine(" "..FLEX_RAID.." "..GetMapNameByID(953)) + if lvl == 90 then + DT:SoO(726, 728, 729, 730) + else + DT.tooltip:AddLine(" "..L["This LFR isn't available for your level/gear."]) + end + DT.tooltip:AddLine(" ") + end + if not E.db.sle.lfrshow.ds and not E.db.sle.lfrshow.mv and not E.db.sle.lfrshow.hof and not E.db.sle.lfrshow.toes and not E.db.sle.lfrshow.tot and not E.db.sle.lfrshow.soo and not E.db.sle.lfrshow.soof then + DT.tooltip:AddLine(" "..L["You didn't select any instance to track."]) + end +end diff --git a/ElvUI_SLE/modules/sledatatexts/load_datatexts.xml b/ElvUI_SLE/modules/sledatatexts/load_datatexts.xml new file mode 100644 index 0000000..13c2bf0 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/load_datatexts.xml @@ -0,0 +1,21 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <!--<Script file='datatexts.lua'/>--> + <Script file='lfr.lua'/> + <Script file='version.lua'/> + <Script file='regen.lua'/> + <Script file='agility.lua'/> + <Script file='strength.lua'/> + <Script file='energyregen.lua'/> + <Script file='intellect.lua'/> + <Script file='stamina.lua'/> + <Script file='spirit.lua'/> + <Script file='time.lua'/> + <Script file='friends.lua'/> + <Script file='guild.lua'/> + <Script file='itemlevel.lua'/> + <Script file='played.lua'/> + <Script file='mail.lua'/> + <Script file='micromenu.lua'/> + <Script file='currency.lua'/> + <Script file='range.lua'/> +</Ui> \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/mail.lua b/ElvUI_SLE/modules/sledatatexts/mail.lua new file mode 100644 index 0000000..979a864 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/mail.lua @@ -0,0 +1,86 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local DT = E:GetModule('DataTexts') + +local Mail_Icon = "|TInterface\\MINIMAP\\TRACKING\\Mailbox.blp:14:14|t"; +local OldShow = MiniMapMailFrame.Show + +local Read; +local AddLine = AddLine + +local function MakeIconString() + local str = "" + str = str..Mail_Icon + + return str +end + +function DT:SLEmailUp(newmail) + if not E.db.sle.dt.mail.icon then + MiniMapMailFrame:Hide() + MiniMapMailFrame.Show = nil + else + if not MiniMapMailFrame.Show then + MiniMapMailFrame.Show = OldShow + end + if newmail then + MiniMapMailFrame:Show() + end + end +end + +local function OnEvent(self, event, ...) + local newMail = false + + if event == "UPDATE_PENDING_MAIL" or event == "PLAYER_ENTERING_WORLD" or event =="PLAYER_LOGIN" then + + newMail = HasNewMail() + + if unreadMail ~= newMail then + unreadMail = newMail + end + + DT:SLEmailUp(newmail) + + self:UnregisterEvent("PLAYER_ENTERING_WORLD") + self:UnregisterEvent("PLAYER_LOGIN") + end + + if event == "MAIL_INBOX_UPDATE" or event == "MAIL_SHOW" or event == "MAIL_CLOSED" then + for i = 1, GetInboxNumItems() do + local _, _, _, _, _, _, _, _, wasRead = GetInboxHeaderInfo(i); + if( not wasRead ) then + newMail = true; + break; + end + end + end + + if newMail then + self.text:SetText(MakeIconString().."New Mail") + Read = false; + else + self.text:SetText("No Mail") + Read = true; + end + +end + +local function OnEnter(self) + DT:SetupTooltip(self) + + + + local sender1, sender2, sender3 = GetLatestThreeSenders() + + if not Read then + DT.tooltip:AddLine(HAVE_MAIL_FROM) + if sender1 then DT.tooltip:AddLine(" "..sender1) end + if sender2 then DT.tooltip:AddLine(" "..sender2) end + if sender3 then DT.tooltip:AddLine(" "..sender3) end + + end + DT.tooltip:Show() +end + +DT:RegisterDatatext('S&L Mail', {'PLAYER_ENTERING_WORLD', 'MAIL_INBOX_UPDATE', 'UPDATE_PENDING_MAIL', 'MAIL_CLOSED', 'PLAYER_LOGIN','MAIL_SHOW'}, OnEvent, nil, nil, OnEnter) + diff --git a/ElvUI_SLE/modules/sledatatexts/micromenu.lua b/ElvUI_SLE/modules/sledatatexts/micromenu.lua new file mode 100644 index 0000000..befbcd4 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/micromenu.lua @@ -0,0 +1,73 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local gsub, upper = string.gsub, string.upper +local menuFrame = CreateFrame("Frame", "ElvUI_SLE_MainMenuFrame", E.UIParent) +menuFrame:SetTemplate("Transparent", true) + +local calendar_string = gsub(SLASH_CALENDAR1, "/", "") +calendar_string = gsub(calendar_string, "^%l", upper) + +local menu = { + { text = L['Main Menu'], func = function() + if not GameMenuFrame:IsShown() then + ShowUIPanel(GameMenuFrame); + else + HideUIPanel(GameMenuFrame); + end + end }, + { text = CHARACTER_BUTTON, func = function() ToggleCharacter("PaperDollFrame") end }, + { text = SPELLBOOK_ABILITIES_BUTTON, func = function() if not SpellBookFrame:IsShown() then ShowUIPanel(SpellBookFrame) else HideUIPanel(SpellBookFrame) end end }, + { text = MOUNTS_AND_PETS, func = function() TogglePetJournal() end }, + { text = TALENTS_BUTTON, func = function() + if not PlayerTalentFrame then + TalentFrame_LoadUI() + end + + if not GlyphFrame then + GlyphFrame_LoadUI() + end + + if not PlayerTalentFrame:IsShown() then + ShowUIPanel(PlayerTalentFrame) + else + HideUIPanel(PlayerTalentFrame) + end + end }, + { text = TIMEMANAGER_TITLE, func = function() ToggleFrame(TimeManagerFrame) end }, + { text = ACHIEVEMENT_BUTTON, func = function() ToggleAchievementFrame() end }, + { text = QUESTLOG_BUTTON, func = function() ToggleFrame(QuestLogFrame) end }, + { text = SOCIAL_BUTTON, func = function() ToggleFriendsFrame() end }, + { text = calendar_string, func = function() GameTimeFrame:Click() end }, + { text = PLAYER_V_PLAYER, func = function() + if not PVPUIFrame then + PVP_LoadUI() + end + ToggleFrame(PVPUIFrame) + end }, + { text = ACHIEVEMENTS_GUILD_TAB, func = function() + if IsInGuild() then + if not GuildFrame then GuildFrame_LoadUI() end + GuildFrame_Toggle() + else + if not LookingForGuildFrame then LookingForGuildFrame_LoadUI() end + if not LookingForGuildFrame then return end + LookingForGuildFrame_Toggle() + end + end }, + { text = LFG_TITLE, func = function() PVEFrame_ToggleFrame(); end }, + { text = L["Raid Browser"], func = function() ToggleFrame(RaidBrowserFrame) end }, + { text = ENCOUNTER_JOURNAL, func = function() if not IsAddOnLoaded('Blizzard_EncounterJournal') then EncounterJournal_LoadUI(); end ToggleFrame(EncounterJournal) end }, + { text = BLIZZARD_STORE, func = function() StoreMicroButton:Click() end }, + { text = HELP_BUTTON, func = function() ToggleHelpFrame() end }, +} + +local function OnClick(self) + E:DropDown(menu, menuFrame) +end + +local function OnEvent(self, event, ...) + self.text:SetText(L['Main Menu']) +end + +DT:RegisterDatatext('S&L MicroMenu', {'PLAYER_LOGIN'}, OnEvent, nil, OnClick, nil) \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/played.lua b/ElvUI_SLE/modules/sledatatexts/played.lua new file mode 100644 index 0000000..62992bd --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/played.lua @@ -0,0 +1,167 @@ +local E, L, V, P, G, _ = unpack(ElvUI); +local DT = E:GetModule('DataTexts') + +local format, GetTime, ChatFrame_TimeBreakDown, InCombatLockdown = format, GetTime, ChatFrame_TimeBreakDown, InCombatLockdown +local PlayedTimeFormatFull = '%d '..L["D"]..' %02d:%02d:%02d' +local PlayedTimeFormatNoDay = '%02d:%02d:%02d' +local TotalPlayTime, LevelPlayTime, SessionPlayTime, LevelPlayedOffset, LastLevelTime +local MyRealm = E.myrealm +local MyName = E.myname +local MyClass = E.myclass +local AddLine, AddDoubleLine = AddLine, AddDoubleLine + +local OnEnter = function(self) + if not InCombatLockdown() and SessionPlayTime then + DT:SetupTooltip(self) + local SessionDay, SessionHour, SessionMinute, SessionSecond = ChatFrame_TimeBreakDown(GetTime() - SessionPlayTime) + local TotalDay, TotalHour, TotalMinute, TotalSecond = ChatFrame_TimeBreakDown(TotalPlayTime + (GetTime() - SessionPlayTime)) + local LevelDay, LevelHour, LevelMinute, LevelSecond = ChatFrame_TimeBreakDown(LevelPlayTime + (GetTime() - LevelPlayTimeOffset)) + local LastLevelDay, LastLevelHour, LastLevelMinute, LastLevelSecond = ChatFrame_TimeBreakDown(LastLevelTime) + --local Panel, Anchor, xOff, yOff = self:GetTooltipAnchor() + --DT.tooltip:SetOwner(Panel, Anchor, xOff, yOff) + DT.tooltip:ClearLines() + DT.tooltip:AddLine(TIME_PLAYED_MSG, 1, 1, 1) + DT.tooltip:AddLine(' ') + DT.tooltip:AddDoubleLine(L["Session:"], SessionDay > 0 and format(PlayedTimeFormatFull, SessionDay, SessionHour, SessionMinute, SessionSecond) or format(PlayedTimeFormatNoDay, SessionHour, SessionMinute, SessionSecond), 1, 1, 1, 1, 1, 1) + if LastLevelSecond > 0 then + DT.tooltip:AddDoubleLine(L["Previous Level:"], LastLevelDay > 0 and format(PlayedTimeFormatFull, LastLevelDay. LastLevelHour, LastLevelMinute, LastLevelSecond) or format(PlayedTimeFormatNoDay, LastLevelHour, LastLevelMinute, LastLevelSecond), 1, 1, 1, 1, 1, 1) + end + DT.tooltip:AddDoubleLine(LEVEL..':', LevelDay > 0 and format(PlayedTimeFormatFull, LevelDay, LevelHour, LevelMinute, LevelSecond) or format(PlayedTimeFormatNoDay, LevelHour, LevelMinute, LevelSecond), 1, 1, 1, 1, 1, 1) + --DT.tooltip:AddDoubleLine(LEVEL..':', LevelDay > 0 and format(PlayedTimeFormatFull, LevelDay. LevelHour, LevelMinute, LevelSecond) or format(PlayedTimeFormatNoDay, LevelHour, LevelMinute, LevelSecond), 1, 1, 1, 1, 1, 1) + DT.tooltip:AddDoubleLine(TOTAL..':', TotalDay > 0 and format(PlayedTimeFormatFull, TotalDay, TotalHour, TotalMinute, TotalSecond) or format(PlayedTimeFormatNoDay, TotalHour, TotalMinute, TotalSecond), 1, 1, 1, 1, 1, 1) + DT.tooltip:AddLine(' ') + DT.tooltip:AddLine(L["Account Time Played"], 1, 1, 1) + DT.tooltip:AddLine(' ') + local Class, Level, AccountDay, AccountHour, AccountMinute, AccountSecond, TotalAccountTime + for player, subtable in pairs(ElvDB['sle']['TimePlayed'][MyRealm]) do + for k, v in pairs(subtable) do + if k == 'TotalTime' then + AccountDay, AccountHour, AccountMinute, AccountSecond = ChatFrame_TimeBreakDown(v) + TotalAccountTime = (TotalAccountTime or 0) + v + end + if k == 'Class' then Class = v end + if k == 'Level' then Level = v end + end + local color = RAID_CLASS_COLORS[Class] + DT.tooltip:AddDoubleLine(format('%s |cFFFFFFFF- %s %d', player, LEVEL, Level), format(PlayedTimeFormatFull, AccountDay, AccountHour, AccountMinute, AccountSecond), color.r, color.g, color.b, 1, 1, 1) + end + DT.tooltip:AddLine(' ') + local TotalAccountDay, TotalAccountHour, TotalAccountMinute, TotalAccountSecond = ChatFrame_TimeBreakDown(TotalAccountTime) + DT.tooltip:AddDoubleLine(TOTAL, format(PlayedTimeFormatFull, TotalAccountDay, TotalAccountHour, TotalAccountMinute, TotalAccountSecond), 1, 0, 1, 1, 1, 1) + DT.tooltip:AddLine(' ') + DT.tooltip:AddLine(L["Reset Data: Hold Shift + Right Click"]) + DT.tooltip:Show() + end +end + +local ElapsedTimer = 0 +local OnUpdate = function(self, elapsed) + ElapsedTimer = ElapsedTimer + elapsed + if (not self.text) then + local text = self:CreateFontString(nil, 'OVERLAY') + text:SetFont(DataText.Font, DataText.Size, DataText.Flags) + text:SetText(TIME_PLAYED_MSG) + self.text = text + end + + if TotalPlayTime and LevelPlayTime and SessionPlayTime then + local Day, Hour, Minute, Second + if UnitLevel('player') ~= MAX_PLAYER_LEVEL then + Day, Hour, Minute, Second = ChatFrame_TimeBreakDown(LevelPlayTime + (GetTime() - LevelPlayTimeOffset)) + else + Day, Hour, Minute, Second = ChatFrame_TimeBreakDown(TotalPlayTime + (GetTime() - SessionPlayTime)) + end + if Day > 0 then + self.text:SetFormattedText('%d '..L["D"]..' %02d:%02d', Day, Hour, Minute) + else + self.text:SetFormattedText('%02d:%02d', Hour, Minute) + end + else + if ElapsedTimer > 1 and not self.Requested then + self.Requested = true + RequestTimePlayed() + end + end +end + +local OnEvent = function(self, event, ...) + if not ElvDB['sle'] then ElvDB['sle'] = {} end + if not ElvDB['sle']['TimePlayed'] then ElvDB['sle']['TimePlayed'] = {} end + if not ElvDB['sle']['TimePlayed'][MyRealm] then ElvDB['sle']['TimePlayed'][MyRealm] = {} end + if not ElvDB['sle']['TimePlayed'][MyRealm][MyName] then ElvDB['sle']['TimePlayed'][MyRealm][MyName] = {} end + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['Class'] = MyClass + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['Level'] = UnitLevel('player') + LastLevelTime = ElvDB['sle']['TimePlayed'][MyRealm][MyName]['LastLevelTime'] or 0 + if event == 'TIME_PLAYED_MSG' then + local TotalTime, LevelTime = ... + TotalPlayTime = TotalTime + LevelPlayTime = LevelTime + if SessionPlayTime == nil then SessionPlayTime = GetTime() end + LevelPlayTimeOffset = GetTime() + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['TotalTime'] = TotalTime + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['LevelTime'] = LevelTime + end + if event == 'PLAYER_LEVEL_UP' then + LastLevelTime = floor(LevelPlayTime + (GetTime() - LevelPlayTimeOffset)) + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['LastLevelTime'] = LastLevelTime + LevelPlayTime = 1 + LevelPlayTimeOffset = GetTime() + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['Level'] = UnitLevel('player') + end + if event == 'PLAYER_ENTERING_WORLD' then + self:UnregisterEvent(event) + if not IsAddOnLoaded('DataStore_Characters') then + RequestTimePlayed() + end + end + if event == 'PLAYER_LOGOUT' then + RequestTimePlayed() + end +end + +local function Reset() + ElvDB['sle']['TimePlayed'][MyRealm] = {} + ElvDB['sle']['TimePlayed'][MyRealm][MyName] = {} + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['Level'] = UnitLevel('player') + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['LastLevelTime'] = LastLevelTime + ElvDB['sle']['TimePlayed'][MyRealm][MyName]['Class'] = MyClass + RequestTimePlayed() + print(': Time Played has been reset!') +end + +local OnMouseDown = function(self, button) + if button == 'RightButton' then + if IsShiftKeyDown()then + Reset() + end + end +end + +--[[ +local Enable = function(self) + if (not self.Text) then + local Text = self:CreateFontString(nil, 'OVERLAY') + Text:SetFont(DataText.Font, DataText.Size, DataText.Flags) + Text:SetText('Time Played') + self.Text = Text + end + + self:RegisterEvent('TIME_PLAYED_MSG') + self:RegisterEvent('PLAYER_LEVEL_UP') + self:RegisterEvent('PLAYER_ENTERING_WORLD') + self:RegisterEvent('PLAYER_LOGOUT') + self:SetScript('OnMouseDown', OnMouseDown) + self:SetScript('OnUpdate', OnUpdate) + self:SetScript('OnEnter', OnEnter) + self:SetScript('OnEvent', OnEvent) + self:SetScript('OnLeave', GameTooltip_Hide) +end + +local Disable = function(self) + self.Text:SetText('') + self:UnregisterAllEvents() + self:SetScript('OnEvent', nil) + self:SetScript('OnEnter', nil) + self:SetScript('OnLeave', nil) +end]] +DT:RegisterDatatext('S&L Time Played', {'TIME_PLAYED_MSG', 'PLAYER_LEVEL_UP', 'PLAYER_ENTERING_WORLD' , 'PLAYER_LOGOUT'}, OnEvent, OnUpdate, OnMouseDown, OnEnter, OnLeave) \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/range.lua b/ElvUI_SLE/modules/sledatatexts/range.lua new file mode 100644 index 0000000..d86d97b --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/range.lua @@ -0,0 +1,53 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local RC = LibStub("LibRangeCheck-2.0") +local displayString = '' +local lastPanel +local int = 1 +local curMin, curMax +local updateTargetRange = false +local forceUpdate = false + +local function OnUpdate(self, t) + if not updateTargetRange then return end + + int = int - t + if int > 0 then return end + int = .25 + + local min, max = RC:GetRange('target') + if not forceUpdate and (min == curMin and max == curMax) then return end + + curMin = min + curMax = max + + if min and max then + self.text:SetFormattedText(displayString, WHC_TITLE_HUNTER_2, min, max) + else + self.text:SetText(SPELL_FAILED_BAD_IMPLICIT_TARGETS) + end + forceUpdate = false + lastPanel = self +end + +local function OnEvent(self, event) + updateTargetRange = UnitName("target") ~= nil + int = 0 + if updateTargetRange then + forceUpdate = true + else + self.text:SetText(SPELL_FAILED_BAD_IMPLICIT_TARGETS) + end +end + +local function ValueColorUpdate(hex, r, g, b) + displayString = string.join("", "%s: ", hex, "%d|r-", hex, "%d|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E.valueColorUpdateFuncs[ValueColorUpdate] = true + +DT:RegisterDatatext('S&L Target Range', {"PLAYER_TARGET_CHANGED"}, OnEvent, OnUpdate) diff --git a/ElvUI_SLE/modules/sledatatexts/regen.lua b/ElvUI_SLE/modules/sledatatexts/regen.lua new file mode 100644 index 0000000..ee0e358 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/regen.lua @@ -0,0 +1,28 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel; +local join = string.join + +local function OnEvent(self, event, unit) + local baseMR, castingMR = GetManaRegen() + if InCombatLockdown() then + self.text:SetFormattedText(displayNumberString, "MP5", castingMR*5) + else + self.text:SetFormattedText(displayNumberString, "MP5", baseMR*5) + end + + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = join("", "%s: ", hex, "%.2f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('MP5', {"UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/spirit.lua b/ElvUI_SLE/modules/sledatatexts/spirit.lua new file mode 100644 index 0000000..08f8a97 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/spirit.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, SPIRIT_COLON, select(2, UnitStat("player", 5))) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Spirit', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/stamina.lua b/ElvUI_SLE/modules/sledatatexts/stamina.lua new file mode 100644 index 0000000..724c03d --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/stamina.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, STAMINA_COLON, select(2, UnitStat("player", 3))) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Stamina', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/strength.lua b/ElvUI_SLE/modules/sledatatexts/strength.lua new file mode 100644 index 0000000..31042a2 --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/strength.lua @@ -0,0 +1,21 @@ +local E, L, V, P, G = unpack(ElvUI) +local DT = E:GetModule('DataTexts') + +local displayNumberString = '' +local lastPanel + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayNumberString, STRENGTH_COLON, select(2, UnitStat("player", 1))) + lastPanel = self +end + +local function ValueColorUpdate(hex, r, g, b) + displayNumberString = strjoin("", "%s ", hex, "%.f|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext('Strength', { "UNIT_STATS", "UNIT_AURA", "FORGE_MASTER_ITEM_CHANGED", "ACTIVE_TALENT_GROUP_CHANGED", "PLAYER_TALENT_UPDATE"}, OnEvent) diff --git a/ElvUI_SLE/modules/sledatatexts/time.lua b/ElvUI_SLE/modules/sledatatexts/time.lua new file mode 100644 index 0000000..558380f --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/time.lua @@ -0,0 +1,214 @@ +--Replacement of Elv's time datatext with some additions +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local DT = E:GetModule('DataTexts') + +local format = string.format +local join = string.join +local floor = math.floor +local wipe = table.wipe + +local APM = { TIMEMANAGER_PM, TIMEMANAGER_AM } +local europeDisplayFormat = ''; +local ukDisplayFormat = ''; +local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d") +local ukDisplayFormat_nocolor = join("", "", "%d", ":|r%02d", " %s|r") +local timerLongFormat = "%d:%02d:%02d" +local timerShortFormat = "%d:%02d" +local lockoutInfoFormat = "%s%s |cffaaaaaa(%s, %s/%s)" +local lockoutInfoFormatNoEnc = "%s%s |cffaaaaaa(%s)" +local formatBattleGroundInfo = "%s: " +local lockoutColorExtended, lockoutColorNormal = { r=0.3,g=1,b=0.3 }, { r=.8,g=.8,b=.8 } +local lockoutFormatString = { "%dd %02dh %02dm", "%dd %dh %02dm", "%02dh %02dm", "%dh %02dm", "%dh %02dm", "%dm" } +local curHr, curMin, curAmPm +local enteredFrame = false; + +local level = UnitLevel("player") + +local Update, lastPanel; -- UpValue +local localizedName, isActive, canQueue, startTime, canEnter +local name, reset, locked, extended, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress + +local function ValueColorUpdate(hex, r, g, b) + europeDisplayFormat = join("", "%02d", hex, ":|r%02d") + ukDisplayFormat = join("", "", "%d", hex, ":|r%02d", hex, " %s|r") + + if lastPanel ~= nil then + Update(lastPanel, 20000) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +local function ConvertTime(h, m) + local AmPm + if E.db.datatexts.time24 == true then + return h, m, -1 + else + if h >= 12 then + if h > 12 then h = h - 12 end + AmPm = 1 + else + if h == 0 then h = 12 end + AmPm = 2 + end + end + return h, m, AmPm +end + +local function CalculateTimeValues(tooltip) + if (tooltip and E.db.datatexts.localtime) or (not tooltip and not E.db.datatexts.localtime) then + return ConvertTime(GetGameTime()) + else + local dateTable = date("*t") + return ConvertTime(dateTable["hour"], dateTable["min"]) + end +end + +local function CalculateTimeLeft(time) + local hour = floor(time / 3600) + local min = floor(time / 60 - (hour*60)) + local sec = time - (hour * 3600) - (min * 60) + + return hour, min, sec +end + +local function Click() + GameTimeFrame:Click(); +end + +local function OnLeave(self) + DT.tooltip:Hide(); + enteredFrame = false; +end + +local function OnEvent() + if event == "UPDATE_INSTANCE_INFO" and enteredFrame then + RequestRaidInfo() + end +end + +local function OnEnter(self) + DT:SetupTooltip(self) + + if(not enteredFrame) then + enteredFrame = true; + RequestRaidInfo() + end + + DT.tooltip:AddLine(VOICE_CHAT_BATTLEGROUND); + for i = 1, GetNumWorldPVPAreas() do + _, localizedName, isActive, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(i) + if canEnter then + if isActive then + startTime = WINTERGRASP_IN_PROGRESS + elseif startTime == nil then + startTime = QUEUE_TIME_UNAVAILABLE + else + startTime = SecondsToTime(startTime, false, nil, 3) + end + DT.tooltip:AddDoubleLine(format(formatBattleGroundInfo, localizedName), startTime, 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + end + end + + --LFR lockout text + if E.db.sle.lfrshow.enabled then + DT:LFRShow() + end + + local oneraid, lockoutColor + for i = 1, GetNumSavedInstances() do + name, _, reset, difficultyId, locked, extended, _, isRaid, maxPlayers, difficulty, numEncounters, encounterProgress = GetSavedInstanceInfo(i) + if isRaid and (locked or extended) and name then + if not oneraid then + DT.tooltip:AddLine(" ") + DT.tooltip:AddLine(L["Saved Raid(s)"]) + oneraid = true + end + if extended then + lockoutColor = lockoutColorExtended + else + lockoutColor = lockoutColorNormal + end + + local _, _, isHeroic, _ = GetDifficultyInfo(difficultyId) + if (numEncounters and numEncounters > 0) and (encounterProgress and encounterProgress > 0) then + DT.tooltip:AddDoubleLine(format(lockoutInfoFormat, maxPlayers, (isHeroic and "H" or "N"), name, encounterProgress, numEncounters), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) + else + DT.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, (isHeroic and "H" or "N"), name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) + end + end + end + + local addedLine = false + for i = 1, GetNumSavedWorldBosses() do + name, instanceID, reset = GetSavedWorldBossInfo(i) + if(reset) then + if(not addedLine) then + DT.tooltip:AddLine(' ') + DT.tooltip:AddLine(RAID_INFO_WORLD_BOSS.."(s)") + addedLine = true + end + DT.tooltip:AddDoubleLine(name, SecondsToTime(reset, true, nil, 3), 1, 1, 1, 0.8, 0.8, 0.8) + end + end + + local LeiShenKey = IsQuestFlaggedCompleted(32626) + local Trove = IsQuestFlaggedCompleted(32609) + + if level == 90 and E.db.sle.lfrshow.leishen then + DT.tooltip:AddDoubleLine(L["Key to the Palace of Lei Shen:"], LeiShenKey and "\124cffff0000"..L["Looted"].."\124r" or "\124cff00ff00"..L["Not looted"].."\124r", 1, 1, 1, 0.8, 0.8, 0.8) + DT.tooltip:AddDoubleLine(L["Trove of the Thunder King:"], Trove and "\124cffff0000"..L["Looted"].."\124r" or "\124cff00ff00"..L["Not looted"].."\124r", 1, 1, 1, 0.8, 0.8, 0.8) + end + + local timeText + local Hr, Min, AmPm = CalculateTimeValues(true) + + DT.tooltip:AddLine(" ") + if AmPm == -1 then + DT.tooltip:AddDoubleLine(E.db.datatexts.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, + format(europeDisplayFormat_nocolor, Hr, Min), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + else + DT.tooltip:AddDoubleLine(E.db.datatexts.localtime and TIMEMANAGER_TOOLTIP_REALMTIME or TIMEMANAGER_TOOLTIP_LOCALTIME, + format(ukDisplayFormat_nocolor, Hr, Min, APM[AmPm]), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + end + + DT.tooltip:Show() +end + +local int = 3 +function Update(self, t) + int = int - t + + if int > 0 then return end + + if GameTimeFrame.flashInvite then + E:Flash(self, 0.53) + else + E:StopFlash(self) + end + + if enteredFrame then + OnEnter(self) + end + + local Hr, Min, AmPm = CalculateTimeValues(false) + + -- no update quick exit + if (Hr == curHr and Min == curMin and AmPm == curAmPm) and not (int < -15000) then + int = 5 + return + end + + curHr = Hr + curMin = Min + curAmPm = AmPm + + if AmPm == -1 then + self.text:SetFormattedText(europeDisplayFormat, Hr, Min) + else + self.text:SetFormattedText(ukDisplayFormat, Hr, Min, APM[AmPm]) + end + lastPanel = self + int = 5 +end + +DT:RegisterDatatext('Time', {"UPDATE_INSTANCE_INFO"}, OnEvent, Update, Click, OnEnter, OnLeave) \ No newline at end of file diff --git a/ElvUI_SLE/modules/sledatatexts/version.lua b/ElvUI_SLE/modules/sledatatexts/version.lua new file mode 100644 index 0000000..c9ed4ff --- /dev/null +++ b/ElvUI_SLE/modules/sledatatexts/version.lua @@ -0,0 +1,46 @@ +--Version datatext. Only in Russian for now. +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local DT = E:GetModule('DataTexts') +local SLE = E:GetModule('SLE') +local ACD = LibStub("AceConfigDialog-3.0") + +local displayString = ''; +local lastPanel; +local self = lastPanel +local join = string.join +local AddLine = AddLine +local AddDoubleLine =AddDoubleLine +local Eversion = E.version +local format = format + +local function OnEvent(self, event, ...) + self.text:SetFormattedText(displayString, 'ElvUI v', Eversion, SLE.version); +end + +local function Click() + ElvConfigToggle:Click(); + ACD:SelectGroup("ElvUI", "sle") +end + +local function OnEnter(self) + DT:SetupTooltip(self) + + DT.tooltip:AddDoubleLine("ElvUI "..GAME_VERSION_LABEL..format(": |cff99ff33%s|r", Eversion)) + DT.tooltip:AddLine(L["SLE_AUTHOR_INFO"]..". "..GAME_VERSION_LABEL..format(": |cff99ff33%s|r", SLE.version)) + DT.tooltip:AddLine(" ") + DT.tooltip:AddLine(L['SLE_CONTACTS']) + + DT.tooltip:Show() +end + +local function ValueColorUpdate(hex, r, g, b) + displayString = join("", "%s", hex, "%s|r", " : Shadow & Light Edit v", hex, "%s|r") + + if lastPanel ~= nil then + OnEvent(lastPanel) + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + +DT:RegisterDatatext("Version", {'PLAYER_ENTERING_WORLD'}, OnEvent, Update, Click, OnEnter) +