Code format

This commit is contained in:
2025-05-15 19:35:43 +02:00
parent 1d5284bd81
commit ac4de9a0ab
9 changed files with 960 additions and 969 deletions

View File

@@ -1,17 +1,17 @@
aura_env.throttleTime = 10 aura_env.throttleTime = 10
aura_env.sellPriceThresholds = { aura_env.sellPriceThresholds = {
[168446] = 5000 * 100 * 100; -- Accord of Critical Strike [168446] = 5000 * 100 * 100, -- Accord of Critical Strike
[168447] = 5000 * 100 * 100; -- Accord of Haste [168447] = 5000 * 100 * 100, -- Accord of Haste
[168448] = 5000 * 100 * 100; -- Accord of Mastery [168448] = 5000 * 100 * 100, -- Accord of Mastery
[168449] = 5000 * 100 * 100; -- Accord of Versatility [168449] = 5000 * 100 * 100, -- Accord of Versatility
[168592] = 4500 * 100 * 100; -- Oceanic Restoration [168592] = 4500 * 100 * 100, -- Oceanic Restoration
[168496] = 4500 * 100 * 100; -- Force Multiplier [168496] = 4500 * 100 * 100, -- Force Multiplier
[168593] = 4500 * 100 * 100; -- Machinist's Brilliance [168593] = 4500 * 100 * 100, -- Machinist's Brilliance
[168598] = 4500 * 100 * 100; -- Naga Hide [168598] = 4500 * 100 * 100, -- Naga Hide
} }
aura_env.buyPriceThresholds = { aura_env.buyPriceThresholds = {
[152576] = 5 * 100 * 100; -- Tidesrpay Linen [152576] = 5 * 100 * 100, -- Tidesrpay Linen
[152877] = 500 * 100 * 100; -- Veiled Crystal [152877] = 500 * 100 * 100, -- Veiled Crystal
} }

View File

@@ -38,7 +38,6 @@ aura_env.whitelist = {
["Fresh Meat"] = 1, ["Fresh Meat"] = 1,
["Wood"] = 1, ["Wood"] = 1,
["Gloom Dust"] = 1, ["Gloom Dust"] = 1,
["Veiled Crytal"] = 1, ["Veiled Crytal"] = 1,
["Coalescing Visions"] = 1, ["Coalescing Visions"] = 1,
@@ -61,20 +60,35 @@ aura_env.sellWhitelist = {
} }
aura_env.toSell = {} aura_env.toSell = {}
aura_env.getequipID = function(equip) aura_env.getequipID = function(equip)
if equip == "INVTYPE_HEAD" then return 1 if equip == "INVTYPE_HEAD" then
elseif equip == "INVTYPE_NECK" then return 2 return 1
elseif equip == "INVTYPE_SHOULDER" then return 3 elseif equip == "INVTYPE_NECK" then
elseif equip == "INVTYPE_BODY" then return 4 return 2
elseif equip == "INVTYPE_CHEST" or equip == "INVTYPE_ROBE" then return 5 elseif equip == "INVTYPE_SHOULDER" then
elseif equip == "INVTYPE_WAIST" then return 6 return 3
elseif equip == "INVTYPE_LEGS" then return 7 elseif equip == "INVTYPE_BODY" then
elseif equip == "INVTYPE_FEET" then return 8 return 4
elseif equip == "INVTYPE_WRIST" then return 9 elseif equip == "INVTYPE_CHEST" or equip == "INVTYPE_ROBE" then
elseif equip == "INVTYPE_HAND" then return 10 return 5
elseif equip == "INVTYPE_CLOAK" then return 15 elseif equip == "INVTYPE_WAIST" then
elseif equip == "INVTYPE_WEAPON" or equip == "INVTYPE_WEAPONMAINHAND" or equip == "INVTYPE_2HWEAPON" then return 16 return 6
elseif equip == "INVTYPE_SHIELD" then return 17 elseif equip == "INVTYPE_LEGS" then
else return nil end return 7
elseif equip == "INVTYPE_FEET" then
return 8
elseif equip == "INVTYPE_WRIST" then
return 9
elseif equip == "INVTYPE_HAND" then
return 10
elseif equip == "INVTYPE_CLOAK" then
return 15
elseif equip == "INVTYPE_WEAPON" or equip == "INVTYPE_WEAPONMAINHAND" or equip == "INVTYPE_2HWEAPON" then
return 16
elseif equip == "INVTYPE_SHIELD" then
return 17
else
return nil
end
end end
aura_env.skills = { aura_env.skills = {
--Warrior --Warrior

View File

@@ -7,7 +7,7 @@ local function StrSplit(inputString, separator)
end end
local function PrintTable(table) local function PrintTable(table)
for k,v in pairs(table) do for k, v in pairs(table) do
print(k .. " " .. v) print(k .. " " .. v)
end end
end end
@@ -46,11 +46,9 @@ local Unit = {
return o return o
end, end,
GetAuras = function(self, auraFunc, name, type) GetAuras = function(self, auraFunc, name, type) return nil end,
return nil
end,
} }
local BasicUnit = Unit:New("player") local BasicUnit = Unit:New "player"
function BasicUnit:GetAuras(auraFunc, name) function BasicUnit:GetAuras(auraFunc, name)
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(self.unit, name) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(self.unit, name)
if aura ~= nil then if aura ~= nil then
@@ -60,14 +58,14 @@ function BasicUnit:GetAuras(auraFunc, name)
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} },
} }
else else
return {} return {}
end end
end end
-- Maybe implement some sort of throttle to group unit? -- Maybe implement some sort of throttle to group unit?
local GroupUnit = Unit:New("group") local GroupUnit = Unit:New "group"
function GroupUnit:GetAuras(auraFunc, name) function GroupUnit:GetAuras(auraFunc, name)
local raidMem = GetNumRaidMembers() local raidMem = GetNumRaidMembers()
local num = GetNumPartyMembers() local num = GetNumPartyMembers()
@@ -92,7 +90,7 @@ function GroupUnit:GetAuras(auraFunc, name)
if unitPrefix == "party" then if unitPrefix == "party" then
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", name) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", name)
if aura ~= nil then if aura ~= nil then
auras[UnitName("player")] = { auras[UnitName "player"] = {
["duration"] = duration, ["duration"] = duration,
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
@@ -104,7 +102,7 @@ function GroupUnit:GetAuras(auraFunc, name)
return auras return auras
end end
-- Nameplate does not work, find out why? -- Nameplate does not work, find out why?
local NameplateUnit = Unit:New("nameplate") local NameplateUnit = Unit:New "nameplate"
function NameplateUnit:GetAuras(auraFunc, name) function NameplateUnit:GetAuras(auraFunc, name)
local unitPrefix = "nameplate" local unitPrefix = "nameplate"
auras = {} auras = {}
@@ -158,7 +156,7 @@ local Aura = {
end, end,
IsActive = function(self) IsActive = function(self)
for k,v in pairs(self.unit:GetAuras(self.GetAura, self.name)) do for k, v in pairs(self.unit:GetAuras(self.GetAura, self.name)) do
for k2, v2 in pairs(v) do for k2, v2 in pairs(v) do
end end
return true return true
@@ -166,15 +164,13 @@ local Aura = {
return false return false
end, end,
IsOnCooldown = function(self) IsOnCooldown = function(self)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
return GetSpellCooldown(self.name) > 0 return GetSpellCooldown(self.name) > 0
end, end,
AddAsAura = function(self, allstates) AddAsAura = function(self, allstates)
local auras = self.unit:GetAuras(self.GetAura, self.name) local auras = self.unit:GetAuras(self.GetAura, self.name)
for k,v in pairs(auras) do for k, v in pairs(auras) do
duration = v.duration duration = v.duration
expirationTime = v.expirationTime expirationTime = v.expirationTime
icon = self:GetAuraIcon(v.spellID) icon = self:GetAuraIcon(v.spellID)
@@ -197,9 +193,7 @@ local Aura = {
end end
end, end,
AddAsCooldown = function(self, allstates) AddAsCooldown = function(self, allstates)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
startTime, duration = GetSpellCooldown(self.name) startTime, duration = GetSpellCooldown(self.name)
icon = self:GetSpellIcon() icon = self:GetSpellIcon()
allstates[self.name] = { allstates[self.name] = {
@@ -217,9 +211,7 @@ local Aura = {
} }
end, end,
AddAsIcon = function(self, allstates) AddAsIcon = function(self, allstates)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
icon = self:GetSpellIcon() icon = self:GetSpellIcon()
allstates[self.name] = { allstates[self.name] = {
changed = true, changed = true,
@@ -236,12 +228,8 @@ local Aura = {
} }
end, end,
GetSpellIcon = function(self) GetSpellIcon = function(self) return select(3, GetSpellInfo(self.name)) end,
return select(3, GetSpellInfo(self.name)) GetAuraIcon = function(self, spellID) return select(3, GetSpellInfo(spellID)) end,
end,
GetAuraIcon = function(self, spellID)
return select(3, GetSpellInfo(spellID))
end,
} }
local Entry = { local Entry = {
@@ -272,9 +260,7 @@ local Entry = {
ReadEntryData = function(self, entryData, index) ReadEntryData = function(self, entryData, index)
local str = entryData[index] local str = entryData[index]
if str == nil then if str == nil then return nil end
return nil
end
str = self:TrimWhitespace(str) str = self:TrimWhitespace(str)
return str return str
end, end,

View File

@@ -7,7 +7,7 @@ local function StrSplit(inputString, separator)
end end
local function PrintTable(table) local function PrintTable(table)
for k,v in pairs(table) do for k, v in pairs(table) do
print(k .. " " .. v) print(k .. " " .. v)
end end
end end
@@ -55,11 +55,9 @@ local Unit = {
return o return o
end, end,
GetAuras = function(self, auraFunc, name, type) GetAuras = function(self, auraFunc, name, type) return nil end,
return nil
end,
} }
local BasicUnit = Unit:New("player") local BasicUnit = Unit:New "player"
function BasicUnit:GetAuras(auraFunc, name) function BasicUnit:GetAuras(auraFunc, name)
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(self.unit, name) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(self.unit, name)
if aura ~= nil then if aura ~= nil then
@@ -69,26 +67,25 @@ function BasicUnit:GetAuras(auraFunc, name)
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} },
} }
else else
return {} return {}
end end
end end
-- Maybe implement some sort of throttle to group unit? -- Maybe implement some sort of throttle to group unit?
local GroupUnit = Unit:New("group") local GroupUnit = Unit:New "group"
function GroupUnit:GetAuras(auraFunc, name) function GroupUnit:GetAuras(auraFunc, name)
local num = GetNumGroupMembers() local num = GetNumGroupMembers()
local unitPrefix = "party" local unitPrefix = "party"
if IsInRaid() then if IsInRaid() then unitPrefix = "raid" end
unitPrefix = "raid"
end
auras = {} auras = {}
for i = 1, num do for i = 1, num do
-- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name) -- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name)
local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name) local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name)
if auraIndex > 0 then if auraIndex > 0 then
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, auraIndex) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID =
auraFunc(unitPrefix .. i, auraIndex)
auras[UnitName(unitPrefix .. i)] = { auras[UnitName(unitPrefix .. i)] = {
["duration"] = duration, ["duration"] = duration,
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
@@ -100,9 +97,10 @@ function GroupUnit:GetAuras(auraFunc, name)
end end
if unitPrefix == "party" then if unitPrefix == "party" then
-- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", name) -- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", name)
local auraIndex = GetAuraIndex(auraFunc, "player", name)if auraIndex > 0 then local auraIndex = GetAuraIndex(auraFunc, "player", name)
if auraIndex > 0 then
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex)
auras[UnitName("player")] = { auras[UnitName "player"] = {
["duration"] = duration, ["duration"] = duration,
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
@@ -114,13 +112,14 @@ function GroupUnit:GetAuras(auraFunc, name)
return auras return auras
end end
-- Nameplate does not work, find out why? -- Nameplate does not work, find out why?
local NameplateUnit = Unit:New("nameplate") local NameplateUnit = Unit:New "nameplate"
function NameplateUnit:GetAuras(auraFunc, name) function NameplateUnit:GetAuras(auraFunc, name)
local unitPrefix = "nameplate" local unitPrefix = "nameplate"
auras = {} auras = {}
for i = 1, 40 do for i = 1, 40 do
-- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name) -- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name)
local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name)if auraIndex > 0 then local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name)
if auraIndex > 0 then
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex)
auras[UnitName(unitPrefix .. i)] = { auras[UnitName(unitPrefix .. i)] = {
["duration"] = duration, ["duration"] = duration,
@@ -169,21 +168,19 @@ local Aura = {
end, end,
IsActive = function(self) IsActive = function(self)
for k,v in pairs(self.unit:GetAuras(self.GetAura, self.name)) do for k, v in pairs(self.unit:GetAuras(self.GetAura, self.name)) do
return true return true
end end
return false return false
end, end,
IsOnCooldown = function(self) IsOnCooldown = function(self)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
return GetSpellCooldown(self.name) > 0 return GetSpellCooldown(self.name) > 0
end, end,
AddAsAura = function(self, allstates) AddAsAura = function(self, allstates)
local auras = self.unit:GetAuras(self.GetAura, self.name) local auras = self.unit:GetAuras(self.GetAura, self.name)
for k,v in pairs(auras) do for k, v in pairs(auras) do
duration = v.duration duration = v.duration
expirationTime = v.expirationTime expirationTime = v.expirationTime
icon = self:GetAuraIcon(v.spellID) icon = self:GetAuraIcon(v.spellID)
@@ -206,9 +203,7 @@ local Aura = {
end end
end, end,
AddAsCooldown = function(self, allstates) AddAsCooldown = function(self, allstates)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
startTime, duration = GetSpellCooldown(self.name) startTime, duration = GetSpellCooldown(self.name)
icon = self:GetSpellIcon() icon = self:GetSpellIcon()
allstates[self.name] = { allstates[self.name] = {
@@ -226,9 +221,7 @@ local Aura = {
} }
end, end,
AddAsIcon = function(self, allstates) AddAsIcon = function(self, allstates)
if not self.hasCooldown then if not self.hasCooldown then return false end
return false
end
icon = self:GetSpellIcon() icon = self:GetSpellIcon()
allstates[self.name] = { allstates[self.name] = {
changed = true, changed = true,
@@ -245,12 +238,8 @@ local Aura = {
} }
end, end,
GetSpellIcon = function(self) GetSpellIcon = function(self) return select(3, GetSpellInfo(self.name)) end,
return select(3, GetSpellInfo(self.name)) GetAuraIcon = function(self, spellID) return select(3, GetSpellInfo(spellID)) end,
end,
GetAuraIcon = function(self, spellID)
return select(3, GetSpellInfo(spellID))
end,
} }
local Entry = { local Entry = {
@@ -281,9 +270,7 @@ local Entry = {
ReadEntryData = function(self, entryData, index) ReadEntryData = function(self, entryData, index)
local str = entryData[index] local str = entryData[index]
if str == nil then if str == nil then return nil end
return nil
end
str = self:TrimWhitespace(str) str = self:TrimWhitespace(str)
return str return str
end, end,

View File

@@ -2,7 +2,7 @@
aura_env.fn = {} aura_env.fn = {}
aura_env.damageHistory = {} aura_env.damageHistory = {}
aura_env.historyCurrent = {} aura_env.historyCurrent = {}
aura_env.playerGUID = UnitGUID("player") aura_env.playerGUID = UnitGUID "player"
aura_env.lastCleanup = 0 aura_env.lastCleanup = 0
aura_env.historyWindow = 10 aura_env.historyWindow = 10
aura_env.cleanupInterval = 1 aura_env.cleanupInterval = 1
@@ -35,7 +35,7 @@ aura_env.iconz[aura_env.types.BLEED] = 1033474
-- --
-- Returns players current max health -- Returns players current max health
-- --
aura_env.fn.getMaxHealth = function() return UnitHealthMax("player") end aura_env.fn.getMaxHealth = function() return UnitHealthMax "player" end
aura_env.fn.isEnabled = function(damageType) aura_env.fn.isEnabled = function(damageType)
local enabled = damageType == aura_env.types.SWING and aura_env.config.enableSwing local enabled = damageType == aura_env.types.SWING and aura_env.config.enableSwing

View File

@@ -6,16 +6,18 @@ aura_env.max = 0
aura_env.GetBuff = function(name) aura_env.GetBuff = function(name)
for i = 1, 40 do for i = 1, 40 do
if UnitBuff("player", i) == name then if UnitBuff("player", i) == name then return i end
return i
end
end end
return 0 return 0
end end
aura_env.GetAbsorb = function(name) aura_env.GetAbsorb = function(name)
local temp = select(16, UnitBuff("player", aura_env.GetBuff(name))) local temp = select(16, UnitBuff("player", aura_env.GetBuff(name)))
if temp then return temp else return 0 end if temp then
return temp
else
return 0
end
end end
aura_env.GetAbsorbs = function() aura_env.GetAbsorbs = function()

View File

@@ -10,16 +10,18 @@ aura_env.max = 0
aura_env.GetBuff = function(name) aura_env.GetBuff = function(name)
for i = 1, 40 do for i = 1, 40 do
if UnitBuff("player", i) == name then if UnitBuff("player", i) == name then return i end
return i
end
end end
return 0 return 0
end end
aura_env.GetAbsorb = function(name) aura_env.GetAbsorb = function(name)
local temp = select(16, UnitBuff("player", aura_env.GetBuff(name))) local temp = select(16, UnitBuff("player", aura_env.GetBuff(name)))
if temp then return temp else return 0 end if temp then
return temp
else
return 0
end
end end
aura_env.GetAbsorbs = function() aura_env.GetAbsorbs = function()