From eebdf233641269a29cc3c82cca0094205aaf6885 Mon Sep 17 00:00:00 2001 From: Crum Date: Sat, 12 Jan 2019 02:18:46 -0600 Subject: [PATCH] update --- ElvUI/Core/fonts.lua | 2 +- ElvUI/Core/toolkit.lua | 5 +- ElvUI/Modules/Bags/Bags.lua | 15 ++- ElvUI/Modules/DataTexts/Armor.lua | 8 +- ElvUI/Modules/DataTexts/Avoidance.lua | 35 +++--- ElvUI/Modules/DataTexts/Durability.lua | 6 +- ElvUI/Modules/DataTexts/Friends.lua | 145 +++++++++++++-------- ElvUI/Modules/DataTexts/Gold.lua | 28 ++++- ElvUI/Modules/DataTexts/Guild.lua | 101 ++++++++------- ElvUI/Modules/DataTexts/System.lua | 57 +++++++-- ElvUI/Modules/DataTexts/Time.lua | 64 ++++++---- ElvUI/Modules/UnitFrames/UnitFrames.lua | 8 +- ElvUI/Settings/Profile.lua | 34 +++-- ElvUI_Config/DataTexts.lua | 160 +++++++++++++++--------- 14 files changed, 417 insertions(+), 251 deletions(-) diff --git a/ElvUI/Core/fonts.lua b/ElvUI/Core/fonts.lua index 7a3f831..9066fa0 100644 --- a/ElvUI/Core/fonts.lua +++ b/ElvUI/Core/fonts.lua @@ -22,7 +22,7 @@ function E:UpdateBlizzardFonts() local MONOCHROME = "" UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = 12 - CHAT_FONT_HEIGHTS = {10, 12, 13, 14, 15, 16, 17, 18, 19, 20} + CHAT_FONT_HEIGHTS = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} UNIT_NAME_FONT = NAMEFONT NAMEPLATE_FONT = NAMEFONT diff --git a/ElvUI/Core/toolkit.lua b/ElvUI/Core/toolkit.lua index 910a204..e74f208 100644 --- a/ElvUI/Core/toolkit.lua +++ b/ElvUI/Core/toolkit.lua @@ -61,11 +61,8 @@ function E:Height(frame, height) end function E:Point(obj, arg1, arg2, arg3, arg4, arg5) - if arg2 == nil then - arg2 = obj:GetParent() - end + if arg2 == nil then arg2 = obj:GetParent() end - if type(arg1)=="number" then arg1 = E:Scale(arg1) end if type(arg2)=="number" then arg2 = E:Scale(arg2) end if type(arg3)=="number" then arg3 = E:Scale(arg3) end if type(arg4)=="number" then arg4 = E:Scale(arg4) end diff --git a/ElvUI/Modules/Bags/Bags.lua b/ElvUI/Modules/Bags/Bags.lua index 3d03782..67c7643 100644 --- a/ElvUI/Modules/Bags/Bags.lua +++ b/ElvUI/Modules/Bags/Bags.lua @@ -598,9 +598,8 @@ function B:Layout(isBank) f.Bags[bagID][slotID]:ClearAllPoints() end - local anchorPoint, relativePoint if lastButton then - anchorPoint, relativePoint = (self.db.reverseSlots and "BOTTOM" or "TOP"), (self.db.reverseSlots and "TOP" or "BOTTOM") + local anchorPoint, relativePoint = (self.db.reverseSlots and "BOTTOM" or "TOP"), (self.db.reverseSlots and "TOP" or "BOTTOM") if isSplit and newBag and slotID == 1 then E:Point(f.Bags[bagID][slotID], anchorPoint, lastRowButton, relativePoint, 0, self.db.reverseSlots and (buttonSpacing + bagSpacing) or -(buttonSpacing + bagSpacing)) lastRowButton = f.Bags[bagID][slotID] @@ -620,7 +619,7 @@ function B:Layout(isBank) E:Point(f.Bags[bagID][slotID], anchorPoint, lastButton, relativePoint, self.db.reverseSlots and -buttonSpacing or buttonSpacing, 0) end else - anchorPoint = self.db.reverseSlots and "BOTTOMRIGHT" or "TOPLEFT" + local anchorPoint = self.db.reverseSlots and "BOTTOMRIGHT" or "TOPLEFT" E:Point(f.Bags[bagID][slotID], anchorPoint, f.holderFrame, anchorPoint) lastRowButton = f.Bags[bagID][slotID] numContainerRows = numContainerRows + 1 @@ -1336,7 +1335,7 @@ function B:PLAYER_ENTERING_WORLD() end function B:updateContainerFrameAnchors() - local frame, xOffset, yOffset, screenHeight, freeScreenHeight, leftMostPoint, column + local xOffset, yOffset, screenHeight, freeScreenHeight, leftMostPoint, column local screenWidth = GetScreenWidth() local containerScale = 1 local leftLimit = 0 @@ -1357,7 +1356,7 @@ function B:updateContainerFrameAnchors() local frameHeight for _, frameName in ipairs(ContainerFrame1.bags) do - frameHeight = _G[frameName]:GetHeight() + local frameHeight = _G[frameName]:GetHeight() if freeScreenHeight < frameHeight then -- Start a new column @@ -1390,7 +1389,7 @@ function B:updateContainerFrameAnchors() local bagsPerColumn = 0 for index, frameName in ipairs(ContainerFrame1.bags) do - frame = _G[frameName] + local frame = _G[frameName] frame:SetScale(1) if index == 1 then @@ -1465,12 +1464,12 @@ function B:ProgressQuickVendor() if not item then return nil, true end --No more to sell local bag, slot, itemPrice, itemLink = unpack(item) - local stackPrice - local stackCount = select(2, GetContainerItemInfo(bag, slot)) or 1 + local stackPrice = 0 if B.SellFrame.Info.delete then PickupContainerItem(bag, slot) DeleteCursorItem() else + local stackCount = select(2, GetContainerItemInfo(bag, slot)) or 1 stackPrice = (itemPrice or 0) * stackCount if E.db.bags.vendorGrays.details and itemLink then E:Print(format("%s|cFF00DDDDx%d|r %s", itemLink, stackCount, B:FormatMoney(stackPrice))) diff --git a/ElvUI/Modules/DataTexts/Armor.lua b/ElvUI/Modules/DataTexts/Armor.lua index c2751e2..c3e778d 100644 --- a/ElvUI/Modules/DataTexts/Armor.lua +++ b/ElvUI/Modules/DataTexts/Armor.lua @@ -15,7 +15,7 @@ local chanceString = "%.2f%%" local displayString = "" local _, effectiveArmor -local function GetArmorReduction(armor, attackerLevel) +local function PaperDollFrame_GetArmorReduction(armor, attackerLevel) local levelModifier = attackerLevel if levelModifier > 59 then levelModifier = levelModifier + (4.5 * (levelModifier - 59)) @@ -44,14 +44,14 @@ local function OnEnter(self) local playerLevel = UnitLevel("player") + 3 for i = 1, 4 do - local armorReduction = GetArmorReduction(effectiveArmor, playerLevel) + local armorReduction = PaperDollFrame_GetArmorReduction(effectiveArmor, playerLevel) DT.tooltip:AddDoubleLine(playerLevel, format(chanceString, armorReduction), 1, 1, 1) playerLevel = playerLevel - 1 end local targetLevel = UnitLevel("target") if targetLevel and targetLevel > 0 and (targetLevel > playerLevel + 3 or targetLevel < playerLevel) then - local armorReduction = GetArmorReduction(effectiveArmor, targetLevel) + local armorReduction = PaperDollFrame_GetArmorReduction(effectiveArmor, targetLevel) DT.tooltip:AddDoubleLine(targetLevel, format(chanceString, armorReduction), 1, 1, 1) end @@ -67,4 +67,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Armor", {"UNIT_RESISTANCES"}, OnEvent, nil, nil, OnEnter, nil, ARMOR) \ No newline at end of file +DT:RegisterDatatext("Armor", {"UNIT_RESISTANCES"}, OnEvent, nil, nil, OnEnter, nil, ARMOR) diff --git a/ElvUI/Modules/DataTexts/Avoidance.lua b/ElvUI/Modules/DataTexts/Avoidance.lua index 852984c..bf6129f 100644 --- a/ElvUI/Modules/DataTexts/Avoidance.lua +++ b/ElvUI/Modules/DataTexts/Avoidance.lua @@ -3,42 +3,41 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions -local find, format, join, match = string.find, string.format, string.join, string.match +local format, join, match = string.format, string.join, string.match local abs = math.abs --WoW API / Variables +local GetBlockChance = GetBlockChance +local GetBonusBarOffset = GetBonusBarOffset +local GetDodgeChance = GetDodgeChance local GetInventoryItemLink = GetInventoryItemLink local GetInventorySlotInfo = GetInventorySlotInfo local GetItemInfo = GetItemInfo -local UnitLevel = UnitLevel -local GetDodgeChance = GetDodgeChance local GetParryChance = GetParryChance -local GetBlockChance = GetBlockChance -local GetBonusBarOffset = GetBonusBarOffset +local UnitLevel = UnitLevel local BOSS = BOSS +local DEFENSE = DEFENSE local DODGE_CHANCE = DODGE_CHANCE local PARRY_CHANCE = PARRY_CHANCE local BLOCK_CHANCE = BLOCK_CHANCE -DEFENSE = "Defense"; -DODGE_CHANCE = "Dodge Chance"; -PARRY_CHANCE = "Parry Chance"; -BLOCK_CHANCE = "Block Chance"; +DEFENSE = "Defense" +DODGE_CHANCE = "Dodge Chance" +PARRY_CHANCE = "Parry Chance" +BLOCK_CHANCE = "Block Chance" -local displayString, lastPanel +local lastPanel local targetlv, playerlv local baseMissChance, levelDifference, dodge, parry, block, avoidance, unhittable +local displayString = "" local chanceString = "%.2f%%" local AVD_DECAY_RATE = 0.2 local function IsWearingShield() local slotID = GetInventorySlotInfo("SecondaryHandSlot") - local link = GetInventoryItemLink("player", slotID) - if link then - local _, _, itemID = find(link, "(%d+):") + local itemLink = GetInventoryItemLink("player", slotID) - if itemID then - return select(9, GetItemInfo(itemID)) - end + if itemLink then + return select(9, GetItemInfo(match(itemLink, "item:(%d+)"))) end end @@ -107,7 +106,7 @@ local function OnEnter(self) DT.tooltip:AddLine(" ") if unhittable > 0 then - DT.tooltip:AddDoubleLine(L["Unhittable:"], "+" .. format(chanceString, unhittable), 1, 1, 1, 0, 1, 0) + DT.tooltip:AddDoubleLine(L["Unhittable:"], "+"..format(chanceString, unhittable), 1, 1, 1, 0, 1, 0) else DT.tooltip:AddDoubleLine(L["Unhittable:"], format(chanceString, unhittable), 1, 1, 1, 1, 0, 0) end @@ -124,4 +123,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Avoidance", {"COMBAT_RATING_UPDATE", "PLAYER_TARGET_CHANGED"}, OnEvent, nil, nil, OnEnter, nil, L["Avoidance Breakdown"]) \ No newline at end of file +DT:RegisterDatatext("Avoidance", {"COMBAT_RATING_UPDATE", "PLAYER_TARGET_CHANGED"}, OnEvent, nil, nil, OnEnter, nil, L["Avoidance Breakdown"]) diff --git a/ElvUI/Modules/DataTexts/Durability.lua b/ElvUI/Modules/DataTexts/Durability.lua index 58807f1..dccaec0 100644 --- a/ElvUI/Modules/DataTexts/Durability.lua +++ b/ElvUI/Modules/DataTexts/Durability.lua @@ -36,7 +36,7 @@ local function OnEvent(self) lastPanel = self totalDurability = 100 - for _, value in ipairs(slots) do + for _, value in pairs(slots) do local slot = GetInventorySlotInfo(value) current, max = GetInventoryItemDurability(slot) @@ -67,7 +67,7 @@ local function OnEnter(self) end local function ValueColorUpdate(hex) - displayString = join("", DURABILITY, ": ", hex, "%d%%|r") + displayString = join("", L["Durability"], ": ", hex, "%d%%|r") if lastPanel ~= nil then OnEvent(lastPanel, "ELVUI_COLOR_UPDATE") @@ -75,4 +75,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Durability", {"PLAYER_ENTERING_WORLD", "UPDATE_INVENTORY_ALERTS", "MERCHANT_SHOW"}, OnEvent, nil, OnClick, OnEnter, nil, DURABILITY) \ No newline at end of file +DT:RegisterDatatext("Durability", {"PLAYER_LOGIN", "UPDATE_INVENTORY_ALERTS", "MERCHANT_SHOW"}, OnEvent, nil, OnClick, OnEnter, nil, L["Durability"]) diff --git a/ElvUI/Modules/DataTexts/Friends.lua b/ElvUI/Modules/DataTexts/Friends.lua index 430767b..93d6529 100644 --- a/ElvUI/Modules/DataTexts/Friends.lua +++ b/ElvUI/Modules/DataTexts/Friends.lua @@ -3,8 +3,8 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions -local pairs = pairs -local tinsert, sort, wipe, next = table.insert, table.sort, wipe, next +local type, pairs, select, next = type, pairs, select, next +local getn, tinsert, sort, wipe = table.getn, table.insert, table.sort, table.wipe local format, find, join, gsub = string.format, string.find, string.join, string.gsub --WoW API / Variables local SendChatMessage = SendChatMessage @@ -13,15 +13,30 @@ local SetItemRef = SetItemRef local GetFriendInfo = GetFriendInfo local GetNumFriends = GetNumFriends local GetQuestDifficultyColor = GetQuestDifficultyColor +local UnitInParty = UnitInParty +local UnitInRaid = UnitInRaid local ToggleFriendsFrame = ToggleFriendsFrame - -local CHAT_MSG_AFK = CHAT_MSG_AFK -local CHAT_MSG_DND = CHAT_MSG_DND -local FRIENDS = FRIENDS -local LOCALIZED_CLASS_NAMES_FEMALE = LOCALIZED_CLASS_NAMES_FEMALE -local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE - local L_EasyMenu = L_EasyMenu +local CHAT_MSG_AFK, CHAT_MSG_DND = CHAT_MSG_AFK, CHAT_MSG_DND +local FRIENDS = FRIENDS +local OPTIONS_MENU, OPTIONS_MENU, PLAYER_STATUS, PARTY_INVITE = OPTIONS_MENU, OPTIONS_MENU, PLAYER_STATUS, PARTY_INVITE +local CHAT_MSG_WHISPER_INFORM = CHAT_MSG_WHISPER_INFORM +local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE +local LOCALIZED_CLASS_NAMES_FEMALE = LOCALIZED_CLASS_NAMES_FEMALE +local RAID_CLASS_COLORS = RAID_CLASS_COLORS + +local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate") +local menuList = { + {text = OPTIONS_MENU, isTitle = true, notCheckable = true}, + {text = PARTY_INVITE, hasArrow = true, notCheckable = true}, + {text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable = true}, + {text = PLAYER_STATUS, hasArrow = true, notCheckable = true, + menuList = { + {text = "|cffE7E716"..CHAT_MSG_AFK.."|r", notCheckable = true, func = function() SendChatMessage("", "AFK") end}, + {text = "|cffFF0000"..CHAT_MSG_DND.."|r", notCheckable = true, func = function() SendChatMessage("", "DND") end} + } + } +} local function GetNumberFriends() local numFriends = GetNumFriends() @@ -39,41 +54,31 @@ local function GetNumberFriends() return numFriends, onlineFriends end -local menuFrame = CreateFrame("Frame", "FriendDatatextRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate") -local menuList = { - {text = OPTIONS_MENU, isTitle = true, notCheckable = true}, - {text = PARTY_INVITE, hasArrow = true, notCheckable = true}, - {text = CHAT_MSG_WHISPER_INFORM, hasArrow = true, notCheckable = true}, - {text = PLAYER_STATUS, hasArrow = true, notCheckable = true, - menuList = { --- {text = "|cff2BC226"..AVAILABLE.."|r", notCheckable = true, func = function() end}, -- TODO - {text = "|cffE7E716"..CHAT_MSG_AFK.."|r", notCheckable = true, func = function() SendChatMessage("", "AFK") end}, - {text = "|cffFF0000"..CHAT_MSG_DND.."|r", notCheckable = true, func = function() SendChatMessage("", "DND") end} - } - } -} - -local function inviteClick(playerName) +local function inviteClick(name) menuFrame:Hide() - InviteByName(playerName) + + if type(name) ~= "number" then + InviteByName(name) + end end -local function whisperClick(playerName) +local function whisperClick(name) menuFrame:Hide() - SetItemRef("player:"..playerName, format("|Hplayer:%1$s|h[%1$s]|h", playerName), "LeftButton") + + SetItemRef("player:"..name, format("|Hplayer:%1$s|h[%1$s]|h", name), "LeftButton") end -local lastPanel local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r" -local levelNameClassString = "|cff%02x%02x%02x%d|r %s" +local levelNameClassString = "|cff%02x%02x%02x%d|r %s%s%s" local totalOnlineString = join("", GUILD_ONLINE_LABEL, ": %s/%s") local tthead = {r = 0.4, g = 0.78, b = 1} local activezone, inactivezone = {r = 0.3, g = 1.0, b = 0.3}, {r = 0.65, g = 0.65, b = 0.65} local displayString = "" -local groupedTable = {"|cffaaaaaa*|r", ""} +local statusTable = {" |cffFFFFFF[|r|cffFF9900"..L["AFK"].."|r|cffFFFFFF]|r", " |cffFFFFFF[|r|cffFF3333"..L["DND"].."|r|cffFFFFFF]|r", ""} local friendTable = {} local friendOnline, friendOffline = gsub(ERR_FRIEND_ONLINE_SS, "\124Hplayer:%%s\124h%[%%s%]\124h", ""), gsub(ERR_FRIEND_OFFLINE_S, "%%s", "") local dataValid = false +local lastPanel local function SortAlphabeticName(a, b) if a[1] and b[1] then @@ -83,14 +88,24 @@ end local function BuildFriendTable(total) wipe(friendTable) - local name, level, class, area, online + local name, level, class, area, connected, status for i = 1, total do - name, level, class, area, online = GetFriendInfo(i) + name, level, class, area, connected, status = GetFriendInfo(i) - if online then + if status == "<"..CHAT_MSG_AFK..">" then + status = statusTable[1] + elseif status == "<"..CHAT_MSG_DND..">" then + status = statusTable[2] + else + status = statusTable[3] + end + + if connected then + --other non-english locales require this for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if class == v then class = k end end - friendTable[i] = {name, level, class, area, online} + + friendTable[i] = {name, level, class, area, connected, status} end end if next(friendTable) then @@ -101,10 +116,14 @@ end local function OnEvent(self, event) local _, onlineFriends = GetNumberFriends() + -- special handler to detect friend coming online or going offline + -- when this is the case, we invalidate our buffered table and update the + -- datatext information if event == "CHAT_MSG_SYSTEM" then if not (find(arg1, friendOnline) or find(arg1, friendOffline)) then return end end + -- force update when showing tooltip dataValid = false self.text:SetText(format(displayString, FRIENDS, onlineFriends)) @@ -116,20 +135,36 @@ local function OnClick() DT.tooltip:Hide() if arg1 == "RightButton" then - local classc, levelc + local menuCountWhispers = 0 + local menuCountInvites = 0 + local classc, levelc, info, shouldSkip menuList[2].menuList = {} menuList[3].menuList = {} - for _, info in friendTable do - if info[5] then - classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2]) - classc = classc or GetQuestDifficultyColor(info[2]) + if getn(friendTable) > 0 then + for i = 1, getn(friendTable) do + info = friendTable[i] + if info[5] then + shouldSkip = false + if (info[6] == statusTable[1]) and E.db.datatexts.friends.hideAFK then + shouldSkip = true + elseif (info[6] == statusTable[2]) and E.db.datatexts.friends.hideDND then + shouldSkip = true + end + if not shouldSkip then + classc, levelc = (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[info[3]]) or RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) + classc = classc or GetQuestDifficultyColor(info[2]) - tinsert(menuList[2].menuList, {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = inviteClick}) - tinsert(menuList[3].menuList, {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[2],classc.r*255,classc.g*255,classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = whisperClick}) + menuCountWhispers = menuCountWhispers + 1 + menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[2], classc.r*255, classc.g*255, classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = whisperClick} + menuCountInvites = menuCountInvites + 1 + menuList[2].menuList[menuCountInvites] = {text = format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[2], classc.r*255, classc.g*255, classc.b*255, info[1]), arg1 = info[1], notCheckable = true, func = inviteClick} + end + end end end + L_EasyMenu(menuList, menuFrame, "cursor", 0, 0, "MENU", 2) else ToggleFriendsFrame(1) @@ -140,24 +175,36 @@ local function OnEnter(self) DT:SetupTooltip(self) local numberOfFriends, onlineFriends = GetNumberFriends() + + -- no friends online, quick exit if onlineFriends == 0 then return end if not dataValid then + -- only retrieve information for all on-line members when we actually view the tooltip if numberOfFriends > 0 then BuildFriendTable(numberOfFriends) end dataValid = true end - local zonec, classc, levelc - DT.tooltip:AddDoubleLine(FRIENDS_LIST, format(totalOnlineString, onlineFriends, numberOfFriends), tthead.r, tthead.g, tthead.b, tthead.r, tthead.g, tthead.b) + local zonec, classc, levelc, info, shouldSkip + DT.tooltip:AddDoubleLine(L["Friends List"], format(totalOnlineString, onlineFriends, numberOfFriends), tthead.r, tthead.g, tthead.b, tthead.r, tthead.g, tthead.b) if onlineFriends > 0 then - for _, info in friendTable do + for i = 1, getn(friendTable) do + info = friendTable[i] if info[5] then - if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end + shouldSkip = false + if (info[6] == statusTable[1]) and E.db.datatexts.friends.hideAFK then + shouldSkip = true + elseif (info[6] == statusTable[2]) and E.db.datatexts.friends.hideDND then + shouldSkip = true + end + if not shouldSkip then + if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end + classc, levelc = (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[info[3]]) or RAID_CLASS_COLORS[info[3]], GetQuestDifficultyColor(info[2]) - classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[3]], GetQuestDifficultyColor(info[2]) - classc = classc or GetQuestDifficultyColor(info[2]) + classc = classc or GetQuestDifficultyColor(info[2]) - DT.tooltip:AddDoubleLine(format(levelNameClassString, levelc.r*255,levelc.g*255,levelc.b*255, info[2], info[1]), info[4], classc.r,classc.g,classc.b, zonec.r,zonec.g,zonec.b) + DT.tooltip:AddDoubleLine(format(levelNameClassString, levelc.r*255, levelc.g*255, levelc.b*255, info[2], info[1], "", " " .. info[6]), info[4], classc.r, classc.g, classc.b, zonec.r, zonec.g, zonec.b) + end end end end @@ -174,4 +221,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, FRIENDS) \ No newline at end of file +DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, FRIENDS) diff --git a/ElvUI/Modules/DataTexts/Gold.lua b/ElvUI/Modules/DataTexts/Gold.lua index f477d71..4b50957 100644 --- a/ElvUI/Modules/DataTexts/Gold.lua +++ b/ElvUI/Modules/DataTexts/Gold.lua @@ -5,9 +5,11 @@ local DT = E:GetModule("DataTexts"); --Lua functions local pairs = pairs local join = string.join +local tinsert, wipe = table.insert, table.wipe --WoW API / Variables local GetMoney = GetMoney local IsShiftKeyDown = IsShiftKeyDown +local RAID_CLASS_COLORS = RAID_CLASS_COLORS local Profit = 0 local Spent = 0 @@ -20,6 +22,10 @@ local function OnEvent(self) 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] = E.myclass + local OldMoney = ElvDB.gold[E.myrealm][E.myname] or NewMoney local Change = NewMoney - OldMoney @@ -44,28 +50,46 @@ local function OnClick(self) end end +local myGold = {} local function OnEnter(self) DT:SetupTooltip(self) + local style = E.db.datatexts.goldFormat or "BLIZZARD" DT.tooltip:AddLine(L["Session:"]) DT.tooltip:AddDoubleLine(L["Earned:"], E:FormatMoney(Profit, style), 1, 1, 1, 1, 1, 1) DT.tooltip:AddDoubleLine(L["Spent:"], E:FormatMoney(Spent, style), 1, 1, 1, 1, 1, 1) + if Profit < Spent then DT.tooltip:AddDoubleLine(L["Deficit:"], E:FormatMoney(Profit - Spent, style), 1, 0, 0, 1, 1, 1) elseif (Profit - Spent) > 0 then DT.tooltip:AddDoubleLine(L["Profit:"], E:FormatMoney(Profit - Spent, style), 0, 1, 0, 1, 1, 1) end + DT.tooltip:AddLine(" ") local totalGold = 0; DT.tooltip:AddLine(L["Character: "]) + wipe(myGold) for k in pairs(ElvDB.gold[E.myrealm]) do if ElvDB.gold[E.myrealm][k] then - DT.tooltip:AddDoubleLine(k, E:FormatMoney(ElvDB.gold[E.myrealm][k], style), 1, 1, 1, 1, 1, 1) - totalGold = totalGold + ElvDB.gold[E.myrealm][k] + local class = ElvDB.class[E.myrealm][k] or "PRIEST" + local color = class and (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]) + tinsert (myGold, + { + name = k, + amount = ElvDB.gold[E.myrealm][k], + amountText = E:FormatMoney(ElvDB.gold[E.myrealm][k], E.db.datatexts.goldFormat or "BLIZZARD", not E.db.datatexts.goldCoins), + r = color.r, g = color.g, b = color.b, + } + ) end + totalGold = totalGold + ElvDB.gold[E.myrealm][k] + end + + for _, g in ipairs(myGold) do + DT.tooltip:AddDoubleLine(g.name == E.myname and g.name or g.name, g.amountText, g.r, g.g, g.b, 1, 1, 1) end DT.tooltip:AddLine(" ") diff --git a/ElvUI/Modules/DataTexts/Guild.lua b/ElvUI/Modules/DataTexts/Guild.lua index 6528c9c..2080a75 100644 --- a/ElvUI/Modules/DataTexts/Guild.lua +++ b/ElvUI/Modules/DataTexts/Guild.lua @@ -3,10 +3,11 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions -local unpack = unpack -local format, join = string.format, string.join -local getn, tinsert, sort, wipe = table.getn, table.insert, table.sort, table.wipe +local select, unpack = select, unpack +local format, find, join, split, upper = string.format, string.find, string.join, string.split, string.upper +local getn, sort, wipe = table.getn, table.sort, table.wipe --WoW API / Variables +local L_EasyMenu = L_EasyMenu local GetGuildInfo = GetGuildInfo local GetGuildRosterInfo = GetGuildRosterInfo local GetGuildRosterMOTD = GetGuildRosterMOTD @@ -19,35 +20,33 @@ local InviteByName = InviteByName local IsInGuild = IsInGuild local IsShiftKeyDown = IsShiftKeyDown local SetItemRef = SetItemRef -local ToggleFriendsFrame = ToggleFriendsFrame - +--[[local ToggleFriendsFrame = ToggleFriendsFrame local GUILD = GUILD local GUILD_MOTD = GUILD_MOTD -local LOCALIZED_CLASS_NAMES_FEMALE = LOCALIZED_CLASS_NAMES_FEMALE -local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE +local PARTY_INVITE, OPTIONS_MENU = PARTY_INVITE, OPTIONS_MENU +local CHAT_MSG_WHISPER_INFORM = CHAT_MSG_WHISPER_INFORM +local RAID_CLASS_COLORS = RAID_CLASS_COLORS--]] -local L_EasyMenu = L_EasyMenu - -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 activezone, inactivezone = {r=0.3, g=1.0, b=0.3}, {r=0.65, g=0.65, b=0.65} -local groupedTable = { "|cffaaaaaa*|r", "" } +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 activezone, inactivezone = {r = 0.3, g = 1.0, b = 0.3}, {r = 0.65, g = 0.65, b = 0.65} local displayString = "" local noGuildString = "" local guildInfoString = "%s" local guildInfoString2 = join("", GUILD, ": %d/%d") local guildMotDString = "%s |cffaaaaaa- |cffffffff%s" local levelNameString = "|cff%02x%02x%02x%d|r |cff%02x%02x%02x%s|r %s" -local levelNameStatusString = "|cff%02x%02x%02x%d|r %s" +local levelNameStatusString = "|cff%02x%02x%02x%d|r %s%s " local nameRankString = "%s |cff999999-|cffffffff %s" local moreMembersOnlineString = join("", "+ %d ", GUILD_ONLINE_LABEL, "...") local noteString = join("", "|cff999999 ", LABEL_NOTE, ":|r %s") local officerNoteString = join("", "|cff999999 ", GUILD_RANK1_DESC, ":|r %s") +local FRIEND_ONLINE, FRIEND_OFFLINE = select(2, split(" ", ERR_FRIEND_ONLINE_SS, 2)), select(2, split(" ", ERR_FRIEND_OFFLINE_S, 2)) local guildTable, guildMotD = {}, "" local lastPanel local function sortByRank(a, b) if a and b then - return a[9] < b[9] + return a[10] < b[10] end end @@ -65,37 +64,48 @@ local function SortGuildTable(shift) end end +local onlinestatusstring = "|cffFFFFFF[|r|cffFF0000%s|r|cffFFFFFF]|r" +local onlinestatus = { + [0] = "", + [1] = format(onlinestatusstring, L["AFK"]), + [2] = format(onlinestatusstring, L["DND"]), +} + local function BuildGuildTable() wipe(guildTable) - local name, rank, rankIndex, level, class, zone, note, officernote, online + local _, name, rank, rankIndex, level, zone, note, officernote, connected, status, englishClass local totalMembers = GetNumGuildMembers() for i = 1, totalMembers do - name, rank, rankIndex, level, class, zone, note, officernote, online = GetGuildRosterInfo(i) - if not name then return end - - if online then - for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do if class == v then class = k end end - for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do if class == v then class = k end end - tinsert(guildTable, {name, rank, level, zone, note, officernote, online, class, rankIndex}) + name, rank, rankIndex, level, englishClass, zone, note, officernote, connected, status = GetGuildRosterInfo(i) + if not name then break end + if englishClass then + englishClass = upper(englishClass) + end + if connected then + guildTable[getn(guildTable) + 1] = {name, rank, level, zone, note, officernote, connected, onlinestatus[status], englishClass, rankIndex} end end end -local function UpdateGuildMessage() - guildMotD = GetGuildRosterMOTD() -end - local eventHandlers = { + ["CHAT_MSG_SYSTEM"] = function(_, arg1) + if (FRIEND_ONLINE ~= nil or FRIEND_OFFLINE ~= nil) and arg1 and (find(arg1, FRIEND_ONLINE) or find(arg1, FRIEND_OFFLINE)) then + E:Delay(10, function() + GuildRoster() + end) + end + end, -- when we enter the world and guildframe is not available then -- load guild frame, update guild message - ["PLAYER_ENTERING_WORLD"] = function() - GuildRoster() + ["PLAYER_LOGIN"] = function() + guildMotD = GetGuildRosterMOTD() end, -- Guild Roster updated, so rebuild the guild table ["GUILD_ROSTER_UPDATE"] = function(self) + GuildRoster() BuildGuildTable() - UpdateGuildMessage() + guildMotD = GetGuildRosterMOTD() if GetMouseFocus() == self then self:GetScript("OnEnter")(self, nil, true) @@ -103,20 +113,18 @@ local eventHandlers = { end, ["PLAYER_GUILD_UPDATE"] = GuildRoster, -- our guild message of the day changed - ["GUILD_MOTD"] = function(self) + ["GUILD_MOTD"] = function() guildMotD = arg1 end, - ["ELVUI_FORCE_RUN"] = E.noop, + ["ELVUI_FORCE_RUN"] = GuildRoster, ["ELVUI_COLOR_UPDATE"] = E.noop, - - ["PLAYER_LOGIN"] = GuildRoster, -- Temporarily } -local function OnEvent(self, event) +local function OnEvent(self, event, ...) lastPanel = self if IsInGuild() then - eventHandlers[event](self, event) + eventHandlers[event](self, unpack(arg)) self.text:SetText(format(displayString, getn(guildTable))) else @@ -146,6 +154,8 @@ local function OnClick() DT.tooltip:Hide() local classc, levelc, info + local menuCountWhispers = 0 + local menuCountInvites = 0 menuList[2].menuList = {} menuList[3].menuList = {} @@ -153,10 +163,13 @@ local function OnClick() for i = 1, getn(guildTable) do info = guildTable[i] if info[7] and info[1] ~= E.myname then - classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[8]], GetQuestDifficultyColor(info[3]) - - tinsert(menuList[2].menuList, {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[3], classc.r*255,classc.g*255,classc.b*255, info[1], ""), arg1 = info[1],notCheckable=true, func = inviteClick}) - tinsert(menuList[3].menuList, {text = format(levelNameString, levelc.r*255,levelc.g*255,levelc.b*255, info[3], classc.r*255,classc.g*255,classc.b*255, info[1], ""), arg1 = info[1],notCheckable=true, func = whisperClick}) + classc, levelc = (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[info[9]]) or RAID_CLASS_COLORS[info[9]], GetQuestDifficultyColor(info[3]) + if not info[11] then + menuCountInvites = menuCountInvites + 1 + menuList[2].menuList[menuCountInvites] = {text = format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], ""), arg1 = info[1],notCheckable = true, func = inviteClick} + end + menuCountWhispers = menuCountWhispers + 1 + menuList[3].menuList[menuCountWhispers] = {text = format(levelNameString, levelc.r*255, levelc.g*255, levelc.b*255, info[3], classc.r*255, classc.g*255, classc.b*255, info[1], ""), arg1 = info[1],notCheckable = true, func = whisperClick} end end @@ -172,8 +185,8 @@ local function OnEnter(self, _, noUpdate) DT:SetupTooltip(self) local online, total = 0, GetNumGuildMembers(true) - for i = 0, total do local _, _, _, _, _, _, _, _, connected = GetGuildRosterInfo(i) if connected then online = online + 1 end end - if not guildTable[1] then BuildGuildTable() end + for i = 0, total do if select(9, GetGuildRosterInfo(i)) then online = online + 1 end end + if getn(guildTable) == 0 then BuildGuildTable() end SortGuildTable(IsShiftKeyDown()) @@ -202,14 +215,14 @@ local function OnEnter(self, _, noUpdate) info = guildTable[i] if GetRealZoneText() == info[4] then zonec = activezone else zonec = inactivezone end - classc, levelc = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[info[8]], GetQuestDifficultyColor(info[3]) + classc, levelc = (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[info[9]]) or RAID_CLASS_COLORS[info[9]], GetQuestDifficultyColor(info[3]) if IsShiftKeyDown() then DT.tooltip:AddDoubleLine(format(nameRankString, info[1], info[2]), info[4], classc.r, classc.g, classc.b, zonec.r, zonec.g, zonec.b) if info[5] ~= "" then DT.tooltip:AddLine(format(noteString, info[5]), ttsubh.r, ttsubh.g, ttsubh.b, 1) end if info[6] ~= "" then DT.tooltip:AddLine(format(officerNoteString, info[6]), ttoff.r, ttoff.g, ttoff.b, 1) end else - DT.tooltip:AddDoubleLine(format(levelNameStatusString, levelc.r*255, levelc.g*255, levelc.b*255, info[3], info[1], " " .. info[8]), info[4], classc.r,classc.g,classc.b, zonec.r,zonec.g,zonec.b) + DT.tooltip:AddDoubleLine(format(levelNameStatusString, levelc.r*255, levelc.g*255, levelc.b*255, info[3], info[1], "", info[8]), info[4], classc.r, classc.g, classc.b, zonec.r, zonec.g, zonec.b) end shown = shown + 1 end @@ -231,4 +244,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Guild", {"PLAYER_ENTERING_WORLD", "GUILD_ROSTER_UPDATE", "PLAYER_GUILD_UPDATE", "GUILD_MOTD"}, OnEvent, nil, OnClick, OnEnter, nil, GUILD) \ No newline at end of file +DT:RegisterDatatext("Guild", {"PLAYER_LOGIN", "CHAT_MSG_SYSTEM", "GUILD_ROSTER_UPDATE", "PLAYER_GUILD_UPDATE", "GUILD_MOTD"}, OnEvent, nil, OnClick, OnEnter, nil, GUILD) diff --git a/ElvUI/Modules/DataTexts/System.lua b/ElvUI/Modules/DataTexts/System.lua index a4915b1..a3d7022 100644 --- a/ElvUI/Modules/DataTexts/System.lua +++ b/ElvUI/Modules/DataTexts/System.lua @@ -3,15 +3,21 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions -local collectgarbage = collectgarbage +local select, collectgarbage = select, collectgarbage +local sort, wipe = table.sort, wipe local floor = math.floor local format = string.format local gcinfo = gcinfo --WoW API / Variables -local GetNetStats = GetNetStats +local GetAddOnInfo = GetAddOnInfo +local GetCVar = GetCVar local GetFramerate = GetFramerate +local GetNetStats = GetNetStats +local GetNumAddOns = GetNumAddOns +local IsAddOnLoaded = IsAddOnLoaded +local IsShiftKeyDown = IsShiftKeyDown -local int = 6 +local int, int2 = 6, 5 local statusColors = { "|cff0CD809", "|cffE8DA0F", @@ -23,10 +29,11 @@ local enteredFrame = false local homeLatencyString = "%d ms" local kiloByteString = "%d kb" local megaByteString = "%.2f mb" +local totalMemory = 0 local function formatMem(memory) local mult = 10 ^ 1 - if(memory > 999) then + if memory > 999 then local mem = ((memory / 1024) * mult) / mult return format(megaByteString, mem) else @@ -35,6 +42,23 @@ local function formatMem(memory) end end +local function sortByMemoryOrCPU(a, b) + if a and b then + return (a[3] == b[3] and a[2] < b[2]) or a[3] > b[3] + end +end + +local memoryTable = {} +local function RebuildAddonList() + local addOnCount = GetNumAddOns() + if addOnCount == getn(memoryTable) then return end + + wipe(memoryTable) + for i = 1, addOnCount do + memoryTable[i] = {i, select(2, GetAddOnInfo(i)), 0} + end +end + local function ToggleGameMenuFrame() if GameMenuFrame:IsShown() then PlaySound("igMainMenuQuit") @@ -57,11 +81,19 @@ local function OnEnter(self) enteredFrame = true DT:SetupTooltip(self) - local totalMemory = gcinfo() - local _, _, latency = GetNetStats() - DT.tooltip:AddDoubleLine(L["Home Latency:"], format(homeLatencyString, latency), 0.69, 0.31, 0.31, 0.84, 0.75, 0.65) + totalMemory = gcinfo() + DT.tooltip:AddDoubleLine(L["Home Latency:"], format(homeLatencyString, select(3, GetNetStats())), 0.69, 0.31, 0.31, 0.84, 0.75, 0.65) DT.tooltip:AddDoubleLine(L["Total Memory:"], formatMem(totalMemory), 0.69, 0.31, 0.31, 0.84, 0.75, 0.65) + local ele + DT.tooltip:AddLine(" ") + for i = 1, getn(memoryTable) do + ele = memoryTable[i] + if ele and IsAddOnLoaded(ele[1]) then + DT.tooltip:AddLine(ele[2]) + end + end + DT.tooltip:Show() end @@ -72,21 +104,26 @@ end local function OnUpdate(self, t) int = int - t + int2 = int2 - t if int < 0 then + RebuildAddonList() + int = 10 + end + if int2 < 0 then local framerate = floor(GetFramerate()) - local _, _, latency = GetNetStats() + local latency = select(3, GetNetStats()) self.text:SetText(format("FPS: %s%d|r MS: %s%d|r", statusColors[framerate >= 30 and 1 or (framerate >= 20 and framerate < 30) and 2 or (framerate >= 10 and framerate < 20) and 3 or 4], framerate, statusColors[latency < 150 and 1 or (latency >= 150 and latency < 300) and 2 or (latency >= 300 and latency < 500) and 3 or 4], latency)) - int = 1 + int2 = 1 if enteredFrame then OnEnter(this) end end end -DT:RegisterDatatext("System", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave, L["System"]) \ No newline at end of file +DT:RegisterDatatext("System", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave, L["System"]) diff --git a/ElvUI/Modules/DataTexts/Time.lua b/ElvUI/Modules/DataTexts/Time.lua index e9c0162..8c33133 100644 --- a/ElvUI/Modules/DataTexts/Time.lua +++ b/ElvUI/Modules/DataTexts/Time.lua @@ -3,11 +3,8 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions -local next, unpack = next, unpack local time = time local format, gsub, join = string.format, string.gsub, string.join -local abs = math.abs -local getn, tinsert = table.getn, table.insert --WoW API / Variables local GetGameTime = GetGameTime local GetNumSavedInstances = GetNumSavedInstances @@ -15,11 +12,13 @@ local GetSavedInstanceInfo = GetSavedInstanceInfo local IsAddOnLoaded = IsAddOnLoaded local SecondsToTime = SecondsToTime +local europeDisplayFormat = join("", "%02d", ":|r%02d") +local instanceFormat = "%s |cffaaaaaa(%s)" local timeDisplayFormat = "" local dateDisplayFormat = "" -local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d") -local lockoutInfoFormat = "|cffaaaaaa(%s)" -local lockoutColorExtended, lockoutColorNormal = {r = 0.3, g = 1, b = 0.3}, {r = .8, g = .8, b = .8} +local enteredFrame = false + +local lastPanel local function OnClick() if IsAddOnLoaded("TimeManager") then -- https://github.com/gashole/TimeManager @@ -33,48 +32,59 @@ end local function OnLeave() DT.tooltip:Hide() + + enteredFrame = false end local function OnEnter(self) DT:SetupTooltip(self) - RequestRaidInfo() + if not enteredFrame then + RequestRaidInfo() - local lockedInstances = {raids = {}} - local _, name, reset + enteredFrame = true + end + local oneraid + local name, id, reset for i = 1, GetNumSavedInstances() do - name, _, reset = GetSavedInstanceInfo(i) + name, id, reset = GetSavedInstanceInfo(i) if name then - tinsert(lockedInstances["raids"], {name, reset}) + if not oneraid then + DT.tooltip:AddLine(L["Saved Instance(s)"]) + + oneraid = true + end + + DT.tooltip:AddDoubleLine(format(instanceFormat, name, id), SecondsToTime(reset, true), 1, 1, 1, 0.8, 0.8, 0.8) + end + + if DT.tooltip:NumLines() > 0 then + DT.tooltip:AddLine(" ") end end - if next(lockedInstances["raids"]) then - DT.tooltip:AddLine(" ") - DT.tooltip:AddLine(L["Saved Raid(s)"]) + DT.tooltip:AddDoubleLine(L["Realm Time:"], format(europeDisplayFormat, GetGameTime()), 1, 1, 1, 0.8, 0.8, 0.8) - for i = 1, getn(lockedInstances["raids"]) do - name, reset = unpack(lockedInstances["raids"][i]) - lockoutColor = extended and lockoutColorExtended or lockoutColorNormal - DT.tooltip:AddDoubleLine(format(lockoutInfoFormat, name), SecondsToTime(abs(reset), 1, 1, false), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) - end - - DT.tooltip:Show() - DT.tooltip:AddLine(" ") - end - - DT.tooltip:AddDoubleLine(L["Realm time:"], format(europeDisplayFormat_nocolor, GetGameTime()), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) DT.tooltip:Show() end -local lastPanel +local function OnEvent(self, event) + if event == "UPDATE_INSTANCE_INFO" and enteredFrame then + OnEnter(self) + end +end + local int = 5 local function OnUpdate(self, t) int = int - t if int > 0 then return end + if enteredFrame then + OnEnter(self) + end + self.text:SetText(gsub(gsub(BetterDate(E.db.datatexts.timeFormat.." "..E.db.datatexts.dateFormat, time()), ":", timeDisplayFormat), "%s", dateDisplayFormat)) lastPanel = self @@ -91,4 +101,4 @@ local function ValueColorUpdate(hex) end E.valueColorUpdateFuncs[ValueColorUpdate] = true -DT:RegisterDatatext("Time", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave) \ No newline at end of file +DT:RegisterDatatext("Time", {"UPDATE_INSTANCE_INFO"}, OnEvent, OnUpdate, OnClick, OnEnter, OnLeave) diff --git a/ElvUI/Modules/UnitFrames/UnitFrames.lua b/ElvUI/Modules/UnitFrames/UnitFrames.lua index cd8409b..1cd966e 100644 --- a/ElvUI/Modules/UnitFrames/UnitFrames.lua +++ b/ElvUI/Modules/UnitFrames/UnitFrames.lua @@ -792,11 +792,11 @@ function UF:UpdateAllHeaders(event) if ORD then ORD:ResetDebuffData() - if instanceType == "party" or instanceType == "raid" then + --[[if instanceType == "party" or instanceType == "raid" then ORD:RegisterDebuffs(E.global.unitframe.aurafilters.RaidDebuffs.spells) - -- else - -- ORD:RegisterDebuffs(E.global.unitframe.aurafilters.CCDebuffs.spells) - end + else + ORD:RegisterDebuffs(E.global.unitframe.aurafilters.CCDebuffs.spells) + end--]] end if E.private.unitframe.disabledBlizzardFrames.party then diff --git a/ElvUI/Settings/Profile.lua b/ElvUI/Settings/Profile.lua index 682b22b..c54ebbf 100644 --- a/ElvUI/Settings/Profile.lua +++ b/ElvUI/Settings/Profile.lua @@ -556,19 +556,17 @@ P["chat"] = { P["datatexts"] = { ["font"] = "PT Sans Narrow", ["fontSize"] = 12, - ["fontOutline"] = "NONE", - ["wordWrap"] = false, - + ["fontOutline"] = "OUTLINE", ["panels"] = { ["LeftChatDataPanel"] = { ["left"] = "Armor", ["middle"] = "Durability", - ["right"] = "Avoidance", + ["right"] = "Avoidance" }, ["RightChatDataPanel"] = { ["left"] = "System", ["middle"] = "Time", - ["right"] = "Gold", + ["right"] = "Gold" }, ["LeftMiniPanel"] = "Guild", ["RightMiniPanel"] = "Friends", @@ -577,22 +575,20 @@ P["datatexts"] = { ["BottomLeftMiniPanel"] = "", ["BottomRightMiniPanel"] = "", ["TopRightMiniPanel"] = "", - ["TopLeftMiniPanel"] = "", + ["TopLeftMiniPanel"] = "" }, - ["battleground"] = true, - ["panelBackdrop"] = true, - ["panelTransparency"] = false, - - --Datatext Options - --General - ["goldFormat"] = "BLIZZARD", - ["goldCoins"] = false, - - --Time Datatext ["timeFormat"] = "%I:%M", ["dateFormat"] = "", - - --Enabled/Disabled Panels + ["battleground"] = true, + ["panelTransparency"] = false, + ["panelBackdrop"] = true, + ["goldFormat"] = "BLIZZARD", + ["noCombatClick"] = false, + ["noCombatHover"] = false, + ["friends"] = { + ["hideAFK"] = false, + ["hideDND"] = false, + }, ["minimapPanels"] = true, ["leftChatPanel"] = true, ["rightChatPanel"] = true, @@ -601,7 +597,7 @@ P["datatexts"] = { ["minimapTopRight"] = false, ["minimapBottom"] = false, ["minimapBottomLeft"] = false, - ["minimapBottomRight"] = false, + ["minimapBottomRight"] = false } --Tooltip diff --git a/ElvUI_Config/DataTexts.lua b/ElvUI_Config/DataTexts.lua index d9b2c1f..c44fded 100644 --- a/ElvUI_Config/DataTexts.lua +++ b/ElvUI_Config/DataTexts.lua @@ -3,10 +3,13 @@ local DT = E:GetModule("DataTexts"); --Cache global variables --Lua functions +local _G = _G +local pairs = pairs local find, upper = string.find, string.upper local getn = table.getn --WoW API / Variables -local GENERAL, NONE = GENERAL, NONE +local HideLeftChat = HideLeftChat +local HideRightChat = HideRightChat local datatexts = {} @@ -14,7 +17,7 @@ function DT:PanelLayoutOptions() for name, data in pairs(DT.RegisteredDataTexts) do datatexts[name] = data.localizedName or L[name] end - datatexts[""] = NONE + datatexts[""] = L["None"] local order local table = E.Options.args.datatexts.args.panels.args @@ -23,9 +26,9 @@ function DT:PanelLayoutOptions() if not _G[pointLoc] then table[pointLoc] = nil return end if type(tab) == "table" then if find(pointLoc, "Chat") then - order = 15; + order = 15 else - order = 20; + order = 20 end table[pointLoc] = { order = order, @@ -38,8 +41,8 @@ function DT:PanelLayoutOptions() type = "select", name = L[option] or upper(option), values = datatexts, - get = function(info) return E.db.datatexts.panels[pointLoc][ info[getn(info)] ]; end, - set = function(info, value) E.db.datatexts.panels[pointLoc][ info[getn(info)] ] = value; DT:LoadDataTexts(); end + get = function(info) return E.db.datatexts.panels[pointLoc][ info[getn(info)] ] end, + set = function(info, value) E.db.datatexts.panels[pointLoc][ info[getn(info)] ] = value DT:LoadDataTexts() end } end elseif type(tab) == "string" then @@ -47,8 +50,8 @@ function DT:PanelLayoutOptions() type = "select", name = L[pointLoc] or pointLoc, values = datatexts, - get = function(info) return E.db.datatexts.panels[pointLoc]; end, - set = function(info, value) E.db.datatexts.panels[pointLoc] = value; DT:LoadDataTexts(); end + get = function(info) return E.db.datatexts.panels[pointLoc] end, + set = function(info, value) E.db.datatexts.panels[pointLoc] = value DT:LoadDataTexts() end } end end @@ -58,8 +61,8 @@ E.Options.args.datatexts = { type = "group", name = L["DataTexts"], childGroups = "tab", - get = function(info) return E.db.datatexts[ info[getn(info)] ]; end, - set = function(info, value) E.db.datatexts[ info[getn(info)] ] = value; DT:LoadDataTexts(); end, + get = function(info) return E.db.datatexts[ info[getn(info)] ] end, + set = function(info, value) E.db.datatexts[ info[getn(info)] ] = value DT:LoadDataTexts() end, args = { intro = { order = 1, @@ -74,18 +77,18 @@ E.Options.args.datatexts = { general = { order = 3, type = "group", - name = GENERAL, + name = L["General"], args = { header = { order = 1, type = "header", - name = GENERAL + name = L["General"] }, generalGroup = { order = 2, type = "group", guiInline = true, - name = GENERAL, + name = L["General"], args = { battleground = { order = 1, @@ -95,21 +98,21 @@ E.Options.args.datatexts = { }, panelTransparency = { order = 2, - name = L["Panel Transparency"], type = "toggle", + name = L["Panel Transparency"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Layout"):SetDataPanelStyle(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Layout"):SetDataPanelStyle() end }, panelBackdrop = { order = 3, - name = L["Backdrop"], type = "toggle", + name = L["Backdrop"], set = function(info, value) E.db.datatexts[ info[getn(info)] ] = value E:GetModule("Layout"):SetDataPanelStyle() - end, + end }, noCombatClick = { order = 4, @@ -154,7 +157,7 @@ E.Options.args.datatexts = { fontSize = { order = 2, type = "range", - name = FONT_SIZE, + name = L["Font Size"], min = 4, max = 22, step = 1 }, fontOutline = { @@ -163,7 +166,7 @@ E.Options.args.datatexts = { name = L["Font Outline"], desc = L["Set the font outline."], values = { - ["NONE"] = NONE, + ["NONE"] = L["None"], ["OUTLINE"] = "OUTLINE", ["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE", ["THICKOUTLINE"] = "THICKOUTLINE" @@ -194,13 +197,13 @@ E.Options.args.datatexts = { name = L["Datatext Panel (Left)"], desc = L["Display data panels below the chat, used for datatexts."], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - if(E.db.LeftChatPanelFaded) then - E.db.LeftChatPanelFaded = true; - HideLeftChat(); + E.db.datatexts[ info[getn(info)] ] = value + if E.db.LeftChatPanelFaded then + E.db.LeftChatPanelFaded = true + HideLeftChat() end - E:GetModule("Chat"):UpdateAnchors(); - E:GetModule("Layout"):ToggleChatPanels(); + E:GetModule("Chat"):UpdateAnchors() + E:GetModule("Layout"):ToggleChatPanels() end }, rightChatPanel = { @@ -209,13 +212,13 @@ E.Options.args.datatexts = { name = L["Datatext Panel (Right)"], desc = L["Display data panels below the chat, used for datatexts."], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - if(E.db.RightChatPanelFaded) then - E.db.RightChatPanelFaded = true; - HideRightChat(); + E.db.datatexts[ info[getn(info)] ] = value + if E.db.RightChatPanelFaded then + E.db.RightChatPanelFaded = true + HideRightChat() end - E:GetModule("Chat"):UpdateAnchors(); - E:GetModule("Layout"):ToggleChatPanels(); + E:GetModule("Chat"):UpdateAnchors() + E:GetModule("Layout"):ToggleChatPanels() end }, minimapPanels = { @@ -224,17 +227,17 @@ E.Options.args.datatexts = { name = L["Minimap Panels"], desc = L["Display minimap panels below the minimap, used for datatexts."], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, minimapTop = { order = 5, - name = L["TopMiniPanel"], type = "toggle", + name = L["TopMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, minimapTopLeft = { @@ -242,17 +245,17 @@ E.Options.args.datatexts = { type = "toggle", name = L["TopLeftMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); - end, + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() + end }, minimapTopRight = { order = 7, type = "toggle", name = L["TopRightMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, minimapBottom = { @@ -260,8 +263,8 @@ E.Options.args.datatexts = { type = "toggle", name = L["BottomMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, minimapBottomLeft = { @@ -269,17 +272,17 @@ E.Options.args.datatexts = { type = "toggle", name = L["BottomLeftMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, minimapBottomRight = { order = 10, - name = L["BottomRightMiniPanel"], type = "toggle", + name = L["BottomRightMiniPanel"], set = function(info, value) - E.db.datatexts[ info[getn(info)] ] = value; - E:GetModule("Minimap"):UpdateSettings(); + E.db.datatexts[ info[getn(info)] ] = value + E:GetModule("Minimap"):UpdateSettings() end }, spacer = { @@ -303,14 +306,14 @@ E.Options.args.datatexts = { header = { order = 1, type = "header", - name = L["Time"], + name = L["Time"] }, timeFormat = { order = 2, type = "select", name = L["Time Format"], values = { - [""] = NONE, + [""] = L["None"], ["%I:%M"] = "03:27", ["%I:%M:%S"] = "03:27:32", ["%I:%M %p"] = "03:27 PM", @@ -324,16 +327,57 @@ E.Options.args.datatexts = { type = "select", name = L["Date Format"], values = { - [""] = NONE, - ["%d/%m/%y "] = "27/03/16", - ["%m/%d/%y "] = "03/27/16", - ["%y/%m/%d "] = "16/03/27", - ["%d.%m.%y "] = "27.03.16" + [""] = L["None"], + ["%d/%m/%y "] = "DD/MM/YY", + ["%m/%d/%y "] = "MM/DD/YY", + ["%y/%m/%d "] = "YY/MM/DD", + ["%d.%m.%y "] = "DD.MM.YY", + ["%m.%d.%y "] = "MM.DD.YY", + ["%y.%m.%d "] = "YY.MM.DD" + } + } + } + }, + friends = { + order = 6, + type = "group", + name = L["Friends"], + args = { + header = { + order = 1, + type = "header", + name = L["Friends"] + }, + description = { + order = 2, + type = "description", + name = L["Hide specific sections in the datatext tooltip."] + }, + hideGroup = { + order = 3, + type = "group", + guiInline = true, + name = L["Hide"], + args = { + hideAFK = { + order = 1, + type = "toggle", + name = L["Away"], + get = function(info) return E.db.datatexts.friends.hideAFK end, + set = function(info, value) E.db.datatexts.friends.hideAFK = value DT:LoadDataTexts() end + }, + hideDND = { + order = 2, + type = "toggle", + name = L["Busy"], + get = function(info) return E.db.datatexts.friends.hideDND end, + set = function(info, value) E.db.datatexts.friends.hideDND = value DT:LoadDataTexts() end + } } } } } } -}; +} -DT:PanelLayoutOptions(); \ No newline at end of file +DT:PanelLayoutOptions()