Skip to content

Commit

Permalink
Classic TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
Resike committed Jan 31, 2024
1 parent e25a63d commit 25a714c
Show file tree
Hide file tree
Showing 24 changed files with 193 additions and 164 deletions.
4 changes: 4 additions & 0 deletions ZPerl/!Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
**7.2.0**
* Fixed various combo point issues on Classic.
* Revamped Custom Highlight.

**7.1.9**
* Rewamped blizzard style target combo points.
* Attempt to reset non-exsiting saved variables to their default values.
Expand Down
2 changes: 1 addition & 1 deletion ZPerl/Version.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function ZPerl:ADDON_LOADED(addon)
self:RegisterEvents()

self.playerName = string.gsub(UnitName("player").."-"..GetRealmName(), "%s+", "")
self.version = GetAddOnMetadata and GetAddOnMetadata("ZPerl", "Version") or "7.1.9"
self.version = GetAddOnMetadata and GetAddOnMetadata("ZPerl", "Version") or "7.2.0"

self:UnregisterEvent("ADDON_LOADED")
end
Expand Down
4 changes: 2 additions & 2 deletions ZPerl/ZPerl.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 100205
## Version: 7.1.9
## Interface: 11500
## Version: 7.2.0
## Author: Resike
## Title: Z-Perl UnitFrames
## Title-itIT: Z-Perl UnitFrames
Expand Down
2 changes: 1 addition & 1 deletion ZPerl/localization.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ XPerl_ProductName = "|cFFD00000Z-Perl|r UnitFrames"
XPerl_ShortProductName = "|cFFD00000Z-Perl|r"
XPerl_Author = "|cFFFF8080Resike|r"
XPerl_Description = XPerl_ProductName.." by "..XPerl_Author
XPerl_VersionNumber = GetAddOnMetadata and GetAddOnMetadata("ZPerl", "Version") or "7.1.9"
XPerl_VersionNumber = GetAddOnMetadata and GetAddOnMetadata("ZPerl", "Version") or "7.2.0"
XPerl_Version = XPerl_Description.." - "..XPerl_VersionNumber
XPerl_LongDescription = "UnitFrame replacement for new look Player, Pet, Party, Target, Target's Target, Focus, Raid"
XPerl_ModMenuIcon = "Interface\\Icons\\INV_Misc_Gem_Pearl_02"
Expand Down
2 changes: 1 addition & 1 deletion ZPerl_ArcaneBar/ZPerl_ArcaneBar.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100205
## Interface: 11500
## Author: Resike
## Title: Z-Perl |cffeda55fArcane Bars|r
## Title-itIT: Z-Perl |cffeda55fBarre Arcane|r
Expand Down
148 changes: 73 additions & 75 deletions ZPerl_CustomHighlight/ZPerl_CustomHighlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ if (not XPerl_RequestConfig) then
return
end

local conf
local conf, rconf
XPerl_RequestConfig(function(new)
conf = new.custom
rconf = new.raid
end, "$Revision: @file-revision@ $")

local IsClassic = WOW_PROJECT_ID >= WOW_PROJECT_CLASSIC
Expand All @@ -24,29 +25,14 @@ local UnitAura = UnitAura

local SecureButton_GetUnit = SecureButton_GetUnit

local ch = CreateFrame("Frame", "ZPerl_Custom")
ch.active = {}
ch:RegisterEvent("PLAYER_ENTERING_WORLD")
ch:RegisterEvent("UNIT_AURA")
ch:RegisterEvent("ZONE_CHANGED_NEW_AREA")
--ch:RegisterEvent("MINIMAP_ZONE_CHANGED")
local CustomHighlight = CreateFrame("Frame", "ZPerl_Custom")
CustomHighlight.active = {}
CustomHighlight:RegisterEvent("PLAYER_ENTERING_WORLD")
CustomHighlight:SetScript("OnEvent", function(self, event, ...)
self[event](self, ...)
end)

ch.RaidFrameArray = XPerl_Raid_GetFrameArray()

-- ch:OnEvent(event, a, b, c)
function ch:OnEvent(event, a, b, c)
self[event](self, a, b, c)
end

-- ch:AddDebuff
function ch:AddDebuff(debuffName)
local zoneName = GetRealZoneText()
end

-- ch:AddDebuff
function ch:AddBuff(buffName)
local zoneName = GetRealZoneText()
end
CustomHighlight.RaidFrameArray = XPerl_Raid_GetFrameArray()

-- Pull zone names from encounter journal so they don't need to be localized.
-- Cataclysm Raids
Expand Down Expand Up @@ -80,7 +66,7 @@ local XPERL_LOC_ZONE_TERRACE_OF_ENDLESS_SPRING = EJ_GetInstanceInfo(320)
local XPERL_LOC_ZONE_HEART_OF_FEAR = EJ_GetInstanceInfo(1009)
--]]
-- DefaultZoneData
function ch:DefaultZoneData()
function CustomHighlight:DefaultZoneData()
return {
[XPERL_LOC_ZONE_ANTORUS] =
{
Expand Down Expand Up @@ -380,33 +366,37 @@ function ch:DefaultZoneData()
end

-- SetDefaultZoneData
function ch:SetDefaultZoneData()
if (conf) then
function CustomHighlight:SetDefaultZoneData()
if conf then
conf.zones = self:DefaultZoneData()
XPerlDB.custom.zones = conf.zones
self:PLAYER_ENTERING_WORLD()
end
end

-- SetDefaultZoneData
function ch:SetDefaults()
if (conf) then
function CustomHighlight:SetDefaults()
if conf then
conf.alpha = 0.5
conf.blend = "ADD"
self:SetDefaultZoneData()
end
end

-- ch:PLAYER_ENTERING_WORLD
function ch:PLAYER_ENTERING_WORLD()
if (conf and conf.enable) then
if (not conf.zones) then
-- CustomHighlight:PLAYER_ENTERING_WORLD
function CustomHighlight:PLAYER_ENTERING_WORLD()
if conf.enable and rconf.enable then
self:RegisterEvent("UNIT_AURA")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
--self:RegisterEvent("MINIMAP_ZONE_CHANGED")

if not conf.zones then
conf.zones = self:DefaultZoneData()
end
local zoneName = GetRealZoneText()
self.zoneDataRaw = conf and conf.zones[zoneName]

if (self.zoneDataRaw) then
if self.zoneDataRaw then
self.zoneData = {}
for spellid in pairs(self.zoneDataRaw) do
local spellName, _, icon = GetSpellInfo(spellid)
Expand All @@ -418,33 +408,38 @@ function ch:PLAYER_ENTERING_WORLD()
self.zoneData = nil
end
else
self:UnregisterAllEvents()
self.zoneData = nil
end
end

ch.ZONE_CHANGED_NEW_AREA = ch.PLAYER_ENTERING_WORLD
--ch.MINIMAP_ZONE_CHANGED = ch.PLAYER_ENTERING_WORLD
CustomHighlight.ZONE_CHANGED_NEW_AREA = CustomHighlight.PLAYER_ENTERING_WORLD
--CustomHighlight:.MINIMAP_ZONE_CHANGED = CustomHighlight:.PLAYER_ENTERING_WORLD

-- CustomHighlight:UpdateRoster
function CustomHighlight:UpdateUnits()
if not conf.enable or not rconf.enable then
return
end

-- UpdateRoster
function ch:UpdateUnits()
for unit, frame in pairs(self.RaidFrameArray) do
if (frame:IsShown()) then
if frame:IsShown() then
self:Check(frame, unit)
end
end
end

-- IconAcquire
function ch:IconAcquire()
if (not self.icons) then
self.icons = { }
-- CustomHighlight:IconAcquire
function CustomHighlight:IconAcquire()
if not self.icons then
self.icons = {}
end
if (not self.usedIcons) then
self.usedIcons = { }
if not self.usedIcons then
self.usedIcons = {}
end

local icon = self.icons[1]
if (not icon) then
if not icon then
icon = CreateFrame("Frame", nil)
icon:SetFrameStrata("MEDIUM")
icon.tex = icon:CreateTexture(nil, "OVERLAY")
Expand All @@ -456,23 +451,24 @@ function ch:IconAcquire()
end

self.usedIcons[icon] = true

return icon
end

-- IconFree
function ch:IconFree(icon)
-- CustomHighlight:IconFree
function CustomHighlight:IconFree(icon)
icon:Hide()
tinsert(self.icons, icon)
self.usedIcons[icon] = nil
end

-- ch:Highlight
function ch:Highlight(frame, mode, unit, debuff, buffIcon)
if (not self.active[frame]) then
-- CustomHighlight:Highlight
function CustomHighlight:Highlight(frame, mode, unit, debuff, buffIcon)
if not self.active[frame] then
self.active[frame] = buffIcon
local c = frame.customHighlight
if (not c) then
c = { }
if not c then
c = {}
frame.customHighlight = c
end
c.type = mode
Expand All @@ -492,20 +488,20 @@ function ch:Highlight(frame, mode, unit, debuff, buffIcon)
end
end

-- Clear
function ch:Clear(frame)
if (self.active[frame]) then
-- CustomHighlight:Clear
function CustomHighlight:Clear(frame)
if self.active[frame] then
self.active[frame] = nil
local c = frame.customHighlight
if (c) then
if c then
self:IconFree(c.icon)
c.icon = nil
end
end
end

-- Clear
function ch:ClearAll()
-- CustomHighlight:Clear
function CustomHighlight:ClearAll()
if not self.usedIcons then
return
end
Expand All @@ -518,25 +514,29 @@ function ch:ClearAll()
end
end

-- UNIT_AURA
function ch:UNIT_AURA(unit)
-- CustomHighlight:UNIT_AURA
function CustomHighlight:UNIT_AURA(unit)
if not strmatch(unit, "raid%d+") then
return
end

local frame = XPerl_Raid_GetUnitFrameByUnit(unit)
if (frame) then
if frame then
self:Check(frame, unit)
end
end

-- ch:Check
function ch:Check(frame, unit)
if conf and (not conf.enable) then
-- CustomHighlight:Check
function CustomHighlight:Check(frame, unit)
if not conf.enable or not rconf.enable then
return
end

local z = self.zoneData
if (z) then
if (not unit) then
if z then
if not unit then
unit = frame:GetAttribute("unit")
if (not unit) then
if not unit then
unit = SecureButton_GetUnit(frame)
if (not unit) then
return
Expand All @@ -546,10 +546,10 @@ function ch:Check(frame, unit)

for i = 1, 40 do
local name, icon = UnitAura(unit, i, "HARMFUL")
if (not name) then
if not name then
break
end
if (z[name]) then
if z[name] then
self:Highlight(frame, "debuff", unit, name, icon)
return
end
Expand All @@ -559,13 +559,11 @@ function ch:Check(frame, unit)
self:Clear(frame)
end

if (not conf) then
if not conf then
conf = {
enable = true,
zones = ch:DefaultZoneData(),
enable = false,
zones = CustomHighlight:DefaultZoneData(),
}
end

ch:SetScript("OnEvent", ch.OnEvent)

ch:PLAYER_ENTERING_WORLD()
CustomHighlight:PLAYER_ENTERING_WORLD()
2 changes: 1 addition & 1 deletion ZPerl_CustomHighlight/ZPerl_CustomHighlight.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100205
## Interface: 11500
## Author: Resike
## Title: Z-Perl |cffeda55fCustom Highlight|r
## Title-itIT: Z-Perl |cffeda55fEvidenziazioni Personalizzate|r
Expand Down
4 changes: 2 additions & 2 deletions ZPerl_Options/ZPerl_FrameOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ end
function XPerl_Custom_Config_OnShow(self)
if (not XPerlDB.custom) then
XPerlDB.custom = {
enable = true,
enable = false,
alpha = 0.5,
blend = "ADD"
}
Expand Down Expand Up @@ -3397,7 +3397,7 @@ if (XPerl_UpgradeSettings) then

if (not old.custom) then
old.custom = {
enable = true,
enable = false,
alpha = 0.5,
blend = "ADD"
}
Expand Down
21 changes: 17 additions & 4 deletions ZPerl_Options/ZPerl_FrameOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12218,7 +12218,18 @@
end
self.configBase = "XPerlDB.raid"
self.configIndex = "enable"
self.configClick = XPerl_Raid_OptionActions
self.configClick = function()
if (not ZPerl_Custom) then
LoadAddOn("ZPerl_CustomHighlight")
end
if (ZPerl_Custom) then
ZPerl_Custom:PLAYER_ENTERING_WORLD()
if not XPerlDB.raid.enable or not XPerlDB.custom.enable then
ZPerl_Custom:ClearAll()
end
end
XPerl_Raid_OptionActions()
end
XPerl_Options_RegisterProtected(self)
</OnLoad>
</Scripts>
Expand Down Expand Up @@ -13638,10 +13649,12 @@
self.configBase = "XPerlDB.custom"
self.configIndex = "enable"
self.configClick = function()
if (not ZPerl_Custom) then
LoadAddOn("ZPerl_CustomHighlight")
end
if (ZPerl_Custom) then
if (XPerlDB.custom.enable) then
ZPerl_Custom:PLAYER_ENTERING_WORLD()
else
ZPerl_Custom:PLAYER_ENTERING_WORLD()
if not XPerlDB.custom.enable then
ZPerl_Custom:ClearAll()
end
end
Expand Down
2 changes: 1 addition & 1 deletion ZPerl_Options/ZPerl_Options.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100205
## Interface: 11500
## Author: Resike
## Title: Z-Perl |cffeda55fOptions|r |cFF40FF40(LoadOnDemand)|r
## Title-itIT: Z-Perl |cffeda55fOpzioni|r |cFF40FF40(Caricabile su richiesta)|r
Expand Down
2 changes: 1 addition & 1 deletion ZPerl_Party/ZPerl_Party.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100205
## Interface: 11500
## Author: Resike
## Title: Z-Perl |cffeda55fParty|r
## Title-itIT: Z-Perl |cffeda55fGruppo|r
Expand Down
Loading

0 comments on commit 25a714c

Please sign in to comment.