Range Check added

This commit is contained in:
Sumsebrum 2021-06-15 09:05:20 +02:00
parent a83c1ad0c2
commit 7b0bf921c4
6 changed files with 706 additions and 0 deletions

View File

@ -35,4 +35,6 @@ Modules\XiconProfiles.lua
Modules\Pets.lua
Modules\ExportImport.lua
Modules\CombatIndicator.lua
Modules\RangeCheck.lua
Modules\ShadowsightTimer.lua
EventListener.lua

View File

@ -0,0 +1,232 @@
--- = Background =
-- Blizzard's IsSpellInRange API has always been very limited - you either must have the name of the spell, or its spell book ID. Checking directly by spellID is simply not possible.
-- Now, in Mists of Pandaria, Blizzard changed the way that many talents and specialization spells work - instead of giving you a new spell when leaned, they replace existing spells. These replacement spells do not work with Blizzard's IsSpellInRange function whatsoever; this limitation is what prompted the creation of this lib.
-- = Usage =
-- **LibSpellRange-1.0** exposes an enhanced version of IsSpellInRange that:
-- * Allows ranged checking based on both spell name and spellID.
-- * Works correctly with replacement spells that will not work using Blizzard's IsSpellInRange method alone.
--
-- @class file
-- @name LibSpellRange-1.0.lua
local major = "SpellRange-1.0"
local minor = 15
assert(LibStub, format("%s requires LibStub.", major))
local Lib = LibStub:NewLibrary(major, minor)
if not Lib then return end
local tonumber = _G.tonumber
local strlower = _G.strlower
local wipe = _G.wipe
local type = _G.type
local GetSpellTabInfo = _G.GetSpellTabInfo
local GetNumSpellTabs = _G.GetNumSpellTabs
local GetSpellBookItemInfo = _G.GetSpellBookItemInfo
local GetSpellBookItemName = _G.GetSpellBookItemName
local GetSpellLink = _G.GetSpellLink
local GetSpellInfo = _G.GetSpellInfo
local IsSpellInRange = _G.IsSpellInRange
local SpellHasRange = _G.SpellHasRange
-- isNumber is basically a tonumber cache for maximum efficiency
Lib.isNumber = Lib.isNumber or setmetatable({}, {
__mode = "kv",
__index = function(t, i)
local o = tonumber(i) or false
t[i] = o
return o
end})
local isNumber = Lib.isNumber
-- strlower cache for maximum efficiency
Lib.strlowerCache = Lib.strlowerCache or setmetatable(
{}, {
__index = function(t, i)
if not i then return end
local o
if type(i) == "number" then
o = i
else
o = strlower(i)
end
t[i] = o
return o
end,
}) local strlowerCache = Lib.strlowerCache
-- Matches lowercase player spell names to their spellBookID
Lib.spellsByName_spell = Lib.spellsByName_spell or {}
local spellsByName_spell = Lib.spellsByName_spell
-- Matches player spellIDs to their spellBookID
Lib.spellsByID_spell = Lib.spellsByID_spell or {}
local spellsByID_spell = Lib.spellsByID_spell
-- Matches lowercase pet spell names to their spellBookID
Lib.spellsByName_pet = Lib.spellsByName_pet or {}
local spellsByName_pet = Lib.spellsByName_pet
-- Matches pet spellIDs to their spellBookID
Lib.spellsByID_pet = Lib.spellsByID_pet or {}
local spellsByID_pet = Lib.spellsByID_pet
-- Updates spellsByName and spellsByID
local function UpdateBook(bookType)
local max = 0
for i = 1, GetNumSpellTabs() do
local _, _, offs, numspells, _, specId = GetSpellTabInfo(i)
if specId == 0 then
max = offs + numspells
end
end
local spellsByName = Lib["spellsByName_" .. bookType]
local spellsByID = Lib["spellsByID_" .. bookType]
wipe(spellsByName)
wipe(spellsByID)
for spellBookID = 1, max do
local type, baseSpellID = GetSpellBookItemInfo(spellBookID, bookType)
if type == "SPELL" or type == "PETACTION" then
local currentSpellName = GetSpellBookItemName(spellBookID, bookType)
local link = GetSpellLink(currentSpellName)
local currentSpellID = tonumber(link and link:gsub("|", "||"):match("spell:(%d+)"))
-- For each entry we add to a table,
-- only add it if there isn't anything there already.
-- This prevents weird passives from overwriting real, legit spells.
-- For example, in WoW 7.3.5 the ret paladin mastery
-- was coming back with a base spell named "Judgement",
-- which was overwriting the real "Judgement".
-- Passives usually come last in the spellbook,
-- so this should work just fine as a workaround.
-- This issue with "Judgement" is gone in BFA because the mastery changed.
if currentSpellName and not spellsByName[strlower(currentSpellName)] then
spellsByName[strlower(currentSpellName)] = spellBookID
end
if currentSpellID and not spellsByID[currentSpellID] then
spellsByID[currentSpellID] = spellBookID
end
if type == "SPELL" then
-- PETACTION (pet abilities) don't return a spellID for baseSpellID,
-- so base spells only work for proper player spells.
local baseSpellName = GetSpellInfo(baseSpellID)
if baseSpellName and not spellsByName[strlower(baseSpellName)] then
spellsByName[strlower(baseSpellName)] = spellBookID
end
if baseSpellID and not spellsByID[baseSpellID] then
spellsByID[baseSpellID] = spellBookID
end
end
end
end
end
-- Handles updating spellsByName and spellsByID
if not Lib.updaterFrame then
Lib.updaterFrame = CreateFrame("Frame")
end
Lib.updaterFrame:UnregisterAllEvents()
Lib.updaterFrame:RegisterEvent("SPELLS_CHANGED")
local function UpdateSpells()
UpdateBook("spell")
UpdateBook("pet")
end
Lib.updaterFrame:SetScript("OnEvent", UpdateSpells)
UpdateSpells()
--- Improved spell range checking function.
-- @name SpellRange.IsSpellInRange
-- @paramsig spell, unit
-- @param spell Name or spellID of a spell that you wish to check the range of. The spell must be a spell that you have in your spellbook or your pet's spellbook.
-- @param unit UnitID of the spell that you wish to check the range on.
-- @return Exact same returns as http://wowprogramming.com/docs/api/IsSpellInRange
-- @usage
-- -- Check spell range by spell name on unit "target"
-- local SpellRange = LibStub("SpellRange-1.0")
-- local inRange = SpellRange.IsSpellInRange("Stormstrike", "target")
--
-- -- Check spell range by spellID on unit "mouseover"
-- local SpellRange = LibStub("SpellRange-1.0")
-- local inRange = SpellRange.IsSpellInRange(17364, "mouseover")
function Lib.IsSpellInRange(spellInput, unit)
if isNumber[spellInput] then
local spell = spellsByID_spell[spellInput]
if spell then
return IsSpellInRange(spell, "spell", unit)
else
local spell = spellsByID_pet[spellInput]
if spell then
return IsSpellInRange(spell, "pet", unit)
end
end
else
local spellInput = strlowerCache[spellInput]
local spell = spellsByName_spell[spellInput]
if spell then
return IsSpellInRange(spell, "spell", unit)
else
local spell = spellsByName_pet[spellInput]
if spell then
return IsSpellInRange(spell, "pet", unit)
end
end
return IsSpellInRange(spellInput, unit)
end
end
--- Improved SpellHasRange.
-- @name SpellRange.SpellHasRange
-- @paramsig spell
-- @param spell Name or spellID of a spell that you wish to check for a range. The spell must be a spell that you have in your spellbook or your pet's spellbook.
-- @return Exact same returns as http://wowprogramming.com/docs/api/SpellHasRange
-- @usage
-- -- Check if a spell has a range by spell name
-- local SpellRange = LibStub("SpellRange-1.0")
-- local hasRange = SpellRange.SpellHasRange("Stormstrike")
--
-- -- Check if a spell has a range by spellID
-- local SpellRange = LibStub("SpellRange-1.0")
-- local hasRange = SpellRange.SpellHasRange(17364)
function Lib.SpellHasRange(spellInput)
if isNumber[spellInput] then
local spell = spellsByID_spell[spellInput]
if spell then
return SpellHasRange(spell, "spell")
else
local spell = spellsByID_pet[spellInput]
if spell then
return SpellHasRange(spell, "pet")
end
end
else
local spellInput = strlowerCache[spellInput]
local spell = spellsByName_spell[spellInput]
if spell then
return SpellHasRange(spell, "spell")
else
local spell = spellsByName_pet[spellInput]
if spell then
return SpellHasRange(spell, "pet")
end
end
return SpellHasRange(spellInput)
end
end

View File

@ -0,0 +1,61 @@
# LibSpellRange-1.0
## Background
Blizzard's `IsSpellInRange` API has always been very limited - you either must have the name of the spell,
or its spell book ID. Checking directly by spellID is simply not possible.
Now, since Mists of Pandaria, Blizzard changed the way that many talents and specialization spells work -
instead of giving you a new spell when leaned, they replace existing spells. These replacement spells do
not work with Blizzard's IsSpellInRange function whatsoever; this limitation is what prompted the creation of this lib.
## Usage
**LibSpellRange-1.0** exposes an enhanced version of IsSpellInRange that:
* Allows ranged checking based on both spell name and spellID.
* Works correctly with replacement spells that will not work using Blizzard's IsSpellInRange method alone.
### `SpellRange.IsSpellInRange(spell, unit)` - Improved `IsSpellInRange`
#### Parameters
- `spell` - Name or spellID of a spell that you wish to check the range of. The spell must be a spell that you have in your spellbook or your pet's spellbook.
- `unit` - UnitID of the spell that you wish to check the range on.
#### Return value
Exact same returns as [the built-in `IsSpellInRange`](http://wowprogramming.com/docs/api/IsSpellInRange.html)
#### Usage
``` lua
-- Check spell range by spell name on unit "target"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange("Stormstrike", "target")
-- Check spell range by spellID on unit "mouseover"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange(17364, "mouseover")
```
### `SpellRange.SpellHasRange(spell)` - Improved `SpellHasRange`
#### Parameters
- `spell` - Name or spellID of a spell that you wish to check for a range. The spell must be a spell that you have in your spellbook or your pet's spellbook.
#### Return value
Exact same returns as [the built-in `SpellHasRange`](http://wowprogramming.com/docs/api/SpellHasRange.html)
#### Usage
``` lua
-- Check if a spell has a range by spell name
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange("Stormstrike")
-- Check if a spell has a range by spellID
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange(17364)
```

View File

@ -0,0 +1,3 @@
<Ui>
<Script file="LibSpellRange-1.0.lua"/>
</Ui>

407
Modules/RangeCheck.lua Normal file
View File

@ -0,0 +1,407 @@
local UnitIsConnected = UnitIsConnected
local UnitInPhase = UnitInPhase
local UnitInRaid = UnitInRaid
local UnitInParty = UnitInParty
local UnitInRange = UnitInRange
local CheckInteractDistance = CheckInteractDistance
local C_Timer = C_Timer
local UnitIsUnit = UnitIsUnit
local UnitClass = UnitClass
local GetSpellInfo = GetSpellInfo
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local select, ipairs, type, tonumber, tostring, format = select, ipairs, type, tonumber, tostring, format
local LibStub = LibStub
local Gladdy = LibStub("Gladdy")
local LSR = LibStub("SpellRange-1.0")
local L = Gladdy.L
local classSpells = {
["MAGE"] = 118,
["PRIEST"] = 32379,
["DRUID"] = 33786,
["SHAMAN"] = 10414,
["PALADIN"] = 10308,
["WARLOCK"] = 5782,
["WARRIOR"] = 20252,
["HUNTER"] = 27018,
["ROGUE"] = 36554,
}
local function defaultSpells()
local defaults = {}
for _,class in ipairs(Gladdy.CLASSES) do
defaults[class] = { min = classSpells[class] }
end
return defaults
end
local RangeCheck = Gladdy:NewModule("Range Check", nil, {
rangeCheckEnabled = true,
rangeCheckDefaultSpells = defaultSpells(),
rangeCheckOorFactor = 1.5,
rangeCheckHealthBar = true,
rangeCheckHealthBarText = true,
rangeCheckPowerBar = true,
rangeCheckPowerBarText = true,
rangeCheckClassIcon = false,
rangeCheckTrinket = false,
rangeCheckRacial = false,
})
function RangeCheck:Initialize()
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_STEALTH")
self.playerClass = select(2, UnitClass("player"))
end
function RangeCheck:Reset()
self.test = nil
end
function RangeCheck:ResetUnit(unit)
local button = Gladdy.buttons[unit]
self:CancelTimer(button)
button.lastState = 0
self:SetColor(button, 1)
end
function RangeCheck:Test(unit)
local button = Gladdy.buttons[unit]
if not button then
return
end
self.test = true
button.lastState = 0
if Gladdy.db.rangeCheckEnabled then
if unit == "arena1" then
--button.unit = "target"
--self:CreateTimer(button)
self:SetRangeAlpha(button, nil)
else
self:SetRangeAlpha(button, true)
end
else
self:SetRangeAlpha(button, true)
end
end
function RangeCheck:UpdateFrame(unit)
if self.test then
self:Test(unit)
end
end
function RangeCheck:SetColor(button, oorFac)
if button.lastState == oorFac then
return
end
if not button.classColors then
if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
else
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
end
end
if Gladdy.db.rangeCheckHealthBar then
button.healthBar.hp:SetStatusBarColor(button.classColors.r/oorFac, button.classColors.g/oorFac, button.classColors.b/oorFac, 1)
else
button.healthBar.hp:SetStatusBarColor(button.classColors.r, button.classColors.g, button.classColors.b, 1)
end
if Gladdy.db.rangeCheckHealthBarText then
button.healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r/oorFac, Gladdy.db.healthBarFontColor.g/oorFac, Gladdy.db.healthBarFontColor.b/oorFac, Gladdy.db.healthBarFontColor.a)
button.healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r/oorFac, Gladdy.db.healthBarFontColor.g/oorFac, Gladdy.db.healthBarFontColor.b/oorFac, Gladdy.db.healthBarFontColor.a)
else
button.healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
button.healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
end
if Gladdy.db.rangeCheckPowerBar then
button.powerBar.energy:SetStatusBarColor(button.powerBar.powerColor.r/oorFac, button.powerBar.powerColor.g/oorFac, button.powerBar.powerColor.b/oorFac, 1)
else
button.powerBar.energy:SetStatusBarColor(button.powerBar.powerColor.r, button.powerBar.powerColor.g, button.powerBar.powerColor.b, 1)
end
if Gladdy.db.rangeCheckPowerBarText then
button.powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r/oorFac, Gladdy.db.powerBarFontColor.g/oorFac, Gladdy.db.powerBarFontColor.b/oorFac, Gladdy.db.powerBarFontColor.a)
button.powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r/oorFac, Gladdy.db.powerBarFontColor.g/oorFac, Gladdy.db.powerBarFontColor.b/oorFac, Gladdy.db.powerBarFontColor.a)
else
button.powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
button.powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
end
if Gladdy.db.rangeCheckTrinket then
button.trinket.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.trinket.texture:SetVertexColor(1, 1, 1)
end
if Gladdy.db.rangeCheckClassIcon then
button.classIcon.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
button.aura.icon:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.classIcon.texture:SetVertexColor(1, 1, 1)
button.aura.icon:SetVertexColor(1, 1, 1)
end
if Gladdy.db.rangeCheckRacial then
button.racial.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.racial.texture:SetVertexColor(1, 1, 1)
end
button.lastState = oorFac
end
function RangeCheck:SetRangeAlpha(button, inRange)
local oorFac = Gladdy.db.rangeCheckOorFactor
if inRange then
RangeCheck:SetColor(button, 1)
else
RangeCheck:SetColor(button, oorFac)
end
end
function RangeCheck:JOINED_ARENA()
self.test = nil
if Gladdy.db.rangeCheckEnabled then
for i = 1, Gladdy.curBracket do
local button = Gladdy.buttons["arena"..i]
--if i == 1 then button.unit = "focus" end
self:CreateTimer(button)
end
end
end
function RangeCheck:ENEMY_STEALTH(unit, stealth)
local button = Gladdy.buttons[unit]
if not button then
return
end
button.lastState = 0
if stealth then
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
else
if button.class then
button.healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
end
end
end
function RangeCheck.CheckRange(self)
local button = self.parent
local spell = Gladdy.db.rangeCheckDefaultSpells[RangeCheck.playerClass].min
if( not UnitIsConnected(button.unit) or not UnitInPhase(button.unit) ) then
RangeCheck:SetRangeAlpha(button, false)
elseif( spell ) then
RangeCheck:SetRangeAlpha(button, LSR.IsSpellInRange(spell, button.unit) == 1)
-- That didn't work, but they are grouped lets try the actual API for this, it's a bit flaky though and not that useful generally
elseif( UnitInRaid(button.unit) or UnitInParty(button.unit) ) then
RangeCheck:SetRangeAlpha(button, UnitInRange(button.unit, "player"))
-- Nope, fall back to interaction :(
else
RangeCheck:SetRangeAlpha(button, CheckInteractDistance(button.unit, 4))
end
end
function RangeCheck:CreateTimer(frame)
if not frame.range then
frame.range = C_Timer.NewTicker(0.05, RangeCheck.CheckRange)
frame.range.parent = frame
end
end
function RangeCheck:CancelTimer(frame)
if frame.range then
frame.range:Cancel()
frame.range = nil
end
end
function RangeCheck:ForceUpdate(frame)
if( UnitIsUnit(frame.unit, "player") ) then
frame.healthBar:SetAlpha(1)
frame.powerBar:SetAlpha(1)
self:CancelTimer(frame)
else
self:CreateTimer(frame)
self.CheckRange(frame.parent)
end
end
function RangeCheck:GetOptions()
return {
header = {
type = "header",
name = L["Range Check"],
order = 2,
},
rangeCheckEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
desc = L["Enable racial icon"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = L["General"],
order = 5,
args = {
general = {
type = "group",
name = L["General"],
order = 1,
args = {
header = {
type = "header",
name = L["General"],
order = 1,
},
rangeCheckOorFactor = Gladdy:option({
type = "range",
name = L["Out of Range Darkening Level"],
desc = L["Higher is darker"],
min = 1.1,
max = 5,
step = 0.1,
width = "full",
order = 2,
}),
rangeCheckHealthBar = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Health Bar"],
width = "full",
order = 3,
}),
rangeCheckHealthBarText = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Health Bar Text"],
width = "full",
order = 4,
}),
rangeCheckPowerBar = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Power Bar"],
width = "full",
order = 5,
}),
rangeCheckPowerBarText = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Power Bar Text"],
width = "full",
order = 6,
}),
rangeCheckClassIcon = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Class Icon"],
width = "full",
order = 7,
}),
rangeCheckTrinket = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Trinket"],
width = "full",
order = 8,
}),
rangeCheckRacial = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Racial"],
width = "full",
order = 9,
}),
},
},
},
},
oorSpells = {
type = "group",
childGroups = "tree",
name = L["Spells"],
order = 5,
args = RangeCheck:GetSpells(),
},
}
end
function RangeCheck:GetSpells()
local group = {
description = {
type = "description",
name = "Changing the spellID only applies to your player class!\n\nExample: If you are a Paladin and wish to change your range check spell to Repentance, edit the Paladin spellID to 20066.",
order = 1,
},
}
for i,class in ipairs(Gladdy.CLASSES) do
group[class] = {
type = "group",
name = LOCALIZED_CLASS_NAMES_MALE[class],
order = i + 1,
icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes",
iconCoords = CLASS_ICON_TCOORDS[class],
args = {
headerMin = {
type = "header",
name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
or "nil",
order = 1,
},
min = {
type = "input",
name = "Spell ID", --format("|T%s:20|t %s", select(3, GetSpellInfo(k)), select(1, GetSpellInfo(k)))
order = 2,
width = "full",
pattern = "%d+",
validate = function(_, value)
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
return type(tonumber(value)) == "number"
end,
--image = select(3, GetSpellInfo(defaultSpells()[class].min)),
get = function(_)
return tostring(Gladdy.db.rangeCheckDefaultSpells[class].min)
end,
set = function(_, value)
Gladdy.db.rangeCheckDefaultSpells[class].min = tonumber(value)
--Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.min.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
-- or "nil"
Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.headerMin.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
or "nil"
end
},
--[[headerMax = {
type = "header",
name = L["Max"],
order = 3,
},
max = {
type = "input",
name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)))
or "nil",
order = 4,
width = "full",
pattern = "%d+",
validate = function(_, value)
return type(tonumber(value)) == "number"
end,
--image = select(3, GetSpellInfo(defaultSpells()[class].max)),
get = function(_)
return tostring(Gladdy.db.rangeCheckDefaultSpells[class].max)
end,
set = function(_, value)
Gladdy.db.rangeCheckDefaultSpells[class].max = tonumber(value)
Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.max.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)))
or "nil"
end
}--]]
}
}
end
return group
end

View File

@ -14,4 +14,5 @@
<Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/>
<Include file="libs\DRData-1.0\DRData-1.0.xml"/>
<Include file="libs\LibClassAuras-1.0\lib.xml"/>
<Include file="libs\LibSpellRange-1.0\lib.xml"/>
</Ui>