mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-05 13:10:00 +00:00
begin utilizing ClassicAPI
This commit is contained in:
+11
-9
@@ -265,6 +265,13 @@ function pfUI.api.modf(f)
|
||||
return math.ceil(f), mod(f,1)
|
||||
end
|
||||
|
||||
-- [ GetServerEpoch ]
|
||||
-- Returns a Unix epoch (seconds) representing the current server wall
|
||||
-- clock, packed in the player's local timezone so that date(fmt, epoch)
|
||||
-- prints server-time strings regardless of where the player sits.
|
||||
-- Returns nil before login; date(fmt, nil) silently falls back to local time.
|
||||
pfUI.api.GetServerEpoch = C_DateAndTime.GetServerTimeLocal
|
||||
|
||||
-- [ GetSlashCommands ]
|
||||
-- Lists all registeres slash commands
|
||||
-- 'text' [string] optional, a specific command to find
|
||||
@@ -415,17 +422,12 @@ end
|
||||
function pfUI.api.FindItem(item)
|
||||
for bag = 4, 0, -1 do
|
||||
for slot = 1, GetContainerNumSlots(bag) do
|
||||
local itemLink = GetContainerItemLink(bag,slot)
|
||||
if itemLink then
|
||||
local _, _, parse = strfind(itemLink, "(%d+):")
|
||||
local query = GetItemInfo(parse)
|
||||
if query and query ~= "" and string.lower(query) == string.lower(item) then
|
||||
return bag, slot
|
||||
end
|
||||
local query = C_Item.GetItemName(ItemLocation:CreateFromBagAndSlot(bag, slot))
|
||||
if query and query ~= "" and string.lower(query) == string.lower(item) then
|
||||
return bag, slot
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
@@ -439,7 +441,7 @@ function pfUI.api.GetBagFamily(bag)
|
||||
if bag == 0 then return "BAG" end -- backpack
|
||||
if bag == -1 then return "BAG" end -- bank
|
||||
|
||||
local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bag)) or "", "item:(%d+)")
|
||||
local id = GetInventoryItemID("player", ContainerIDToInventoryID(bag))
|
||||
if id then
|
||||
local _, _, _, _, _, itemType, subType = GetItemInfo(id)
|
||||
local bagsubtype = L["bagtypes"][subType]
|
||||
|
||||
@@ -69,12 +69,14 @@ function GameTooltip.SetBagItem(self, container, slot)
|
||||
end
|
||||
|
||||
libtooltip.itemLink = GetContainerItemLink(container, slot)
|
||||
libtooltip.itemID = C_Container.GetContainerItemID(container, slot)
|
||||
_, libtooltip.itemCount = GetContainerItemInfo(container, slot)
|
||||
return pfHookSetBagItem(self, container, slot)
|
||||
end
|
||||
|
||||
local pfHookSetQuestLogItem = GameTooltip.SetQuestLogItem
|
||||
function GameTooltip.SetQuestLogItem(self, itemType, index)
|
||||
libtooltip.itemID = GetQuestLogItemID(itemType, index)
|
||||
libtooltip.itemLink = GetQuestLogItemLink(itemType, index)
|
||||
if not libtooltip.itemLink then return end
|
||||
return pfHookSetQuestLogItem(self, itemType, index)
|
||||
@@ -82,12 +84,14 @@ end
|
||||
|
||||
local pfHookSetQuestItem = GameTooltip.SetQuestItem
|
||||
function GameTooltip.SetQuestItem(self, itemType, index)
|
||||
libtooltip.itemID = GetQuestItemID(itemType, index)
|
||||
libtooltip.itemLink = GetQuestItemLink(itemType, index)
|
||||
return pfHookSetQuestItem(self, itemType, index)
|
||||
end
|
||||
|
||||
local pfHookSetLootItem = GameTooltip.SetLootItem
|
||||
function GameTooltip.SetLootItem(self, slot)
|
||||
libtooltip.itemID = GetLootSlotItemID(slot)
|
||||
libtooltip.itemLink = GetLootSlotLink(slot)
|
||||
pfHookSetLootItem(self, slot)
|
||||
end
|
||||
@@ -95,36 +99,42 @@ end
|
||||
local pfHookSetInboxItem = GameTooltip.SetInboxItem
|
||||
function GameTooltip.SetInboxItem(self, mailID, attachmentIndex)
|
||||
local itemName, itemTexture, inboxItemCount, inboxItemQuality = GetInboxItem(mailID)
|
||||
libtooltip.itemID = GetInboxItemID(mailID)
|
||||
libtooltip.itemLink = GetItemLinkByName(itemName)
|
||||
return pfHookSetInboxItem(self, mailID, attachmentIndex)
|
||||
end
|
||||
|
||||
local pfHookSetInventoryItem = GameTooltip.SetInventoryItem
|
||||
function GameTooltip.SetInventoryItem(self, unit, slot)
|
||||
libtooltip.itemID = GetInventoryItemID(unit, slot)
|
||||
libtooltip.itemLink = GetInventoryItemLink(unit, slot)
|
||||
return pfHookSetInventoryItem(self, unit, slot)
|
||||
end
|
||||
|
||||
local pfHookSetLootRollItem = GameTooltip.SetLootRollItem
|
||||
function GameTooltip.SetLootRollItem(self, id)
|
||||
libtooltip.itemID = GetLootRollItemID(id)
|
||||
libtooltip.itemLink = GetLootRollItemLink(id)
|
||||
return pfHookSetLootRollItem(self, id)
|
||||
end
|
||||
|
||||
local pfHookSetMerchantItem = GameTooltip.SetMerchantItem
|
||||
function GameTooltip.SetMerchantItem(self, merchantIndex)
|
||||
libtooltip.itemID = GetMerchantItemID(merchantIndex)
|
||||
libtooltip.itemLink = GetMerchantItemLink(merchantIndex)
|
||||
return pfHookSetMerchantItem(self, merchantIndex)
|
||||
end
|
||||
|
||||
local pfHookSetCraftItem = GameTooltip.SetCraftItem
|
||||
function GameTooltip.SetCraftItem(self, skill, slot)
|
||||
libtooltip.itemID = GetCraftReagentItemID(skill, slot)
|
||||
libtooltip.itemLink = GetCraftReagentItemLink(skill, slot)
|
||||
return pfHookSetCraftItem(self, skill, slot)
|
||||
end
|
||||
|
||||
local pfHookSetCraftSpell = GameTooltip.SetCraftSpell
|
||||
function GameTooltip.SetCraftSpell(self, slot)
|
||||
libtooltip.itemID = GetCraftSpellID(slot)
|
||||
libtooltip.itemLink = GetCraftItemLink(slot)
|
||||
return pfHookSetCraftSpell(self, slot)
|
||||
end
|
||||
@@ -132,8 +142,10 @@ end
|
||||
local pfHookSetTradeSkillItem = GameTooltip.SetTradeSkillItem
|
||||
function GameTooltip.SetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||
if reagentIndex then
|
||||
libtooltip.itemID = GetTradeSkillReagentItemID(skillIndex, reagentIndex)
|
||||
libtooltip.itemLink = GetTradeSkillReagentItemLink(skillIndex, reagentIndex)
|
||||
else
|
||||
libtooltip.itemID = GetTradeSkillItemID(skillIndex)
|
||||
libtooltip.itemLink = GetTradeSkillItemLink(skillIndex)
|
||||
end
|
||||
return pfHookSetTradeSkillItem(self, skillIndex, reagentIndex)
|
||||
@@ -142,6 +154,7 @@ end
|
||||
local pfHookSetAuctionItem = GameTooltip.SetAuctionItem
|
||||
function GameTooltip.SetAuctionItem(self, atype, index)
|
||||
_, _, libtooltip.itemCount = GetAuctionItemInfo(atype, index)
|
||||
libtooltip.itemID = GetAuctionItemID(atype, index)
|
||||
libtooltip.itemLink = GetAuctionItemLink(atype, index)
|
||||
return pfHookSetAuctionItem(self, atype, index)
|
||||
end
|
||||
@@ -149,6 +162,7 @@ end
|
||||
local pfHookSetAuctionSellItem = GameTooltip.SetAuctionSellItem
|
||||
function GameTooltip.SetAuctionSellItem(self)
|
||||
local itemName, _, itemCount = GetAuctionSellItemInfo()
|
||||
libtooltip.itemID = GetAuctionSellItemID()
|
||||
libtooltip.itemCount = itemCount
|
||||
libtooltip.itemLink = GetItemLinkByName(itemName)
|
||||
return pfHookSetAuctionSellItem(self)
|
||||
@@ -156,12 +170,14 @@ end
|
||||
|
||||
local pfHookSetTradePlayerItem = GameTooltip.SetTradePlayerItem
|
||||
function GameTooltip.SetTradePlayerItem(self, index)
|
||||
libtooltip.itemID = GetTradePlayerItemID(index)
|
||||
libtooltip.itemLink = GetTradePlayerItemLink(index)
|
||||
return pfHookSetTradePlayerItem(self, index)
|
||||
end
|
||||
|
||||
local pfHookSetTradeTargetItem = GameTooltip.SetTradeTargetItem
|
||||
function GameTooltip.SetTradeTargetItem(self, index)
|
||||
libtooltip.itemID = GetTradeTargetItemID(index)
|
||||
libtooltip.itemLink = GetTradeTargetItemLink(index)
|
||||
return pfHookSetTradeTargetItem(self, index)
|
||||
end
|
||||
|
||||
+20
-3
@@ -32,6 +32,18 @@ if pfUI.api.libunitscan then return end
|
||||
local units = { players = {}, mobs = {} }
|
||||
local queue = { }
|
||||
|
||||
-- Feed (guid, name, classToken) into ClassicAPI's persistent name
|
||||
-- cache when the unit's GUID is resolvable. Roster-style packets
|
||||
-- (party / raid / inspect on glance) carry class inline, so the
|
||||
-- engine often doesn't issue a separate name query and the DLL's
|
||||
-- NameCache hook never fires for them — this is where we close that gap.
|
||||
local function RememberByUnit(unit, name, class)
|
||||
if not (name and class) then return end
|
||||
local guid = UnitGUID(unit)
|
||||
if not guid then return end
|
||||
C_PlayerCache.RememberPlayer(guid, name, class, UnitRace(unit), UnitSex(unit))
|
||||
end
|
||||
|
||||
function GetUnitData(name, active)
|
||||
if units["players"][name] then
|
||||
local ret = units["players"][name]
|
||||
@@ -78,6 +90,7 @@ libunitscan:SetScript("OnEvent", function()
|
||||
local level = UnitLevel("player")
|
||||
local guild = GetGuildInfo("player")
|
||||
AddData("players", name, class, level, nil, guild)
|
||||
RememberByUnit("player", name, class)
|
||||
|
||||
elseif event == "FRIENDLIST_UPDATE" then
|
||||
local name, class, level
|
||||
@@ -99,11 +112,13 @@ libunitscan:SetScript("OnEvent", function()
|
||||
end
|
||||
|
||||
elseif event == "RAID_ROSTER_UPDATE" then
|
||||
local name, class, SubGroup, level, _
|
||||
local name, class, SubGroup, level, unit, _
|
||||
for i = 1, GetNumRaidMembers() do
|
||||
unit = "raid" .. i
|
||||
name, _, SubGroup, level, class = GetRaidRosterInfo(i)
|
||||
class = L["class"][class] or nil
|
||||
AddData("players", name, class, level)
|
||||
RememberByUnit(unit, name, class)
|
||||
end
|
||||
|
||||
elseif event == "PARTY_MEMBERS_CHANGED" then
|
||||
@@ -115,10 +130,11 @@ libunitscan:SetScript("OnEvent", function()
|
||||
level = UnitLevel(unit)
|
||||
guild = GetGuildInfo(unit)
|
||||
AddData("players", name, class, level, nil, guild)
|
||||
RememberByUnit(unit, name, class)
|
||||
end
|
||||
|
||||
elseif event == "WHO_LIST_UPDATE" or event == "CHAT_MSG_SYSTEM" then
|
||||
local name, class, level, _
|
||||
local name, class, level, guild, _
|
||||
for i = 1, GetNumWhoResults() do
|
||||
name, guild, level, _, class, _ = GetWhoInfo(i)
|
||||
class = L["class"][class] or nil
|
||||
@@ -127,7 +143,7 @@ libunitscan:SetScript("OnEvent", function()
|
||||
|
||||
elseif event == "UPDATE_MOUSEOVER_UNIT" or event == "PLAYER_TARGET_CHANGED" then
|
||||
local scan = event == "PLAYER_TARGET_CHANGED" and "target" or "mouseover"
|
||||
local name, class, level, elite, _
|
||||
local name, class, level, elite, guild, _
|
||||
if UnitIsPlayer(scan) then
|
||||
_, class = UnitClass(scan)
|
||||
level = UnitLevel(scan)
|
||||
@@ -136,6 +152,7 @@ libunitscan:SetScript("OnEvent", function()
|
||||
name = UnitName(scan)
|
||||
guild = GetGuildInfo(scan)
|
||||
AddData("players", name, class, level, nil, guild)
|
||||
RememberByUnit(scan, name, class)
|
||||
else
|
||||
_, class = UnitClass(scan)
|
||||
elite = UnitClassification(scan)
|
||||
|
||||
@@ -1714,9 +1714,9 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
||||
local reagentcounter = CreateFrame("Frame", "pfReagentCounter", UIParent)
|
||||
reagentcounter:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
reagentcounter:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
||||
reagentcounter:RegisterEvent("BAG_UPDATE")
|
||||
reagentcounter:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
reagentcounter:SetScript("OnEvent", function()
|
||||
if event == "BAG_UPDATE" then
|
||||
if event == "BAG_UPDATE_DELAYED" then
|
||||
this.event = true
|
||||
else
|
||||
this.scan = 1
|
||||
|
||||
+4
-22
@@ -94,31 +94,13 @@ pfUI:RegisterModule("afkcam", "vanilla:tbc", function ()
|
||||
clock.time:SetJustifyH("CENTER")
|
||||
clock.time:SetPoint("TOP", 0, -10)
|
||||
clock:SetScript("OnUpdate", function()
|
||||
local h, m = GetGameTime()
|
||||
local noon = "AM"
|
||||
local time = ""
|
||||
local fmt
|
||||
if C.global.twentyfour == "0" then
|
||||
if C.global.servertime == "1" then
|
||||
if h == 0 then
|
||||
h = 12
|
||||
elseif h == 12 then
|
||||
noon = "PM"
|
||||
elseif h > 12 then
|
||||
h = h - 12
|
||||
noon = "PM"
|
||||
end
|
||||
time = string.format("%.2d|cff33ffcc:|r%.2d %s", h, m, noon)
|
||||
else
|
||||
time = date("%I|cff33ffcc:|r%M %p")
|
||||
end
|
||||
clock.time:SetText(time)
|
||||
fmt = "%I|cff33ffcc:|r%M %p"
|
||||
else
|
||||
if C.global.servertime == "1" then
|
||||
time = string.format("%.2d|cff33ffcc:|r%.2d", h, m)
|
||||
else
|
||||
time = date("%H|cff33ffcc:|r%M")
|
||||
end
|
||||
fmt = "%H|cff33ffcc:|r%M"
|
||||
end
|
||||
local time = C.global.servertime == "1" and date(fmt, GetServerEpoch()) or date(fmt)
|
||||
clock.time:SetText(time)
|
||||
end)
|
||||
|
||||
|
||||
+18
-18
@@ -12,27 +12,24 @@ pfUI:RegisterModule("autovendor", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
local function HasGreyItems()
|
||||
for bag = 0, 4, 1 do
|
||||
for slot = 1, GetContainerNumSlots(bag), 1 do
|
||||
local name = GetContainerItemLink(bag,slot)
|
||||
if name and string.find(name,"ff9d9d9d") then return true end
|
||||
for bag = 0, 4 do
|
||||
for slot = 1, GetContainerNumSlots(bag) do
|
||||
local quality = C_Item.GetItemQuality(ItemLocation:CreateFromBagAndSlot(bag,slot))
|
||||
if quality and quality == LE_ITEM_QUALITY_POOR then return true end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function GetNextGreyItem()
|
||||
for bag = 0, 4, 1 do
|
||||
for slot = 1, GetContainerNumSlots(bag), 1 do
|
||||
local name = GetContainerItemLink(bag,slot)
|
||||
if name and string.find(name,"ff9d9d9d") and not processed[bag.."x"..slot] then
|
||||
for bag = 0, 4 do
|
||||
for slot = 1, GetContainerNumSlots(bag) do
|
||||
local quality = C_Item.GetItemQuality(ItemLocation:CreateFromBagAndSlot(bag,slot))
|
||||
if quality and quality == LE_ITEM_QUALITY_POOR and not processed[bag.."x"..slot] then
|
||||
processed[bag.."x"..slot] = true
|
||||
return bag, slot
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
local autovendor = CreateFrame("Frame", "pfMoneyUpdate", nil)
|
||||
@@ -56,16 +53,15 @@ pfUI:RegisterModule("autovendor", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
-- double check to only sell grey
|
||||
local name = GetContainerItemLink(bag,slot)
|
||||
if not name or not string.find(name,"ff9d9d9d") then
|
||||
local quality = C_Item.GetItemQuality(ItemLocation:CreateFromBagAndSlot(bag,slot))
|
||||
if quality ~= LE_ITEM_QUALITY_POOR then
|
||||
return
|
||||
end
|
||||
|
||||
-- get value
|
||||
local _, icount = GetContainerItemInfo(bag, slot)
|
||||
local _, _, id = string.find(GetContainerItemLink(bag, slot), "item:(%d+):%d+:%d+:%d+")
|
||||
if pfSellData[tonumber(id)] then
|
||||
local _, _, sell, buy = strfind(pfSellData[tonumber(id)], "(.*),(.*)")
|
||||
local id = C_Container.GetContainerItemID(bag, slot)
|
||||
if pfSellData[id] then
|
||||
local _, _, sell, buy = strfind(pfSellData[id], "(.*),(.*)")
|
||||
this.count = this.count + 1
|
||||
end
|
||||
|
||||
@@ -103,7 +99,11 @@ pfUI:RegisterModule("autovendor", "vanilla:tbc", function ()
|
||||
end
|
||||
|
||||
if C["global"]["autosell"] == "1" then
|
||||
autovendor:Show()
|
||||
if C_MerchantFrame.GetNumJunkItems() > 0 then
|
||||
C_MerchantFrame.SellAllJunkItems()
|
||||
else
|
||||
autovendor:Show()
|
||||
end
|
||||
autovendor.button:Hide()
|
||||
else
|
||||
autovendor.button:Show()
|
||||
|
||||
+4
-4
@@ -494,10 +494,10 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function ()
|
||||
-- add shaguscore if we have it
|
||||
if ShaguScore and pfUI.bags[bag].slots[slot].frame.scoreText then
|
||||
if quality and quality > 0 then
|
||||
local link = GetContainerItemLink(bag, slot)
|
||||
local r,g,b = GetItemQualityColor(quality)
|
||||
local _, _, itemID = string.find(link, "item:(%d+):%d+:%d+:%d+")
|
||||
local itemLevel = ShaguScore.Database[tonumber(itemID)] or 0
|
||||
local item = Item:CreateFromBagAndSlot(bag, slot)
|
||||
local r,g,b = item:GetItemQualityColorRGB()
|
||||
local itemID = item:GetItemID()
|
||||
local itemLevel = ShaguScore.Database[itemID] or 0
|
||||
local score = ShaguScore:Calculate(vslot, quality, itemLevel)
|
||||
if score and score > 0 and count and count == 1 then
|
||||
pfUI.bags[bag].slots[slot].frame.scoreText:SetText(score)
|
||||
|
||||
+24
-30
@@ -713,19 +713,15 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
local r,g,b = strsplit(",", C.chat.text.unknowncolor)
|
||||
local unknowncolorhex = rgbhex(r,g,b)
|
||||
|
||||
local nothing = function() return end
|
||||
local original = FriendsFrame_OnEvent
|
||||
|
||||
local who_query = CreateFrame("Frame")
|
||||
who_query:RegisterEvent("WHO_LIST_UPDATE")
|
||||
who_query:SetScript("OnEvent", function()
|
||||
if this.pending then
|
||||
-- restore everything once a query is received
|
||||
_G.FriendsFrame_OnEvent = original
|
||||
this.pending = nil
|
||||
SetWhoToUI(0)
|
||||
end
|
||||
end)
|
||||
-- Suppress FriendsFrame's WHO_LIST_UPDATE handling for our DLL-issued
|
||||
-- name lookups so they don't pop the friends panel. User-issued /who
|
||||
-- still works because IsWhoQueryPending only reports true for queries
|
||||
-- issued via C_FriendList.SendWhoQueryByName.
|
||||
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
|
||||
_G.FriendsFrame_OnEvent = function()
|
||||
if _G.event == "WHO_LIST_UPDATE" and C_FriendList.IsWhoQueryPending() then return end
|
||||
return original_FriendsFrame_OnEvent()
|
||||
end
|
||||
|
||||
local function GetPlayerLevel(name)
|
||||
if not pfUI_playerDB then return nil end
|
||||
@@ -733,23 +729,12 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
return pfUI_playerDB[name].level
|
||||
end
|
||||
|
||||
local function ScanWhoName(name)
|
||||
-- abort if another query is ongoing
|
||||
if who_query.pending then return end
|
||||
who_query.pending = true
|
||||
|
||||
-- prepare and send the who query
|
||||
_G.FriendsFrame_OnEvent = nothing
|
||||
SetWhoToUI(1)
|
||||
SendWho("n-"..name)
|
||||
end
|
||||
|
||||
local function AddMessage(frame, text, a1, a2, a3, a4, a5)
|
||||
local function AddMessage(frame, text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
if not text then return end
|
||||
|
||||
-- skip chat parsing on combat log
|
||||
if frame.pfCombatLog then
|
||||
return frame:HookAddMessage(text, a1, a2, a3, a4, a5)
|
||||
return frame:HookAddMessage(text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
end
|
||||
|
||||
-- Remove prat CLINKs
|
||||
@@ -773,15 +758,24 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
local real, _ = strsplit(":", name)
|
||||
local color = unknowncolorhex
|
||||
local match = false
|
||||
local class = GetUnitData(real)
|
||||
|
||||
local class
|
||||
local guid = GetCurrentChatGUID()
|
||||
if guid then
|
||||
_, class = GetPlayerInfoByGUID(guid)
|
||||
end
|
||||
if not class then
|
||||
_, class = C_PlayerCache.GetPlayerInfoByName(real)
|
||||
end
|
||||
if not class then
|
||||
class = GetUnitData(real)
|
||||
end
|
||||
if class then
|
||||
if class ~= UNKNOWN then
|
||||
color = rgbhex(RAID_CLASS_COLORS[class])
|
||||
match = true
|
||||
end
|
||||
elseif C.chat.text.whosearchunknown == "1" then
|
||||
ScanWhoName(name)
|
||||
C_FriendList.SendWhoQueryByName(name) -- cooldown + state managed by DLL
|
||||
end
|
||||
|
||||
if C.chat.text.tintunknown == "1" or match then
|
||||
@@ -839,7 +833,7 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
|
||||
end
|
||||
end
|
||||
|
||||
frame:HookAddMessage(text, a1, a2, a3, a4, a5)
|
||||
frame:HookAddMessage(text, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
|
||||
end
|
||||
|
||||
for i=1,NUM_CHAT_WINDOWS do
|
||||
|
||||
@@ -29,6 +29,8 @@ local function SetFocusByGUID(guid)
|
||||
pfUI.uf.focustarget.label = guid .. "target"
|
||||
pfUI.uf.focustarget.id = ""
|
||||
end
|
||||
|
||||
C_Minimap.SetFocusByGUID(guid)
|
||||
end
|
||||
|
||||
-- Helper: set focus frame by name (fallback, no Nampower)
|
||||
@@ -42,6 +44,8 @@ local function SetFocusByName(name)
|
||||
pfUI.uf.focustarget.label = nil
|
||||
pfUI.uf.focustarget.id = nil
|
||||
end
|
||||
|
||||
C_Minimap.SetFocusByName(name)
|
||||
end
|
||||
|
||||
SLASH_PFFOCUS1, SLASH_PFFOCUS2 = '/focus', '/pffocus'
|
||||
@@ -122,6 +126,8 @@ function SlashCmdList.PFCLEARFOCUS(msg)
|
||||
pfUI.uf.focustarget.label = nil
|
||||
pfUI.uf.focustarget.id = nil
|
||||
end
|
||||
|
||||
C_Minimap.ClearFocus()
|
||||
end
|
||||
|
||||
SLASH_PFCASTFOCUS1, SLASH_PFCASTFOCUS2 = '/castfocus', '/pfcastfocus'
|
||||
|
||||
@@ -28,8 +28,7 @@ pfUI:RegisterModule("itemclick", "vanilla", function ()
|
||||
end
|
||||
elseif IsAuctionBrowsing() and not IsShiftKeyDown() then
|
||||
-- search item in auction house
|
||||
local link = GetContainerItemLink(bag, slot)
|
||||
local name = link and string.sub(link, string.find(link, "%[")+1, string.find(link, "%]")-1) or ""
|
||||
local name = C_Item.GetItemName(ItemLocation:CreateFromBagAndSlot(bag, slot))
|
||||
BrowseName:SetText(name)
|
||||
AuctionFrameBrowse_Search()
|
||||
elseif IsAuctionSelling() and not IsShiftKeyDown() then
|
||||
|
||||
+87
-124
@@ -12,25 +12,9 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
widget.Tooltip = function()
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip_SetDefaultAnchor(GameTooltip, this)
|
||||
local h, m = GetGameTime()
|
||||
local noon = " AM"
|
||||
local servertime
|
||||
local time
|
||||
if C.global.twentyfour == "0" then
|
||||
if h == 0 then
|
||||
h = 12
|
||||
elseif h == 12 then
|
||||
noon = " PM"
|
||||
elseif h > 12 then
|
||||
h = h - 12
|
||||
noon = " PM"
|
||||
end
|
||||
time = date("%I:%M %p")
|
||||
servertime = string.format("%.2d:%.2d %s", h, m, noon)
|
||||
else
|
||||
time = date("%H:%M")
|
||||
servertime = string.format("%.2d:%.2d", h, m)
|
||||
end
|
||||
local fmt = C.global.twentyfour == "0" and "%I:%M %p" or "%H:%M"
|
||||
local time = date(fmt)
|
||||
local servertime = date(fmt, GetServerEpoch())
|
||||
GameTooltip:AddLine("|cff555555" .. T["Time"])
|
||||
GameTooltip:AddDoubleLine(T["Localtime"], "|cffffffff" .. time)
|
||||
GameTooltip:AddDoubleLine(T["Servertime"], "|cffffffff".. servertime)
|
||||
@@ -65,39 +49,14 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
widget:SetScript("OnUpdate",function()
|
||||
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + 1 end
|
||||
|
||||
local h, m = GetGameTime()
|
||||
local noon = "AM"
|
||||
local time = ""
|
||||
local secondsenabled = C.panel.seconds == "1"
|
||||
local fmt
|
||||
if C.global.twentyfour == "0" then
|
||||
if C.global.servertime == "1" then
|
||||
if h == 0 then
|
||||
h = 12
|
||||
elseif h == 12 then
|
||||
noon = "PM"
|
||||
elseif h > 12 then
|
||||
h = h - 12
|
||||
noon = "PM"
|
||||
end
|
||||
time = string.format("%.2d:%.2d %s", h, m, noon)
|
||||
else
|
||||
if secondsenabled then
|
||||
time = date("%I:%M:%S %p")
|
||||
else
|
||||
time = date("%I:%M %p")
|
||||
end
|
||||
end
|
||||
fmt = secondsenabled and "%I:%M:%S %p" or "%I:%M %p"
|
||||
else
|
||||
if C.global.servertime == "1" then
|
||||
time = string.format("%.2d:%.2d", h, m)
|
||||
else
|
||||
if secondsenabled then
|
||||
time = date("%H:%M:%S")
|
||||
else
|
||||
time = date("%H:%M")
|
||||
end
|
||||
end
|
||||
fmt = secondsenabled and "%H:%M:%S" or "%H:%M"
|
||||
end
|
||||
local time = C.global.servertime == "1" and date(fmt, GetServerEpoch()) or date(fmt)
|
||||
pfUI.panel:OutputPanel("time", time, widget.Tooltip, widget.Click)
|
||||
end)
|
||||
|
||||
@@ -249,7 +208,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
do -- Bagspace
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetBag", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget:SetScript("OnEvent", function()
|
||||
local maxslots = 0
|
||||
local usedslots = 0
|
||||
@@ -259,8 +218,8 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
local bagsize = GetContainerNumSlots(bag)
|
||||
maxslots = maxslots + bagsize
|
||||
for j = 1,bagsize do
|
||||
local link = GetContainerItemLink(bag,j)
|
||||
if link then
|
||||
local itemID = C_Container.GetContainerItemID(bag,j)
|
||||
if itemID then
|
||||
usedslots = usedslots + 1
|
||||
end
|
||||
end
|
||||
@@ -471,8 +430,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
widget.itemLines = {}
|
||||
widget.durability_slots = { 1, 3, 5, 6, 7, 8, 9, 10, 16, 17, 18 }
|
||||
widget.totalRep = 0
|
||||
widget.scantip = libtipscan:GetScanner("panel")
|
||||
widget.duracapture = string.gsub(DURABILITY_TEMPLATE, "%%[^%s]+", "(.+)")
|
||||
|
||||
widget.Click = function() ToggleCharacter("PaperDollFrame") end
|
||||
widget.Tooltip = function()
|
||||
if widget.totalRep > 0 then
|
||||
@@ -489,27 +447,24 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
widget:SetScript("OnEvent", function()
|
||||
if event == "UNIT_INVENTORY_CHANGED" and arg1 ~= "player" then return end
|
||||
|
||||
local repPercent = 100
|
||||
local lowestPercent = 100
|
||||
widget.totalRep = 0
|
||||
wipe(widget.itemLines)
|
||||
for _, id in pairs(widget.durability_slots) do
|
||||
local hasItem, _, repCost = widget.scantip:SetInventoryItem("player", id)
|
||||
if (hasItem) then
|
||||
widget.totalRep = widget.totalRep + repCost
|
||||
local line, lval, rval = widget.scantip:Find(widget.duracapture)
|
||||
if (lval and rval) then
|
||||
repPercent = math.floor(lval / rval * 100)
|
||||
if repPercent < 100 then
|
||||
local link = GetInventoryItemLink("player",id)
|
||||
local r,g,b,hex = GetColorGradient(repPercent/100)
|
||||
local cPercent = string.format("%s%s%%|r",hex,repPercent)
|
||||
widget.itemLines[table.getn(widget.itemLines)+1]={link, cPercent}
|
||||
end
|
||||
local cur, max = GetInventoryItemDurability(id)
|
||||
if cur and max then
|
||||
widget.totalRep = widget.totalRep + (GetInventoryItemRepairCost(id) or 0)
|
||||
local repPercent = math.floor(cur / max * 100)
|
||||
if repPercent < 100 then
|
||||
local _, _, _, hex = GetColorGradient(repPercent/100)
|
||||
widget.itemLines[table.getn(widget.itemLines)+1] = {
|
||||
GetInventoryItemLink("player", id),
|
||||
string.format("%s%s%%|r", hex, repPercent)
|
||||
}
|
||||
end
|
||||
if repPercent < lowestPercent then
|
||||
lowestPercent = repPercent
|
||||
end
|
||||
end
|
||||
if repPercent < lowestPercent then
|
||||
lowestPercent = repPercent
|
||||
end
|
||||
end
|
||||
|
||||
@@ -553,7 +508,7 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetAmmo", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("UNIT_INVENTORY_CHANGED")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget.Tooltip = function()
|
||||
if GetInventoryItemQuality("player", 0) then
|
||||
local ammo = GetInventoryItemCount("player", 0)
|
||||
@@ -573,65 +528,73 @@ pfUI:RegisterModule("panel", "vanilla:tbc", function()
|
||||
end)
|
||||
end
|
||||
|
||||
do -- Soulshards
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetSoulshard", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:SetScript("OnEvent", function()
|
||||
local _, class = UnitClass("player")
|
||||
if class == "WARLOCK" then
|
||||
local count = pfUI.api.GetItemCount(T["Soul Shard"])
|
||||
pfUI.panel:OutputPanel("soulshard", T["Soulshards"] .. ": " .. count)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
do -- Hearthstone bind location
|
||||
local widget = CreateFrame("Frame", "pfPanelBindLocation", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("CHAT_MSG_SYSTEM")
|
||||
widget:SetScript("OnEvent", function()
|
||||
|
||||
do
|
||||
-- Hearthstone bind location
|
||||
local hearth = CreateFrame("Frame", "pfPanelBindLocation", UIParent)
|
||||
hearth:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
hearth:RegisterEvent("CHAT_MSG_SYSTEM")
|
||||
hearth:SetScript("OnEvent", function()
|
||||
pfUI.panel:OutputPanel("bindlocation", T["Hearthstone"] .. ": " .. (GetBindLocation() or T["Not Set"]))
|
||||
end)
|
||||
end
|
||||
|
||||
do -- Flash Powder
|
||||
local widget = CreateFrame("Frame", "pfPanelFlashPowder", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:SetScript("OnEvent", function()
|
||||
local _, class = UnitClass("player")
|
||||
if class == "ROGUE" then
|
||||
local count = pfUI.api.GetItemCount(T["Flash Powder"])
|
||||
pfUI.panel:OutputPanel("flashpowder", T["Flash Powder"] .. ": " .. count)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local itemIDs = {
|
||||
soulshard = 6265,
|
||||
flashpowder = 5140,
|
||||
thistletea = 7676,
|
||||
blindpowder = 5530
|
||||
}
|
||||
|
||||
do -- Thistle Tea
|
||||
local widget = CreateFrame("Frame", "pfPanelThistleTea", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:SetScript("OnEvent", function()
|
||||
local _, class = UnitClass("player")
|
||||
if class == "ROGUE" then
|
||||
local count = pfUI.api.GetItemCount(T["Thistle Tea"])
|
||||
pfUI.panel:OutputPanel("thistletea", T["Thistle Tea"] .. ": " .. count)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local function AddItemToPanel(panelType)
|
||||
local itemID = itemIDs[panelType]
|
||||
if C_Item.IsItemDataCachedByID(itemID) then
|
||||
local itemName, count = C_Item.GetItemNameByID(itemID), C_Item.GetItemCount(itemID)
|
||||
pfUI.panel:OutputPanel(panelType, itemName .. ": " .. count)
|
||||
else
|
||||
local item = Item:CreateFromItemID(itemID)
|
||||
item:ContinueOnItemLoad(function()
|
||||
local itemName, count = item:GetItemName(), C_Item.GetItemCount(item:GetItemID())
|
||||
pfUI.panel:OutputPanel(panelType, itemName .. ": " .. count)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local class = UnitClassBase('player')
|
||||
if class == "WARLOCK" then
|
||||
-- Soulshards
|
||||
local widget = CreateFrame("Frame", "pfPanelWidgetSoulshard", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget:SetScript("OnEvent", function()
|
||||
AddItemToPanel("soulshard")
|
||||
end)
|
||||
end
|
||||
|
||||
do -- Blinding Powder
|
||||
local widget = CreateFrame("Frame", "pfPanelBlindingPowder", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE")
|
||||
widget:SetScript("OnEvent", function()
|
||||
local _, class = UnitClass("player")
|
||||
if class == "ROGUE" then
|
||||
local count = pfUI.api.GetItemCount(T["Blinding Powder"])
|
||||
pfUI.panel:OutputPanel("blindpowder", T["Blinding Powder"] .. ": " .. count)
|
||||
end
|
||||
end)
|
||||
if class == "ROGUE" then
|
||||
-- Flash Powder
|
||||
local widget = CreateFrame("Frame", "pfPanelFlashPowder", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget:SetScript("OnEvent", function()
|
||||
AddItemToPanel("flashpowder")
|
||||
end)
|
||||
|
||||
-- Thistle Tea
|
||||
local widget = CreateFrame("Frame", "pfPanelThistleTea", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget:SetScript("OnEvent", function()
|
||||
AddItemToPanel("thistletea")
|
||||
end)
|
||||
|
||||
-- Blinding Powder
|
||||
local widget = CreateFrame("Frame", "pfPanelBlindingPowder", UIParent)
|
||||
widget:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
widget:RegisterEvent("BAG_UPDATE_DELAYED")
|
||||
widget:SetScript("OnEvent", function()
|
||||
AddItemToPanel("blindpowder")
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ pfUI:RegisterModule("xpbar", "vanilla:tbc", function ()
|
||||
data:RegisterEvent("CHAT_MSG_COMBAT_FACTION_CHANGE")
|
||||
data:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
data:RegisterEvent("PLAYER_LEVEL_UP")
|
||||
data:RegisterEvent("UPDATE_FACTION")
|
||||
data:SetScript("OnEvent", function()
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
this.starttime = GetTime()
|
||||
@@ -16,6 +17,14 @@ pfUI:RegisterModule("xpbar", "vanilla:tbc", function ()
|
||||
elseif event == "CHAT_MSG_COMBAT_FACTION_CHANGE" then
|
||||
local _,_, faction, amount = string.find(arg1, parse_faction)
|
||||
this.faction = faction or this.faction
|
||||
elseif event == "UPDATE_FACTION" then
|
||||
-- drop the auto-tracked faction when the user changes the watched one
|
||||
local watched = C_Reputation.GetWatchedFactionData()
|
||||
local watchedName = watched and watched.name or nil
|
||||
if watchedName ~= this.watched then
|
||||
this.watched = watchedName
|
||||
this.faction = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user