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.sellPriceThresholds = {
[168446] = 5000 * 100 * 100; -- Accord of Critical Strike
[168447] = 5000 * 100 * 100; -- Accord of Haste
[168448] = 5000 * 100 * 100; -- Accord of Mastery
[168449] = 5000 * 100 * 100; -- Accord of Versatility
[168592] = 4500 * 100 * 100; -- Oceanic Restoration
[168496] = 4500 * 100 * 100; -- Force Multiplier
[168593] = 4500 * 100 * 100; -- Machinist's Brilliance
[168598] = 4500 * 100 * 100; -- Naga Hide
[168446] = 5000 * 100 * 100, -- Accord of Critical Strike
[168447] = 5000 * 100 * 100, -- Accord of Haste
[168448] = 5000 * 100 * 100, -- Accord of Mastery
[168449] = 5000 * 100 * 100, -- Accord of Versatility
[168592] = 4500 * 100 * 100, -- Oceanic Restoration
[168496] = 4500 * 100 * 100, -- Force Multiplier
[168593] = 4500 * 100 * 100, -- Machinist's Brilliance
[168598] = 4500 * 100 * 100, -- Naga Hide
}
aura_env.buyPriceThresholds = {
[152576] = 5 * 100 * 100; -- Tidesrpay Linen
[152877] = 500 * 100 * 100; -- Veiled Crystal
[152576] = 5 * 100 * 100, -- Tidesrpay Linen
[152877] = 500 * 100 * 100, -- Veiled Crystal
}

View File

@@ -38,7 +38,6 @@ aura_env.whitelist = {
["Fresh Meat"] = 1,
["Wood"] = 1,
["Gloom Dust"] = 1,
["Veiled Crytal"] = 1,
["Coalescing Visions"] = 1,
@@ -61,20 +60,35 @@ aura_env.sellWhitelist = {
}
aura_env.toSell = {}
aura_env.getequipID = function(equip)
if equip == "INVTYPE_HEAD" then return 1
elseif equip == "INVTYPE_NECK" then return 2
elseif equip == "INVTYPE_SHOULDER" then return 3
elseif equip == "INVTYPE_BODY" then return 4
elseif equip == "INVTYPE_CHEST" or equip == "INVTYPE_ROBE" then return 5
elseif equip == "INVTYPE_WAIST" then return 6
elseif equip == "INVTYPE_LEGS" then 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
if equip == "INVTYPE_HEAD" then
return 1
elseif equip == "INVTYPE_NECK" then
return 2
elseif equip == "INVTYPE_SHOULDER" then
return 3
elseif equip == "INVTYPE_BODY" then
return 4
elseif equip == "INVTYPE_CHEST" or equip == "INVTYPE_ROBE" then
return 5
elseif equip == "INVTYPE_WAIST" then
return 6
elseif equip == "INVTYPE_LEGS" then
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
aura_env.skills = {
--Warrior

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
aura_env.fn = {}
aura_env.damageHistory = {}
aura_env.historyCurrent = {}
aura_env.playerGUID = UnitGUID("player")
aura_env.playerGUID = UnitGUID "player"
aura_env.lastCleanup = 0
aura_env.historyWindow = 10
aura_env.cleanupInterval = 1
@@ -35,7 +35,7 @@ aura_env.iconz[aura_env.types.BLEED] = 1033474
--
-- 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)
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)
for i = 1, 40 do
if UnitBuff("player", i) == name then
return i
end
if UnitBuff("player", i) == name then return i end
end
return 0
end
aura_env.GetAbsorb = function(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
aura_env.GetAbsorbs = function()

View File

@@ -10,16 +10,18 @@ aura_env.max = 0
aura_env.GetBuff = function(name)
for i = 1, 40 do
if UnitBuff("player", i) == name then
return i
end
if UnitBuff("player", i) == name then return i end
end
return 0
end
aura_env.GetAbsorb = function(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
aura_env.GetAbsorbs = function()