mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-10 15:40:01 +00:00
compat: initial layout of client abstraction api
This commit is contained in:
+1
-1
@@ -318,7 +318,7 @@ pfUI:RegisterModule("bags", function ()
|
||||
if tpl == "BankItemButtonGenericTemplate" then
|
||||
local bankslot = pfUI.bags[bag].slots[slot].frame
|
||||
local name = "pfBag" .. bag .. "item" .. slot .. "Cooldown"
|
||||
bankslot.cd = CreateFrame("Model", name, bankslot, "CooldownFrameTemplate")
|
||||
bankslot.cd = CreateFrame(COOLDOWN_FRAME_TYPE, name, bankslot, "CooldownFrameTemplate")
|
||||
bankslot.cd:SetAllPoints(bankslot)
|
||||
bankslot.cd.pfCooldownType = "ALL"
|
||||
else
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ pfUI:RegisterModule("buff", function ()
|
||||
else
|
||||
buff.id = buff.gid
|
||||
end
|
||||
buff.bid = GetPlayerBuff(buff.id-1, buff.btype)
|
||||
buff.bid = GetPlayerBuff(PLAYER_BUFF_START_ID+buff.id, buff.btype)
|
||||
|
||||
--detect weapon buffs
|
||||
if buff.btype == "HELPFUL" and ((C.buffs.separateweapons == "0" and buff.gid <= pfUI.buff.wepbuffs.count) or (pfUI.buff.wepbuffs.count > 0 and buff.weapon ~= nil)) then
|
||||
@@ -203,7 +203,7 @@ pfUI:RegisterModule("buff", function ()
|
||||
local offset = (mh and 1 or 0) + (oh and 1 or 0)
|
||||
|
||||
for i=1,32 do
|
||||
local bid, untilCancelled = GetPlayerBuff(i-1, "HELPFUL")
|
||||
local bid, untilCancelled = GetPlayerBuff(PLAYER_BUFF_START_ID+i, "HELPFUL")
|
||||
if bid < 0 then
|
||||
return i - 1 + offset
|
||||
end
|
||||
|
||||
@@ -31,13 +31,13 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
local counter = 1
|
||||
local l = string.len(text)
|
||||
for i = 1, l, 3 do
|
||||
counter = math.mod(counter*8161, 4294967279) + (string.byte(text,i)*16776193) + ((string.byte(text,i+1) or (l-i+256))*8372226) + ((string.byte(text,i+2) or (l-i+256))*3932164)
|
||||
counter = mod(counter*8161, 4294967279) + (string.byte(text,i)*16776193) + ((string.byte(text,i+1) or (l-i+256))*8372226) + ((string.byte(text,i+2) or (l-i+256))*3932164)
|
||||
end
|
||||
counter = math.mod(8161, 4294967279) + (string.byte(text,l)*16776193) + ((string.byte(text,l+1) or (l-l+256))*8372226) + ((string.byte(text,l+2) or (l+256))*3932164)
|
||||
counter = mod(8161, 4294967279) + (string.byte(text,l)*16776193) + ((string.byte(text,l+1) or (l-l+256))*8372226) + ((string.byte(text,l+2) or (l+256))*3932164)
|
||||
|
||||
local hash = math.mod(math.mod(counter, 4294967291),16777216)
|
||||
local r = (hash - (math.mod(hash,65536))) / 65536
|
||||
local g = ((hash - r*65536) - ( math.mod((hash - r*65536),256)) ) / 256
|
||||
local hash = mod(mod(counter, 4294967291),16777216)
|
||||
local r = (hash - (mod(hash,65536))) / 65536
|
||||
local g = ((hash - r*65536) - ( mod((hash - r*65536),256)) ) / 256
|
||||
local b = hash - r*65536 - g*256
|
||||
rgbcache[text] = { r / 255, g / 255, b / 255 }
|
||||
return unpack(rgbcache[text])
|
||||
@@ -58,7 +58,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
|
||||
local function GetBuffData(unit, id, type, skipTooltip)
|
||||
if unit == "player" then
|
||||
local bid = GetPlayerBuff(id-1, type)
|
||||
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID+id, type)
|
||||
local remaining = GetPlayerBuffTimeLeft(bid)
|
||||
local texture = GetPlayerBuffTexture(bid)
|
||||
local name
|
||||
@@ -93,7 +93,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. skill .. "|r" .. T["is now blacklisted."])
|
||||
end
|
||||
elseif this.parent.unit == "player" then
|
||||
CancelPlayerBuff(GetPlayerBuff(this.id-1,this.type))
|
||||
CancelPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
GameTooltip:SetOwner(this, "NONE")
|
||||
|
||||
if this.unit == "player" then
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(this.id-1,this.type))
|
||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
||||
elseif this.type == "HARMFUL" then
|
||||
GameTooltip:SetUnitDebuff(this.unit, this.id)
|
||||
elseif this.type == "HELPFUL" then
|
||||
@@ -428,4 +428,4 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
pfUI.uf.target.debuffbar:SetPoint("BOTTOM", pfUI.uf.target, "TOP", 0, border*2+1)
|
||||
UpdateMovable(pfUI.uf.target.debuffbar)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
+41
-27
@@ -19,8 +19,6 @@ pfUI:RegisterModule("castbar", function ()
|
||||
cb.unitstr = unitstr
|
||||
cb.unitname = unitname
|
||||
|
||||
cb.delay = 0
|
||||
|
||||
-- statusbar
|
||||
cb.bar = CreateFrame("StatusBar", nil, cb)
|
||||
cb.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
|
||||
@@ -77,18 +75,23 @@ pfUI:RegisterModule("castbar", function ()
|
||||
return
|
||||
end
|
||||
|
||||
local spellname, start, duration, icon, delay, channel = libcast:GetCastInfo(name)
|
||||
if spellname then
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
||||
if cast then
|
||||
local duration = endTime - startTime
|
||||
local max = duration / 1000
|
||||
local cur = channel and duration / 1000 - delay + start - GetTime() or
|
||||
GetTime() - start - delay
|
||||
local cur = GetTime() - startTime / 1000
|
||||
|
||||
if UnitChannelInfo(name) then
|
||||
cur = duration + startTime / 1000 - GetTime() -- channel
|
||||
end
|
||||
|
||||
cur = cur > max and max or cur
|
||||
cur = cur < 0 and 0 or cur
|
||||
|
||||
this.bar:SetValue(cur)
|
||||
|
||||
if delay > 0 then
|
||||
delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(delay,1) .. " |r "
|
||||
if this.delay and this.delay > 0 then
|
||||
local delay = "|cffffaaaa" .. (channel and "-" or "+") .. round(this.delay,1) .. " |r "
|
||||
this.bar.right:SetText(delay .. string.format("%.1f",cur) .. " / " .. round(max,1))
|
||||
else
|
||||
this.bar.right:SetText(string.format("%.1f",cur) .. " / " .. round(max,1))
|
||||
@@ -102,27 +105,38 @@ pfUI:RegisterModule("castbar", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
function cb.OnEvent(self)
|
||||
local name = self.unitstr and UnitName(self.unitstr) or self.unitname
|
||||
|
||||
local spellname, start, casttime, icon, delay, channel = libcast:GetCastInfo(name)
|
||||
if spellname then
|
||||
self.bar:SetStatusBarColor(strsplit(",", C.appearance.castbar[(channel and "channelcolor" or "castbarcolor")]))
|
||||
self.bar:SetMinMaxValues(0, casttime / 1000)
|
||||
self.bar.left:SetText(spellname)
|
||||
|
||||
self:SetAlpha(1)
|
||||
self:Show()
|
||||
self.fadeout = nil
|
||||
self.playername = name
|
||||
else
|
||||
self.bar:SetMinMaxValues(1,100)
|
||||
self.bar:SetValue(100)
|
||||
self.fadeout = 1
|
||||
end
|
||||
-- register for all castbar events
|
||||
for _, event in pairs(CASTBAR_EVENTS) do
|
||||
cb:RegisterEvent(event)
|
||||
end
|
||||
|
||||
libcast:RegisterEventFunc(cb.OnEvent, cb)
|
||||
cb:SetScript("OnEvent", function()
|
||||
if strfind(event, "DELAYED") then
|
||||
this.delay = ( this.delay or 0 ) + arg1/1000
|
||||
end
|
||||
|
||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
||||
if not name then return end
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
||||
local channel = UnitChannelInfo(name)
|
||||
|
||||
if cast then
|
||||
local duration = endTime - startTime
|
||||
this.bar:SetStatusBarColor(strsplit(",", C.appearance.castbar[(channel and "channelcolor" or "castbarcolor")]))
|
||||
this.bar:SetMinMaxValues(0, duration / 1000)
|
||||
this.bar.left:SetText(cast)
|
||||
|
||||
this:SetAlpha(1)
|
||||
this:Show()
|
||||
this.fadeout = nil
|
||||
else
|
||||
this.bar:SetMinMaxValues(1,100)
|
||||
this.bar:SetValue(100)
|
||||
this.delay = 0
|
||||
this.fadeout = 1
|
||||
end
|
||||
end)
|
||||
|
||||
return cb
|
||||
end
|
||||
|
||||
|
||||
@@ -174,6 +174,11 @@ pfUI:RegisterModule("eqcompare", function ()
|
||||
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
|
||||
@@ -184,9 +189,9 @@ pfUI:RegisterModule("eqcompare", function ()
|
||||
end
|
||||
|
||||
-- Add Gametooltip Hooks
|
||||
HookScript(GameTooltip, "OnShow", pfUI.eqcompare.GameTooltipShow)
|
||||
GameTooltip:HookScript("OnShow", pfUI.eqcompare.GameTooltipShow)
|
||||
if C.tooltip.compare.basestats == "1" then
|
||||
HookScript(ShoppingTooltip1, "OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
HookScript(ShoppingTooltip2, "OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
ShoppingTooltip1:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
ShoppingTooltip2:HookScript("OnShow", pfUI.eqcompare.ShoppingTooltipShow)
|
||||
end
|
||||
end)
|
||||
|
||||
+1
-1
@@ -502,7 +502,7 @@ pfUI:RegisterModule("loot", function ()
|
||||
end
|
||||
|
||||
function pfUI.loot:CreateSlot(id)
|
||||
local frame = CreateFrame("LootButton", 'pfLootButton'..id, pfUI.loot)
|
||||
local frame = CreateFrame(LOOT_BUTTON_FRAME_TYPE, 'pfLootButton'..id, pfUI.loot)
|
||||
frame:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
frame:SetPoint("LEFT", C.appearance.border.default*2, 0)
|
||||
frame:SetPoint("RIGHT", -C.appearance.border.default*2, 0)
|
||||
|
||||
@@ -114,7 +114,7 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
if (j < numTexturesVert) then
|
||||
texturePixelHeight,textureFileHeight = 256,256
|
||||
else
|
||||
texturePixelHeight = math.mod(textureHeight, 256)
|
||||
texturePixelHeight = mod(textureHeight, 256)
|
||||
if (texturePixelHeight == 0) then texturePixelHeight = 256 end
|
||||
textureFileHeight = 16
|
||||
while (textureFileHeight < texturePixelHeight) do
|
||||
@@ -129,7 +129,7 @@ pfUI:RegisterModule("mapreveal", function ()
|
||||
if (k < numTexturesHorz) then
|
||||
texturePixelWidth, textureFileWidth = 256,256
|
||||
else
|
||||
texturePixelWidth = math.mod(textureWidth, 256)
|
||||
texturePixelWidth = mod(textureWidth, 256)
|
||||
if (texturePixelWidth == 0) then texturePixelWidth = 256 end
|
||||
textureFileWidth = 16
|
||||
while (textureFileWidth < texturePixelWidth) do
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ pfUI:RegisterModule("minimap", function ()
|
||||
this.highlight:Show()
|
||||
end)
|
||||
|
||||
MiniMapTrackingFrame:SetFrameStrata("LOW")
|
||||
MINIMAP_TRACKING_FRAME:SetFrameStrata("LOW")
|
||||
|
||||
-- Create coordinates text frame with location configurable
|
||||
pfUI.minimapCoordinates = CreateFrame("Frame", "pfMinimapCoord", pfUI.minimap)
|
||||
|
||||
+22
-13
@@ -19,10 +19,9 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
pfUI.nameplates.scanner.parentCount = parentCount
|
||||
|
||||
for _, nameplate in ipairs({WorldFrame:GetChildren()}) do
|
||||
if not nameplate.done and nameplate:GetObjectType() == "Button" then
|
||||
if not nameplate.done and nameplate:GetObjectType() == NAMEPLATE_FRAMETYPE then
|
||||
local regions = nameplate:GetRegions()
|
||||
if regions and regions:GetObjectType() == "Texture" and regions:GetTexture() == "Interface\\Tooltips\\Nameplate-Border" then
|
||||
|
||||
local visible = nameplate:IsVisible()
|
||||
nameplate:Hide()
|
||||
nameplate:SetScript("OnShow", pfUI.nameplates.OnShow)
|
||||
@@ -83,7 +82,16 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
this.nameplate.parent = this
|
||||
this.healthbar = this:GetChildren()
|
||||
this.healthbar:SetScript("OnEnter", function() return nil end)
|
||||
this.border, this.glow, this.name, this.level, this.levelicon , this.raidicon = this:GetRegions()
|
||||
|
||||
for i, frame in pairs({this:GetRegions()}) do
|
||||
if NAMEPLATE_OBJECTORDER[i] == "_" then
|
||||
frame.Show = function() return end
|
||||
frame:Hide()
|
||||
else
|
||||
this[NAMEPLATE_OBJECTORDER[i]] = frame
|
||||
end
|
||||
end
|
||||
|
||||
this.healthbar:SetParent(this.nameplate)
|
||||
this.border:SetParent(this.nameplate)
|
||||
this.glow:SetParent(this.nameplate)
|
||||
@@ -120,7 +128,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
|
||||
-- add click handlers
|
||||
if C.nameplates["clickthrough"] == "0" then
|
||||
if C.nameplates["legacy"] == "0" then
|
||||
if C.nameplates["legacy"] == "0" and pfUI.client < 20000 then
|
||||
this.nameplate:SetScript("OnClick", function() this.parent:Click() end)
|
||||
else
|
||||
this.nameplate:EnableMouse(false)
|
||||
@@ -589,16 +597,17 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
|
||||
-- show castbar
|
||||
if healthbar.castbar and pfUI.castbar and C.nameplates["showcastbar"] == "1" then
|
||||
local spellname, start, casttime, icon = libcast:GetCastInfo(unitname)
|
||||
casttime = casttime / 1000
|
||||
if not spellname then
|
||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(unitname)
|
||||
|
||||
if not cast then
|
||||
healthbar.castbar:Hide()
|
||||
else
|
||||
healthbar.castbar:SetMinMaxValues(0, casttime)
|
||||
healthbar.castbar:SetValue(GetTime() - start)
|
||||
healthbar.castbar.text:SetText(round(start + casttime - GetTime(),1))
|
||||
local duration = endTime - startTime
|
||||
healthbar.castbar:SetMinMaxValues(0, duration/1000)
|
||||
healthbar.castbar:SetValue(GetTime() - startTime/1000)
|
||||
healthbar.castbar.text:SetText(round(startTime/1000 + duration/1000 - GetTime(),1))
|
||||
if C.nameplates.spellname == "1" and healthbar.castbar.spell then
|
||||
healthbar.castbar.spell:SetText(spellname)
|
||||
healthbar.castbar.spell:SetText(cast)
|
||||
else
|
||||
healthbar.castbar.spell:SetText("")
|
||||
end
|
||||
@@ -608,7 +617,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
end
|
||||
|
||||
if icon then
|
||||
healthbar.castbar.icon:SetTexture("Interface\\Icons\\" .. icon)
|
||||
healthbar.castbar.icon:SetTexture("Interface\\Icons\\" .. texture)
|
||||
healthbar.castbar.icon:SetTexCoord(.1,.9,.1,.9)
|
||||
end
|
||||
end
|
||||
@@ -634,7 +643,7 @@ pfUI:RegisterModule("nameplates", function ()
|
||||
this.debuffs[j].icon:SetTexCoord(.078, .92, .079, .937)
|
||||
|
||||
if icon then
|
||||
this.debuffs[j].cd = this.debuffs[j].cd or CreateFrame("Model", nil, this.debuffs[j], "CooldownFrameTemplate")
|
||||
this.debuffs[j].cd = this.debuffs[j].cd or CreateFrame(COOLDOWN_FRAME_TYPE, nil, this.debuffs[j], "CooldownFrameTemplate")
|
||||
this.debuffs[j].cd.pfCooldownType = "ALL"
|
||||
|
||||
local name, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff("target", j)
|
||||
|
||||
+2
-2
@@ -178,10 +178,10 @@ pfUI:RegisterModule("share", function ()
|
||||
bit_pattern = bit_pattern .. bin_bits
|
||||
end
|
||||
|
||||
if math.mod(string.len(bit_pattern), 3) == 2 then
|
||||
if mod(string.len(bit_pattern), 3) == 2 then
|
||||
trailing = '=='
|
||||
bit_pattern = bit_pattern .. '0000000000000000'
|
||||
elseif math.mod(string.len(bit_pattern), 3) == 1 then
|
||||
elseif mod(string.len(bit_pattern), 3) == 1 then
|
||||
trailing = '='
|
||||
bit_pattern = bit_pattern .. '00000000'
|
||||
end
|
||||
|
||||
+8
-8
@@ -161,7 +161,7 @@ pfUI:RegisterModule("skin", function ()
|
||||
end
|
||||
end
|
||||
|
||||
UIOptionsFrame:SetScript("OnShow", function()
|
||||
UI_OPTIONS_FRAME:SetScript("OnShow", function()
|
||||
-- default events
|
||||
UIOptionsFrame_Load();
|
||||
MultiActionBar_Update();
|
||||
@@ -172,15 +172,15 @@ pfUI:RegisterModule("skin", function ()
|
||||
-- customize
|
||||
UIOptionsBlackground:Hide()
|
||||
|
||||
UIOptionsFrame:SetMovable(true)
|
||||
UIOptionsFrame:EnableMouse(true)
|
||||
UIOptionsFrame:SetScale(.8)
|
||||
UIOptionsFrame:SetScript("OnMouseDown",function()
|
||||
UIOptionsFrame:StartMoving()
|
||||
UI_OPTIONS_FRAME:SetMovable(true)
|
||||
UI_OPTIONS_FRAME:EnableMouse(true)
|
||||
UI_OPTIONS_FRAME:SetScale(.8)
|
||||
UI_OPTIONS_FRAME:SetScript("OnMouseDown",function()
|
||||
UI_OPTIONS_FRAME:StartMoving()
|
||||
end)
|
||||
|
||||
UIOptionsFrame:SetScript("OnMouseUp",function()
|
||||
UIOptionsFrame:StopMovingOrSizing()
|
||||
UI_OPTIONS_FRAME:SetScript("OnMouseUp",function()
|
||||
UI_OPTIONS_FRAME:StopMovingOrSizing()
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -56,11 +56,11 @@ pfUI:RegisterModule("socialmod", function ()
|
||||
zone = ( zone == playerzone and "|cffffffff" or "|cffaaaaaa" ) .. zone .. "|r"
|
||||
name = "|cff" .. string.format("%02x%02x%02x", ccolor.r*255, ccolor.g*255, ccolor.b*255) .. name .. "|r"
|
||||
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"]:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), name, zone, status))
|
||||
_G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), name, zone, status))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetText(format(TEXT(FRIENDS_LEVEL_TEMPLATE), level, class))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetTextColor(lcolor.r + .2, lcolor.g + .2, lcolor.b + .2)
|
||||
else
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"]:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name))
|
||||
_G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION]:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetText(TEXT(UNKNOWN))
|
||||
_G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]:SetTextColor(.2,.2,.2)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pfUI:RegisterModule("tracking", function ()
|
||||
|
||||
MiniMapTrackingFrame:UnregisterAllEvents()
|
||||
MiniMapTrackingFrame:Hide()
|
||||
MINIMAP_TRACKING_FRAME:UnregisterAllEvents()
|
||||
MINIMAP_TRACKING_FRAME:Hide()
|
||||
|
||||
local function HasEntries(tbl)
|
||||
for _ in pairs(tbl) do
|
||||
|
||||
Reference in New Issue
Block a user