Skip to content

Commit

Permalink
rename to CustomNames, and fix formatter for name-realm
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbuds committed Jun 23, 2023
1 parent 3f22054 commit 9113b49
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
3 changes: 1 addition & 2 deletions WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ Private.format_types = {
if not unit then
return ""
end
local name, realm = WeakAuras.UnitNameWithRealm(unit)
name = WeakAuras.GetName(name)
local name, realm = WeakAuras.UnitNameWithRealmCustomName(unit)
return name .. "-" .. realm
end
end
Expand Down
18 changes: 13 additions & 5 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ local LDBIcon = LibStub("LibDBIcon-1.0")
local LCG = LibStub("LibCustomGlow-1.0")
local LGF = LibStub("LibGetFrame-1.0")

local LibCustomNames = IsAddOnLoaded("LibCustomNames") and LibStub("LibCustomNames") -- optional addon
if LibCustomNames then
WeakAuras.GetName = LibCustomNames.Get
WeakAuras.UnitName = LibCustomNames.UnitName
WeakAuras.GetUnitName = LibCustomNames.GetUnitName
local CustomNames = IsAddOnLoaded("CustomNames") and LibStub("CustomNames") -- optional addon
if CustomNames then
WeakAuras.GetName = CustomNames.Get
WeakAuras.UnitName = CustomNames.UnitName
WeakAuras.GetUnitName = CustomNames.GetUnitName
WeakAuras.UnitFullName = CustomNames.UnitFullName
else
WeakAuras.GetName = function(name) return name end
WeakAuras.UnitName = UnitName
WeakAuras.GetUnitName = GetUnitName
WeakAuras.UnitFullName = UnitFullName
end

local timer = WeakAurasTimers
Expand Down Expand Up @@ -5726,6 +5728,12 @@ do
local name, realm = UnitFullName(unit)
return name or "", realm or ownRealm or ""
end

function WeakAuras.UnitNameWithRealmCustomName(unit)
ownRealm = ownRealm or select(2, UnitFullName("player"))
local name, realm = WeakAuras.UnitFullName(unit)
return name or "", realm or ownRealm or ""
end
end

function Private.ExecEnv.ParseNameCheck(name)
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras.toc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, LibSpecialization, !LibUIDropDownMenu, !!AddonLocale, LibCustomNames
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, LibSpecialization, !LibUIDropDownMenu, !!AddonLocale, CustomNames

# External code + initialization
embeds.xml
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras_Vanilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, CustomNames

# External code + initialization
embeds.xml
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras/WeakAuras_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibClassicDurations, LibClassicCasterino, LibGetFrame-1.0, !LibUIDropDownMenu, !!AddonLocale, CustomNames

# External code + initialization
embeds.xml
Expand Down

0 comments on commit 9113b49

Please sign in to comment.