optimize and randomize DR and Aura test mode
This commit is contained in:
parent
51cd2b7311
commit
8a17592842
@ -272,57 +272,58 @@ function Auras:Test(unit)
|
||||
self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
|
||||
|
||||
--Auras
|
||||
local enabledAuras = 0
|
||||
for _,value in pairs(Gladdy.db.auraListDefault) do
|
||||
if value.enabled then
|
||||
enabledAuras = enabledAuras + 1
|
||||
end
|
||||
end
|
||||
if enabledAuras > 0 then
|
||||
limit, i = rand(1, enabledAuras), 1
|
||||
local enabledDebuffs, enabledBuffs, testauras = {}, {}
|
||||
for spellIdStr,value in pairs(Gladdy.db.auraListDefault) do
|
||||
if i > limit then break end
|
||||
if value.enabled then
|
||||
spellid = tonumber(spellIdStr)
|
||||
spellName = select(1, GetSpellInfo(tonumber(spellIdStr)))
|
||||
icon = select(3, GetSpellInfo(tonumber(spellIdStr)))
|
||||
if value.track == AURA_TYPE_BUFF then
|
||||
tinsert(enabledBuffs, {value = value, spellIdStr = spellIdStr})
|
||||
else
|
||||
tinsert(enabledDebuffs, {value = value, spellIdStr = spellIdStr})
|
||||
end
|
||||
end
|
||||
end
|
||||
if unit == "arena2" then
|
||||
testauras = enabledBuffs
|
||||
else
|
||||
testauras = enabledDebuffs
|
||||
end
|
||||
|
||||
if #testauras > 0 then
|
||||
limit = rand(1, #testauras)
|
||||
local v = testauras[rand(1, #testauras)]
|
||||
spellid = tonumber(v.spellIdStr)
|
||||
spellName = select(1, GetSpellInfo(tonumber(v.spellIdStr)))
|
||||
icon = select(3, GetSpellInfo(tonumber(v.spellIdStr)))
|
||||
if Gladdy.exceptionNames[spellid] then
|
||||
spellName = Gladdy.exceptionNames[spellid]
|
||||
end
|
||||
self:AURA_GAIN(unit,value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
|
||||
i = i + 1
|
||||
if (unit == "arena2") then
|
||||
if (v.value.track == AURA_TYPE_BUFF) then
|
||||
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
|
||||
end
|
||||
else
|
||||
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
|
||||
end
|
||||
end
|
||||
|
||||
--Interrupts
|
||||
if (unit == "arena1" or unit == "arena3") then
|
||||
local enabledInterrupts = {}
|
||||
local spellSchools = {}
|
||||
for k,_ in pairs(Gladdy:GetSpellSchoolColors()) do
|
||||
tinsert(spellSchools, k)
|
||||
end
|
||||
enabledAuras = 0
|
||||
for _, value in pairs(Gladdy.db.auraListInterrupts) do
|
||||
if value.enabled then
|
||||
enabledAuras = enabledAuras + 1
|
||||
end
|
||||
end
|
||||
if enabledAuras > 0 then
|
||||
limit, i = rand(1, enabledAuras), 1
|
||||
local extraSpellSchool
|
||||
for spellIdStr, value in pairs(Gladdy.db.auraListInterrupts) do
|
||||
if i > limit then break end
|
||||
if value.enabled then
|
||||
enabledAuras = enabledAuras + 1
|
||||
tinsert(enabledInterrupts, spellIdStr)
|
||||
end
|
||||
spellid = tonumber(spellIdStr)
|
||||
if (unit == "arena1" or unit == "arena2") then
|
||||
extraSpellSchool = spellSchools[rand(1, #spellSchools)]
|
||||
end
|
||||
if #enabledInterrupts > 0 then
|
||||
local extraSpellSchool = spellSchools[rand(1, #spellSchools)]
|
||||
spellid = tonumber(enabledInterrupts[rand(1, #enabledInterrupts)])
|
||||
spellName = select(1, GetSpellInfo(spellid))
|
||||
Gladdy:Print(spellName, extraSpellSchool)
|
||||
self:SPELL_INTERRUPT(unit,spellid, spellName, "physical", spellid, spellName, extraSpellSchool)
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -257,17 +257,32 @@ end
|
||||
|
||||
function Diminishings:Test(unit)
|
||||
if Gladdy.db.drEnabled then
|
||||
local limit = {}
|
||||
for spellID,category in pairs(DRData:GetSpells()) do
|
||||
if Gladdy.db.drCategories[category].enabled then
|
||||
if not limit[category] then
|
||||
limit[category] = { count = 1, limit = rand(1,3) }
|
||||
else
|
||||
limit[category].count = limit[category].count + 1
|
||||
local enabledCategories = {}
|
||||
for cat,val in pairs(Gladdy.db.drCategories) do
|
||||
if (val.enabled) then
|
||||
tinsert(enabledCategories, {cat = cat , spellIDs = {}})
|
||||
enabledCategories[cat] = #enabledCategories
|
||||
end
|
||||
if limit[category].count <= limit[category].limit then
|
||||
self:AuraFade(unit, spellID)
|
||||
end
|
||||
for spellId,cat in pairs(DRData:GetSpells()) do
|
||||
if enabledCategories[cat] then
|
||||
tinsert(enabledCategories[enabledCategories[cat]].spellIDs, spellId)
|
||||
end
|
||||
end
|
||||
|
||||
--shuffle
|
||||
for i = #enabledCategories, 2, -1 do
|
||||
local j = rand(i)
|
||||
enabledCategories[i], enabledCategories[j] = enabledCategories[j], enabledCategories[i]
|
||||
end
|
||||
|
||||
--execute test
|
||||
local index, amount = 0,0
|
||||
for i=1, (#enabledCategories < 4 and #enabledCategories) or 4 do
|
||||
amount = rand(1,3)
|
||||
index = rand(1, #enabledCategories[i].spellIDs)
|
||||
for _=1, amount do
|
||||
self:AuraFade(unit, enabledCategories[i].spellIDs[index])
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -294,6 +309,7 @@ function Diminishings:AuraFade(unit, spellID)
|
||||
lastIcon.diminishing = 1.0
|
||||
end
|
||||
end
|
||||
if not lastIcon then return end
|
||||
lastIcon.dr = drCat
|
||||
lastIcon.timeLeft = Gladdy.db.drDuration
|
||||
lastIcon.diminishing = DRData:NextDR(lastIcon.diminishing)
|
||||
|
Loading…
Reference in New Issue
Block a user