This commit is contained in:
Crum
2019-01-12 02:18:46 -06:00
parent 79a61c59a8
commit eebdf23364
14 changed files with 417 additions and 251 deletions
+1 -1
View File
@@ -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
+1 -4
View File
@@ -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
+7 -8
View File
@@ -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)))
+4 -4
View File
@@ -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)
DT:RegisterDatatext("Armor", {"UNIT_RESISTANCES"}, OnEvent, nil, nil, OnEnter, nil, ARMOR)
+17 -18
View File
@@ -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"])
DT:RegisterDatatext("Avoidance", {"COMBAT_RATING_UPDATE", "PLAYER_TARGET_CHANGED"}, OnEvent, nil, nil, OnEnter, nil, L["Avoidance Breakdown"])
+3 -3
View File
@@ -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)
DT:RegisterDatatext("Durability", {"PLAYER_LOGIN", "UPDATE_INVENTORY_ALERTS", "MERCHANT_SHOW"}, OnEvent, nil, OnClick, OnEnter, nil, L["Durability"])
+96 -49
View File
@@ -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)
DT:RegisterDatatext("Friends", {"PLAYER_LOGIN", "FRIENDLIST_UPDATE", "CHAT_MSG_SYSTEM"}, OnEvent, nil, OnClick, OnEnter, nil, FRIENDS)
+26 -2
View File
@@ -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(" ")
+57 -44
View File
@@ -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)
DT:RegisterDatatext("Guild", {"PLAYER_LOGIN", "CHAT_MSG_SYSTEM", "GUILD_ROSTER_UPDATE", "PLAYER_GUILD_UPDATE", "GUILD_MOTD"}, OnEvent, nil, OnClick, OnEnter, nil, GUILD)
+47 -10
View File
@@ -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"])
DT:RegisterDatatext("System", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave, L["System"])
+37 -27
View File
@@ -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)
DT:RegisterDatatext("Time", {"UPDATE_INSTANCE_INFO"}, OnEvent, OnUpdate, OnClick, OnEnter, OnLeave)
+4 -4
View File
@@ -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
+15 -19
View File
@@ -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