16 Commits

Author SHA1 Message Date
Brues bd722b0f0f bump classicapi min to 1.5.7 2026-07-03 02:29:15 -05:00
Brues e5c51fff48 eqcompare: rewrite on top of ClassicAPI SetHyperlinkCompareItem
Drop the manual C_Item.GetItemStatDelta rendering (inline annotations
and bottom-block summary) in favor of driving native shopping tooltips
via SetHyperlinkCompareItem — the 3.3.5 flow now available through
ClassicAPI. Way less code, and Blizzard's own comparison rendering
handles all stat types uniformly.

Also revert the mode dropdown back to a single basestats checkbox — the
new implementation doesn't distinguish base vs extended (Blizzard's
tooltip shows everything the item exposes), so the two-level control
was redundant. Existing basestats configs pass through unchanged.

AtlasLootTooltip now goes through the shared HookTooltip helper instead
of a bespoke OnShow shim.
2026-07-03 02:10:20 -05:00
Brues 6570afb70a eqcompare: collapse basestats/extendedstats checkboxes into a mode dropdown
Replace the two-checkbox arrangement (Compare Base Stats + Compare
Extended Stats, with the latter gated on the former) with a single
"Item Comparison" dropdown offering Off / Base / Extended. Migrate
existing configs.

Also route CreateConfig's value-change sites through pfUI.events
("config:changed", category, config) so callers can react to arbitrary
setting changes without frame-specific plumbing. Use it here to grey
out "Always Show Item Comparison" when the mode is Off.
2026-07-02 03:05:56 -05:00
Brues 0f97e8b0bd eqcompare: skip paperdoll owners in showalways mode
Comparing an equipped slot's tooltip against itself is pointless — every
delta is zero. Skip that case when `showalways=1`. Shift-hover still
forces the comparison unconditionally.
2026-07-02 01:50:48 -05:00
Brues 64c62a2a25 eqcompare: hook Set* via hooksecurefunc + unify base/extended stat block
Refactor delta rendering:
- extendedstats on  -> all stats (base + extended + DPS + block value)
  appended at the bottom via AddDoubleLine
- extendedstats off -> base stats annotated inline; nothing at the bottom

Requires ClassicAPI's 60-line tooltip fix so the bottom block isn't
truncated. DPS and block value were previously extended-only inline
matches — moved into BASE_STAT_KEYS so they also show at the bottom.

Also extract MakeDependent(child, parent) helper from the local
gate-lambda in gui.lua so the base/extended checkbox pairing generalizes.
2026-07-02 01:22:10 -05:00
Brues 4d316ed43a no select 2026-07-01 20:53:47 -05:00
Brues db0195f0f7 Update README.md 2026-07-01 17:20:54 -05:00
Brues 3d2d5f9254 bump ClassicAPI version 2026-07-01 17:06:31 -05:00
Brues dfbeeb454a eqcompare: use C_Item.GetItemStatDelta for the comparison math
Replaces the twin-tooltip text extraction/comparison pair
(ExtractAttributes + CompareAttributes) with a single delta pull from
ClassicAPI's C_Item.GetItemStatDelta(equippedLink, newLink).

Base stats (Str/Agi/Sta/Int/Spi/Mana/Health + Armor + resistances) stay
annotated inline on their existing tooltip line: iterate the tooltip's
FontString regions (no more _G["...TextLeft"..i] name lookup), match the
"+N Foo" prefix, look up the trailing noun in a label→key map, append
(+delta)/(-delta) from the ClassicAPI delta table.

Extended stats (attack power / ranged AP / spell damage/healing / crit
ratings / hit ratings / mana regen / defense / DPS) don't emit their own
line — vanilla mixes them into equip-spell descriptions ("Equip:
Increases your critical strike chance by 1%") — so aggregate them into
a "Compared to equipped:" block at the bottom via AddDoubleLine. New
`tooltip.compare.extendedstats` config knob (default 1) gates that
block; it depends on `basestats` being on (its GUI checkbox grays out
otherwise). DPS rounded to one decimal — ClassicAPI derives it from
damage/delay so it lands as a raw float.

Random-suffix bonuses ("of the Bear" etc.) now count correctly since
GetItemStatDelta walks item-record + equip-spell auras + suffix
enchants server-side.
2026-07-01 17:03:32 -05:00
Brues 439d5a397a eqcompare: numeric InventoryType lookup, drop bagtypes/itemtypes locales
Both sub-tables carried per-locale strings only so pfUI's own code could
match against localized text. ClassicAPI's numeric item APIs replace
both:

- GetBagFamily now reads classID/subClassID from C_Item.GetItemInfoInstant
  and switches on the numbers (class 1 = Container, class 11 = Quiver).
- eqcompare pulls the itemID from GameTooltip:GetItem(), fetches the
  numeric invType via C_Item.GetItemInventoryTypeByID, and looks up the
  destination slot(s) in a numeric slotTable keyed by Enum.InventoryType.
  Pair-slot invtypes (finger / trinket / one-hand weapon) list both
  destinations directly, so the "_other" string-concat hack is gone.

Removes the setglobal INVTYPE_* injection, the tooltip text scan, and
the itemtypes + bagtypes locale sub-tables across all 7 files.
2026-07-01 15:43:03 -05:00
Brues 5524ad3b91 locales: strip 4 dead sub-tables (hunterpaging, interrupts, spells, icons)
Audited every consumer of pfUI_locale[*][key] across the codebase. Four
sub-tables have no non-locale-file readers left:

  - hunterpaging  — old auto-page trigger removed
  - interrupts    — replaced by Nampower SPELL_INTERRUPTED events
  - spells        — replaced by ClassicAPI Spell.dbc lookups
  - icons         — replaced by ClassicAPI C_Spell.GetSpellName / icon path

Removed the entries from all 7 locale files. ~18k dead lines gone,
~70% shrink per file.
2026-07-01 12:13:25 -05:00
Brues 0f59a3a9b5 replace poll-until-cancel OnUpdate frames with C_Timer / RunNextFrame
Seven ad-hoc OnUpdate handlers were only spinning long enough to reach
a known deadline or a next-frame defer, then unhooking themselves.
Convert them to their proper primitives:

- autovendor: 0.3s wait after junk sell → C_Timer.After(0.3, ...)
- innervatecall: cooldown-expiry ready ping → C_Timer.After(cd, ...)
- focus: re-arm UI_ERROR_MESSAGE next tick → RunNextFrame
- macrotweak: conflict scan after addons load → RunNextFrame
- ui-widgets (CreateQuestionDialog): font-measure resize → RunNextFrame
- libdebuff: post-PEW Nampower init → RunNextFrame
- bubbles: WorldFrame scan after chat event → RunNextFrame

Net -18 lines and no more throwaway frames sitting on the OnUpdate list.
2026-07-01 10:43:46 -05:00
Brues ffdf376ac4 add pfUI.events callback registry, replace addoncompat OnUpdate poll
Introduce a central pfUI.events registry (ClassicAPI's
CallbackRegistryMixin, undefined events allowed) initialized in pfUI.lua
before any module body runs, so publishers/subscribers don't depend on
module load order.

firstrun sets `pfUI.firstrun.completed` and fires `firstrun:complete` at
the point NextStep detects no pending steps. PLAYER_ENTERING_WORLD re-
enters this path on every zone, so the flag is a one-shot guard.

addoncompat drops its 0.1s OnUpdate poll and either RunQueues immediately
(returning user, all steps already done) or subscribes to the event.
2026-07-01 10:20:34 -05:00
Brues 9bdde06150 unitframes: clear stale aura swirl on target swap
Buff and debuff slots only called CooldownFrame_SetTimer on the
`expirationTime > 0` (or `duration > 0` for buffs) paths. When the new
target's aura at the same slot index had neither — permanent / passive
auras like Retribution Aura — neither branch fired and the slot kept
displaying the previous target's swirl/timer.

Add an explicit 0/0/0 clear on every path that doesn't set a real
timer, so the button always starts from a known state.

Fixes #13.
2026-06-28 12:41:31 -05:00
Brues 8bf6672114 buffs: cancel by spellID instead of GetPlayerBuff slot index
`GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, filter)` assumes the
visual index pfUI shows matches the engine's slot order. When that
mismapping happens — most easily reproduced by stacking buffs that
share a slot family — right-clicking one buff cancels another.

`C_Spell.CancelSpellByID(spellID)` ships CMSG_CANCEL_AURA keyed to the
spell, not a slot, so it's immune to whatever order the slot table is
in. Cache `spellId` on the button at refresh time in buff.lua; in the
unitframes/buffwatch handlers fetch the aura fresh via
`C_UnitAuras.GetAuraDataByIndex` at click time.

Fixes #10.
2026-06-28 04:28:59 -05:00
Brues 29b948e6fa character cleanup 2026-06-28 00:14:40 -05:00
27 changed files with 239 additions and 20229 deletions
+25 -1588
View File
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -28,12 +28,8 @@ function pfUI.api.HasNampower()
return GetNampowerVersion and true or false
end
local isTurtleWoW
function pfUI.api.IsTurtleWoW()
if isTurtleWoW == nil then
isTurtleWoW = C_Spell.GetSpellTexture(46050) == "Interface\\Icons\\Trade_Survival"
end
return isTurtleWoW
return C_Spell.GetSpellTexture(46050) == "Interface\\Icons\\Trade_Survival"
end
-- [ GetUnitDistance ]
@@ -434,13 +430,17 @@ function pfUI.api.GetBagFamily(bag)
local id = GetInventoryItemID("player", ContainerIDToInventoryID(bag))
if id then
local _, _, _, _, _, itemType, subType = GetItemInfo(id)
local bagsubtype = L["bagtypes"][subType]
if bagsubtype == "DEFAULT" then return "BAG" end
if bagsubtype == "SOULBAG" then return "SOULBAG" end
if bagsubtype == "QUIVER" then return "QUIVER" end
if bagsubtype == nil then return "SPECIAL" end
-- classID 1 = Container (bags), 11 = Quiver
-- Container subclasses: 0 = Bag (default), 1 = Soul Bag, 2+ = specialty (herb/enchanting/etc.)
-- Quiver subclasses: 2 = Quiver (arrows), 3 = Ammo Pouch (bullets)
local _, _, _, _, _, classID, subClassID = C_Item.GetItemInfoInstant(id)
if classID == 1 then
if subClassID == 0 then return "BAG" end
if subClassID == 1 then return "SOULBAG" end
return "SPECIAL"
elseif classID == 11 then
return "QUIVER"
end
end
return nil
-1
View File
@@ -1372,7 +1372,6 @@ function pfUI:MigrateConfig()
end
end
-- Remove "Show only own debuffs" from unitframes and nameplates
-- (feature was removed; only Target Debuff Bar in buffwatch keeps it)
if pfUI_config.nameplates then
+2 -3
View File
@@ -1172,10 +1172,9 @@ function pfUI.api.CreateQuestionDialog(text, yes, no, editbox, onclose)
local width = 200
-- delay the auto sizing, to make sure the font rendering happened
question:SetScript("OnUpdate", function()
RunNextFrame(function()
if question.text:GetStringWidth() > width then width = question.text:GetStringWidth() end
question:SetWidth( width + 2*padding)
this:SetScript("OnUpdate", nil)
question:SetWidth(width + 2*padding)
end)
end
+12 -4
View File
@@ -73,8 +73,8 @@ end
local function BuffOnClick()
if this:GetParent().label == "player" then
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, "HELPFUL")
if bid >= 0 then CancelPlayerBuff(bid) end
local aura = C_UnitAuras.GetAuraDataByIndex("player", this.id, "HELPFUL")
if aura and aura.spellId then C_Spell.CancelSpellByID(aura.spellId) end
end
end
@@ -114,8 +114,8 @@ end
local function DebuffOnClick()
if this:GetParent().label == "player" then
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, "HARMFUL")
if bid >= 0 then CancelPlayerBuff(bid) end
local aura = C_UnitAuras.GetAuraDataByIndex("player", this.id, "HARMFUL")
if aura and aura.spellId then C_Spell.CancelSpellByID(aura.spellId) end
end
end
@@ -1902,6 +1902,8 @@ function pfUI.uf:RefreshUnit(unit, component)
end
if duration > 0 then
CooldownFrame_SetTimer(unit.buffs[i].cd, start, duration, 1)
else
CooldownFrame_SetTimer(unit.buffs[i].cd, 0, 0, 0)
end
elseif aura.duration > 0 then
local guid = UnitGUID(unitstr)
@@ -1912,6 +1914,8 @@ function pfUI.uf:RefreshUnit(unit, component)
else
CooldownFrame_SetTimer(unit.buffs[i].cd, 0, 0, 0)
end
else
CooldownFrame_SetTimer(unit.buffs[i].cd, 0, 0, 0)
end
else
unit.buffs[i]:Hide()
@@ -2005,7 +2009,11 @@ function pfUI.uf:RefreshUnit(unit, component)
end
if duration > 0 then
CooldownFrame_SetTimer(unit.debuffs[i].cd, start, duration, 1)
else
CooldownFrame_SetTimer(unit.debuffs[i].cd, 0, 0, 0)
end
else
CooldownFrame_SetTimer(unit.debuffs[i].cd, 0, 0, 0)
end
if stacks > 1 then
-2620
View File
File diff suppressed because it is too large Load Diff
-2634
View File
File diff suppressed because it is too large Load Diff
-2628
View File
File diff suppressed because it is too large Load Diff
-2625
View File
File diff suppressed because it is too large Load Diff
-2591
View File
File diff suppressed because it is too large Load Diff
-2628
View File
File diff suppressed because it is too large Load Diff
-2612
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -44,15 +44,13 @@ if GetNampowerVersion then
end
-- Nampower startup check: show version info and ensure CVars are set.
-- Runs on first OnUpdate after PLAYER_ENTERING_WORLD to give Nampower time to initialize.
-- Runs the frame after PLAYER_ENTERING_WORLD so Nampower has finished initializing.
local nampowerCheckFrame = CreateFrame("Frame")
nampowerCheckFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
nampowerCheckFrame:SetScript("OnEvent", function()
-- Defer to next frame so Nampower is fully initialized
this:SetScript("OnUpdate", function()
this:SetScript("OnUpdate", nil)
this:UnregisterAllEvents()
this:SetScript("OnEvent", nil)
this:UnregisterAllEvents()
this:SetScript("OnEvent", nil)
RunNextFrame(function()
if GetNampowerVersion then
local major, minor, patch = GetNampowerVersion()
@@ -967,7 +965,7 @@ if hasNampower then
-- Channel interrupted by player - clear ownDebuffs for the channeled spell
-- via C_Spell.ChannelInfo. DEBUFF_REMOVED fires later (0.5-1s server lag),
-- causing phantom debuff display without this pre-clear.
local spellName = select(1, C_Spell.ChannelInfo())
local spellName = C_Spell.ChannelInfo()
if spellName then
local targetGuid = UnitGUID and UnitGUID("target")
if targetGuid and ownDebuffs[targetGuid] and ownDebuffs[targetGuid][spellName] then
+4 -14
View File
@@ -134,19 +134,9 @@ pfUI:RegisterModule("addoncompat", function ()
end
-- run the addonconflict queue when firstrun is ready
local delay = CreateFrame("Frame")
delay:SetScript("OnUpdate", function()
-- throttle to to one query per .1 second
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end
-- make sure the firstrun dialog has finished
if pfUI.firstrun and pfUI.firstrun.steps then
for _, step in pairs(pfUI.firstrun.steps) do
if not pfUI_init[step.name] then return end
end
end
if pfUI.firstrun and pfUI.firstrun.completed then
RunQueue()
this:SetScript("OnUpdate", nil)
end)
else
pfUI.events:RegisterCallback("firstrun:complete", RunQueue, "addoncompat")
end
end)
+1 -6
View File
@@ -19,12 +19,7 @@ pfUI:RegisterModule("autovendor", function ()
local startGold = GetMoney()
C_MerchantFrame.SellAllJunkItems()
local reporter = CreateFrame("Frame")
reporter.deadline = GetTime() + 0.3
reporter:SetScript("OnUpdate", function()
if GetTime() < this.deadline then return end
this:SetScript("OnUpdate", nil)
this:Hide()
C_Timer.After(0.3, function()
local income = GetMoney() - startGold
if income > 0 then
DEFAULT_CHAT_FRAME:AddMessage(T["Your vendor trash has been sold and you earned"] .. " " .. CreateGoldString(income))
+3 -3
View File
@@ -12,7 +12,9 @@ pfUI:RegisterModule("bubbles", function ()
pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
pfUI.bubbles:SetScript("OnEvent", function()
pfUI.bubbles:SetScript("OnUpdate", pfUI.bubbles.ScanBubbles)
-- Bubble frames are attached to WorldFrame after the chat event fires,
-- so wait one tick before scanning.
RunNextFrame(function() pfUI.bubbles:ScanBubbles() end)
end)
function pfUI.bubbles:IsBubble(f)
@@ -66,7 +68,5 @@ pfUI:RegisterModule("bubbles", function ()
end)
end
end
pfUI.bubbles:SetScript("OnUpdate", nil)
end
end)
+3 -3
View File
@@ -60,6 +60,7 @@ pfUI:RegisterModule("buff", function ()
buff.mode = buff.btype
buff.expirationTime = aura.expirationTime
buff.stackCount = aura.applications
buff.spellId = aura.spellId
buff.texture:SetTexture(aura.icon)
if buff.btype == "HARMFUL" then
@@ -146,9 +147,8 @@ pfUI:RegisterModule("buff", function ()
CancelItemTempEnchantment(1)
elseif CancelItemTempEnchantment and this.mode and this.mode == "OFFHAND" then
CancelItemTempEnchantment(2)
else
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, this.btype)
if bid >= 0 then CancelPlayerBuff(bid) end
elseif this.spellId then
C_Spell.CancelSpellByID(this.spellId)
end
end)
+2 -2
View File
@@ -99,8 +99,8 @@ pfUI:RegisterModule("buffwatch", function ()
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. skill .. "|r" .. T["is now blacklisted."])
end
elseif this.parent.unit == "player" then
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, this.type)
if bid >= 0 then CancelPlayerBuff(bid) end
local aura = C_UnitAuras.GetAuraDataByIndex("player", this.id, this.type)
if aura and aura.spellId then C_Spell.CancelSpellByID(aura.spellId) end
end
end
+125 -219
View File
@@ -1,243 +1,149 @@
pfUI:RegisterModule("eqcompare", function ()
local sides = { "Left", "Right" }
local loc = pfUI.cache["locale"]
for key, value in pairs(L["itemtypes"]) do setglobal(key, value) end
INVTYPE_WEAPON_OTHER = INVTYPE_WEAPON.."_other"
INVTYPE_FINGER_OTHER = INVTYPE_FINGER.."_other"
INVTYPE_TRINKET_OTHER = INVTYPE_TRINKET.."_other"
pfUI.eqcompare = {}
local function AddHeader(tooltip)
local name = tooltip:GetName()
local function ShowCompareItem(self, link, shift)
self = self or GameTooltip
-- shift all entries one line down
for i=tooltip:NumLines(), 1, -1 do
for _, side in pairs(sides) do
local current = _G[name.."Text"..side..i]
local below = _G[name.."Text"..side..i+1]
if not link or (not IsShiftKeyDown() and (C.tooltip.compare.showalways ~= "1" or C_Item.IsEquippedItem(link))) then
return
end
if current and current:IsShown() then
local text = current:GetText()
local r, g, b = current:GetTextColor()
local shoppingTooltip1, shoppingTooltip2 = unpack(self.shoppingTooltips or { ShoppingTooltip1, ShoppingTooltip2 });
if text and text ~= "" then
if tooltip:NumLines() < i+1 then
-- add new line if required
tooltip:AddLine(text, r, g, b, true)
else
-- update existing lines
below:SetText(text)
below:SetTextColor(r, g, b)
below:Show()
local SEPARATION = 6;
local backdrop = shoppingTooltip1.GetBackdrop and shoppingTooltip1:GetBackdrop();
local GAP = SEPARATION + ((type(backdrop) == "table" and backdrop.edgeSize) or 0);
-- hide processed line
current:Hide()
end
end
end
local item1 = nil;
local item2 = nil;
local side = "left";
if ( shoppingTooltip1:SetHyperlinkCompareItem(link, 1, shift, self) ) then
item1 = true;
end
if ( shoppingTooltip2:SetHyperlinkCompareItem(link, 2, shift, self) ) then
item2 = true;
end
-- find correct side
local rightDist = 0;
local leftPos = self:GetLeft();
local rightPos = self:GetRight();
if ( not rightPos ) then
rightPos = 0;
end
if ( not leftPos ) then
leftPos = 0;
end
rightDist = GetScreenWidth() - rightPos;
if (leftPos and (rightDist < leftPos)) then
side = "left";
else
side = "right";
end
-- see if we should slide the tooltip
if ( self:GetAnchorType() and self:GetAnchorType() ~= "ANCHOR_PRESERVE" ) then
local totalWidth = 0;
if ( item1 ) then
totalWidth = totalWidth + shoppingTooltip1:GetWidth();
end
if ( item2 ) then
totalWidth = totalWidth + shoppingTooltip2:GetWidth();
end
if ( (side == "left") and (totalWidth > leftPos) ) then
self:SetAnchorType(self:GetAnchorType(), (totalWidth - leftPos), 0);
elseif ( (side == "right") and (rightPos + totalWidth) > GetScreenWidth() ) then
self:SetAnchorType(self:GetAnchorType(), -((rightPos + totalWidth) - GetScreenWidth()), 0);
end
end
-- add label to first line
_G[name.."TextLeft1"]:SetTextColor(.5, .5, .5, 1)
_G[name.."TextLeft1"]:SetText(CURRENTLY_EQUIPPED)
_G[name.."TextLeft1"]:Show()
if ( item1 ) then
shoppingTooltip1:SetOwner(self, "ANCHOR_NONE");
shoppingTooltip1:ClearAllPoints();
if ( side and side == "left" ) then
shoppingTooltip1:SetPoint("TOPRIGHT", self, "TOPLEFT", -GAP, -10);
else
shoppingTooltip1:SetPoint("TOPLEFT", self, "TOPRIGHT", GAP, -10);
end
shoppingTooltip1:SetHyperlinkCompareItem(link, 1, shift, self);
shoppingTooltip1:Show();
-- update tooltip sizes
tooltip:Show()
if ( item2 ) then
shoppingTooltip2:SetOwner(shoppingTooltip1, "ANCHOR_NONE");
shoppingTooltip2:ClearAllPoints();
if ( side and side == "left" ) then
shoppingTooltip2:SetPoint("TOPRIGHT", shoppingTooltip1, "TOPLEFT", -GAP, 0);
else
shoppingTooltip2:SetPoint("TOPLEFT", shoppingTooltip1, "TOPRIGHT", GAP, 0);
end
shoppingTooltip2:SetHyperlinkCompareItem(link, 2, shift, self);
shoppingTooltip2:Show();
end
end
end
local slotTable = {
[INVTYPE_2HWEAPON] = "MainHandSlot",
[INVTYPE_BODY] = "ShirtSlot",
[INVTYPE_CHEST] = "ChestSlot",
[INVTYPE_CLOAK] = "BackSlot",
[INVTYPE_FEET] = "FeetSlot",
[INVTYPE_FINGER] = "Finger0Slot",
[INVTYPE_FINGER_OTHER] = "Finger1Slot",
[INVTYPE_HAND] = "HandsSlot",
[INVTYPE_HEAD] = "HeadSlot",
[INVTYPE_HOLDABLE] = "SecondaryHandSlot",
[INVTYPE_LEGS] = "LegsSlot",
[INVTYPE_NECK] = "NeckSlot",
[INVTYPE_RANGED] = "RangedSlot",
[INVTYPE_RELIC] = "RangedSlot",
[INVTYPE_ROBE] = "ChestSlot",
[INVTYPE_SHIELD] = "SecondaryHandSlot",
[INVTYPE_SHOULDER] = "ShoulderSlot",
[INVTYPE_TABARD] = "TabardSlot",
[INVTYPE_TRINKET] = "Trinket0Slot",
[INVTYPE_TRINKET_OTHER] = "Trinket1Slot",
[INVTYPE_WAIST] = "WaistSlot",
[INVTYPE_WEAPON] = "MainHandSlot",
[INVTYPE_WEAPON_OTHER] = "SecondaryHandSlot",
[INVTYPE_WEAPONMAINHAND] = "MainHandSlot",
[INVTYPE_WEAPONOFFHAND] = "SecondaryHandSlot",
[INVTYPE_WRIST] = "WristSlot",
local prevMerchant = ShoppingTooltip1.SetMerchantCompareItem
local function SetMerchantCompareItem(self, index, compareItem)
if C.tooltip.compare.basestats == "1" and compareItem == 1 then
ShowCompareItem(nil, GetMerchantItemLink(index))
return false
end
return prevMerchant and prevMerchant(self, index, compareItem)
end
[INVTYPE_WAND] = "RangedSlot",
[INVTYPE_GUN] = "RangedSlot",
[INVTYPE_PROJECTILE] = "AmmoSlot",
[INVTYPE_CROSSBOW] = "RangedSlot",
[INVTYPE_THROWN] = "RangedSlot",
local prevAuction = ShoppingTooltip1.SetAuctionCompareItem
local function SetAuctionCompareItem(self, type, index, compareItem)
if C.tooltip.compare.basestats == "1" and compareItem == 1 then
ShowCompareItem(nil, GetAuctionItemLink(type, index))
return false
end
return prevAuction and prevAuction(self, type, index, compareItem)
end
ShoppingTooltip1.SetMerchantCompareItem = SetMerchantCompareItem
ShoppingTooltip2.SetMerchantCompareItem = SetMerchantCompareItem
ShoppingTooltip1.SetAuctionCompareItem = SetAuctionCompareItem
ShoppingTooltip2.SetAuctionCompareItem = SetAuctionCompareItem
local TooltipHooks = {
SetLootRollItem = GetLootRollItemLink,
SetLootItem = GetLootSlotItemLink,
SetQuestLogItem = GetQuestLogItemLink,
SetQuestItem = GetQuestItemLink,
SetHyperlink = function(link) return link end,
SetBagItem = GetContainerItemLink,
SetInboxItem = GetInboxItemLink,
SetInventoryItem = GetInventoryItemLink,
SetTradeSkillItem = function(skillIndex, reagentIndex)
if reagentIndex then
return GetTradeSkillReagentItemLink(skillIndex, reagentIndex)
else
return GetTradeSkillItemLink(skillIndex)
end
end,
SetAuctionSellItem = GetAuctionSellItemLink,
SetTradePlayerItem = GetTradePlayerItemLink,
SetTradeTargetItem = GetTradeTargetItemLink
}
local function startsWith(str, start)
return string.sub(str, 1, string.len(start)) == start
end
local function ExtractAttributes(tooltip)
local name = tooltip:GetName()
-- get the name/header of the last set comparison tooltip
local comparetooltip = pfUI.eqcompare.tooltip:GetName()
local iname = _G[comparetooltip .. "TextLeft1"] and _G[comparetooltip .. "TextLeft1"]:GetText()
-- only run once per item
if tooltip.pfCompLastName == iname then return end
tooltip.pfCompData = {}
tooltip.pfCompLastName = iname
for i=1,30 do
local widget = _G[name.."TextLeft"..i]
if widget and widget:GetObjectType() == "FontString" then
local text = widget:GetText()
if text and not string.find(text, "-", 1, true) then
local start = 1
if startsWith(text, "\+") or startsWith(text, "\(") then start = 2 end
local space = string.find(text, " ", 1, true)
if space then
local value = tonumber(string.sub(text, start, space-1))
if value and text then
-- we've found an attr
local attr = string.sub(text, space, string.len(text))
tooltip.pfCompData[attr] = { value = tonumber(value), widget = widget }
end
end
end
local function makeHook(getter)
return function(tooltip, arg1, arg2, arg3)
if C.tooltip.compare.basestats == "1" then
ShowCompareItem(tooltip, getter(arg1, arg2, arg3))
end
end
end
local function CompareAttributes(data, targetData)
if not data then return end
for attr,v in pairs(data) do
if targetData then
local target = targetData[attr]
if target then
if v.value ~= target.value and v.widget:GetText() then
if v.value > target.value then
if not strfind(v.widget:GetText(), "|cff88ff88") and not strfind(v.widget:GetText(), "|cffff8888") then
v.widget:SetText(v.widget:GetText() .. "|cff88ff88 (+" .. round(v.value - target.value, 1) .. ")")
end
elseif not v.widget.compSet then
if not strfind(v.widget:GetText(), "|cff88ff88") and not strfind(v.widget:GetText(), "|cffff8888") then
v.widget:SetText(v.widget:GetText() .. "|cffff8888 (-" .. round(target.value - v.value, 1) .. ")")
end
end
target.processed = true
else
target.processed = true
end
else
-- this attribute doesnt exist in target
if v.widget and v.widget:GetText() then
if not strfind(v.widget:GetText(), "|cff88ff88") and not strfind(v.widget:GetText(), "|cffff8888") then
v.widget:SetText(v.widget:GetText() .. "|cff88ff88 (+" .. v.value .. ")")
end
end
end
end
end
for _,target in pairs(targetData) do
if target and not target.processed then
-- we are an extra value
local text = target.widget:GetText()
if text and not strfind(text, "|cff88ff88") and not strfind(text, "|cffff8888") then
target.widget:SetText(text .. "|cff88ff88 (+" .. target.value .. ")")
end
end
local function HookTooltip(tooltip)
for setter, getter in pairs(TooltipHooks) do
_G['hooksecurefunc'](tooltip, setter, makeHook(getter))
end
end
pfUI.eqcompare = {}
pfUI.eqcompare.GameTooltipShow = function()
-- use this tooltip for the next comparison
pfUI.eqcompare.tooltip = this
HookTooltip(GameTooltip)
if not IsShiftKeyDown() and C.tooltip.compare.showalways ~= "1" then return end
local rawborder, border = GetBorderSize()
for i=1,this:NumLines() do
local tmpText = _G[this:GetName() .. "TextLeft"..i]
for slotType, slotName in pairs(slotTable) do
if tmpText:GetText() == slotType then
local slotID = GetInventorySlotInfo(slotTable[slotType])
-- determine screen part
local ltrigger = GetScreenWidth() / 2
local x = GetCursorPosition()
x = x / UIParent:GetEffectiveScale()
if x > ltrigger then ltrigger = nil end
-- first tooltip
ShoppingTooltip1:SetOwner(this, "ANCHOR_NONE")
ShoppingTooltip1:ClearAllPoints()
if ltrigger then
ShoppingTooltip1:SetPoint("BOTTOMLEFT", this, "BOTTOMRIGHT", 0, 0)
else
ShoppingTooltip1:SetPoint("BOTTOMRIGHT", this, "BOTTOMLEFT", -border*2-1, 0)
end
ShoppingTooltip1:SetInventoryItem("player", slotID)
ShoppingTooltip1:Show()
AddHeader(ShoppingTooltip1)
-- second tooltip
if slotTable[slotType .. "_other"] then
local slotID_other = GetInventorySlotInfo(slotTable[slotType .. "_other"])
ShoppingTooltip2:SetOwner(this, "ANCHOR_NONE")
ShoppingTooltip2:ClearAllPoints()
if ltrigger then
ShoppingTooltip2:SetPoint("BOTTOMLEFT", ShoppingTooltip1, "BOTTOMRIGHT", 0, 0)
else
ShoppingTooltip2:SetPoint("BOTTOMRIGHT", ShoppingTooltip1, "BOTTOMLEFT", -border*2-1, 0)
end
ShoppingTooltip2:SetInventoryItem("player", slotID_other)
ShoppingTooltip2:Show()
AddHeader(ShoppingTooltip2)
end
return true
end
end
end
end
-- add HookScript method if not already existing
GameTooltip.HookScript = GameTooltip.HookScript or HookScript
ShoppingTooltip1.HookScript = ShoppingTooltip1.HookScript or HookScript
ShoppingTooltip2.HookScript = ShoppingTooltip2.HookScript or HookScript
pfUI.eqcompare.ShoppingTooltipShow = function()
-- abort if no comparison tooltip has been set
if not pfUI.eqcompare.tooltip then return end
ExtractAttributes(this)
ExtractAttributes(pfUI.eqcompare.tooltip)
CompareAttributes(pfUI.eqcompare.tooltip.pfCompData, this.pfCompData)
end
-- Add Gametooltip Hooks
GameTooltip:HookScript("OnShow", pfUI.eqcompare.GameTooltipShow)
if C.tooltip.compare.basestats == "1" then
ShoppingTooltip1:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
ShoppingTooltip2:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
end
pfUI.eqcompare.HookTooltip = HookTooltip
end)
+5
View File
@@ -46,6 +46,11 @@ pfUI:RegisterModule("firstrun", function ()
return
end
end
if not self.completed then
self.completed = true
pfUI.events:TriggerEvent("firstrun:complete")
end
end
-- main function to create wizard windows
+1 -3
View File
@@ -50,10 +50,8 @@ function SlashCmdList.PFFOCUSNAME(msg)
FocusUnit("target")
end
local restore = CreateFrame("Frame")
restore:SetScript("OnUpdate", function()
RunNextFrame(function()
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
restore:SetScript("OnUpdate", nil)
end)
if prevGUID and prevGUID ~= "0x0000000000000000" then
+21 -1
View File
@@ -212,6 +212,7 @@ pfUI:RegisterModule("gui", function ()
if not this:GetParent():IsShown() then
category[config] = r .. "," .. g .. "," .. b .. "," .. a
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
end
@@ -278,6 +279,7 @@ pfUI:RegisterModule("gui", function ()
if this:GetText() ~= this:GetParent().category[this:GetParent().config] then
this:GetParent().category[this:GetParent().config] = this:GetText()
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
this:SetTextColor(.2,1,.8,1)
else
@@ -328,6 +330,7 @@ pfUI:RegisterModule("gui", function ()
end
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end)
if category[config] == "1" then frame.input:SetChecked() end
@@ -360,6 +363,7 @@ pfUI:RegisterModule("gui", function ()
if category and category[config] ~= value then
category[config] = value
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
end
end
@@ -394,6 +398,7 @@ pfUI:RegisterModule("gui", function ()
end
category[config] = newconf
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
frame.input:UpdateMenu()
end)
@@ -409,6 +414,7 @@ pfUI:RegisterModule("gui", function ()
CreateQuestionDialog(T["New entry:"], function()
category[config] = category[config] .. "#" .. this:GetParent().input:GetText()
if ufunc then ufunc() else pfUI.gui.settingChanged = true end
pfUI.events:TriggerEvent("config:changed", category, config)
frame.input:UpdateMenu()
end, false, true)
end)
@@ -2749,7 +2755,21 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Custom Transparency"], C.tooltip, "alpha")
CreateConfig(nil, T["Status Bar Texture"], C.tooltip.statusbar, "texture", "dropdown", pfUI.gui.dropdowns.uf_bartexture)
CreateConfig(nil, T["Compare Item Base Stats"], C.tooltip.compare, "basestats", "checkbox")
CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
local showAlways = CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
local function gate()
local on = C.tooltip.compare.basestats == "1"
if on then
showAlways.input:Enable()
showAlways.caption:SetTextColor(1, 1, 1)
else
showAlways.input:Disable()
showAlways.caption:SetTextColor(0.5, 0.5, 0.5)
end
end
gate()
pfUI.events:RegisterCallback("config:changed", function(_, cat, key)
if cat == C.tooltip.compare and key == "basestats" then gate() end
end, "eqcompare-showalways-gate")
CreateConfig(nil, T["Always Show Extended Vendor Values"], C.tooltip.vendor, "showalways", "checkbox")
CreateConfig(U["questitem"], T["Show Related Quest On Questitems"], C.tooltip.questitem, "showquest", "checkbox")
CreateConfig(U["questitem"], T["Show Required Questitem Count"], C.tooltip.questitem, "showcount", "checkbox")
+4 -8
View File
@@ -96,14 +96,10 @@ pfUI:RegisterModule("innervatecall", function ()
end
end
local readyAt = GetTime() + cdRemaining
frame:SetScript("OnUpdate", function()
if GetTime() >= readyAt then
frame:SetScript("OnUpdate", nil)
local ch = GetAnnounceChannel()
if ch then
SendChatMessage(">> Innervate is ready <<", ch)
end
C_Timer.After(cdRemaining, function()
local ch = GetAnnounceChannel()
if ch then
SendChatMessage(">> Innervate is ready <<", ch)
end
end)
end)
+1 -5
View File
@@ -66,9 +66,5 @@ pfUI:RegisterModule("macrotweak", function ()
end)
-- Check conflicts after one tick so all addons have finished loading
local watcher = CreateFrame("Frame")
watcher:SetScript("OnUpdate", function()
this:SetScript("OnUpdate", nil)
CheckConflicts()
end)
RunNextFrame(CheckConflicts)
end)
+1 -1
View File
@@ -943,7 +943,7 @@ pfUI:RegisterModule("thirdparty-vanilla", function()
CreateBackdropShadow(AtlasLootTooltip)
if pfUI.eqcompare then
HookScript(AtlasLootTooltip, "OnShow", pfUI.eqcompare.GameTooltipShow)
pfUI.eqcompare.HookTooltip(AtlasLootTooltip)
HookScript(AtlasLootTooltip, "OnHide", function()
ShoppingTooltip1:Hide()
ShoppingTooltip2:Hide()
+5 -1
View File
@@ -27,7 +27,7 @@ do
-- ClassicAPI dependency check.
-- pfUI relies pervasively on the modern C_* / SuperWoW / nameplate / focus
-- API surface that ClassicAPI polyfills, so presence is required.
local PFUI_CLASSIC_API_MIN = 10503 -- (X*10000 + Y*100 + Z)
local PFUI_CLASSIC_API_MIN = 10507 -- (X*10000 + Y*100 + Z)
local PFUI_CLASSIC_API_LATEST = PFUI_CLASSIC_API_MIN
local PFUI_CLASSIC_API_WEBSITE = "https://github.com/brues-code/ClassicAPI"
local PFUI_CLASSIC_API_LATEST_URL = PFUI_CLASSIC_API_WEBSITE .. "/releases/latest"
@@ -102,6 +102,10 @@ pfUI.version = {}
pfUI.hooks = {}
pfUI.env = {}
pfUI.events = Mixin({}, CallbackRegistryMixin)
pfUI.events:OnLoad()
pfUI.events:SetUndefinedEventsAllowed(true)
-- check if macro addons are loaded (disables macrotweak/macroscan)
function pfUI:MacroAddonsLoaded()
return IsAddOnLoaded("Supermacro") or IsAddOnLoaded("SuperCleveRoidMacros") or IsAddOnLoaded("UltimaMacros")
+7 -10
View File
@@ -136,22 +136,19 @@ pfUI:RegisterSkin("Character", function ()
end
end
HookScript(CharacterFrame, "OnShow", function()
hooksecurefunc("CharacterFrame_OnShow", function()
RefreshCharacterSlots()
RefreshPetPosition()
end)
if not this.hooked then
hooksecurefunc("PaperDollItemSlotButton_Update", function()
-- update only character slots!
if string.find(this:GetName(), "^Character.-Slot$") then
RefreshCharacterSlot(this)
end
end)
hooksecurefunc("PetTab_Update", RefreshPetPosition)
this.hooked = true
hooksecurefunc("PaperDollItemSlotButton_Update", function()
if this:GetParent() == PaperDollFrame then
RefreshCharacterSlot(this)
end
end)
hooksecurefunc("PetTab_Update", RefreshPetPosition)
StripTextures(PaperDollFrame)
StripTextures(CharacterAttributesFrame)
StripTextures(CharacterResistanceFrame)