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

@@ -1,26 +1,26 @@
aura_env.debug = true aura_env.debug = true
aura_env.filter = { aura_env.filter = {
[1] = true, --Gold [1] = true, --Gold
[2] = true, --Azerite [2] = true, --Azerite
[3] = true, --War resources [3] = true, --War resources
[4] = true, --Residuum [4] = true, --Residuum
[5] = true, --Manapearls [5] = true, --Manapearls
[6] = true, --Mounts [6] = true, --Mounts
[7] = true, --High ilvl [7] = true, --High ilvl
[8] = false, --Herbs [8] = false, --Herbs
[9] = true, --Cooking [9] = true, --Cooking
[10] = true, --Cloth [10] = true, --Cloth
[11] = false, --Metal & Stone [11] = false, --Metal & Stone
[12] = true, --Gold filter greys [12] = true, --Gold filter greys
[13] = true, -- >1 && <4 quality items, no gear [13] = true, -- >1 && <4 quality items, no gear
[14] = true, --Quest items [14] = true, --Quest items
[15] = true, --All greys [15] = true, --All greys
[16] = true, --Whitelist [16] = true, --Whitelist
[17] = true, --Quest items (different filter) [17] = true, --Quest items (different filter)
[18] = true, --Class aproperiate >2 items [18] = true, --Class aproperiate >2 items
[19] = true, --Jewelery >2 quality [19] = true, --Jewelery >2 quality
[20] = true, --Additional mount filter [20] = true, --Additional mount filter
[21] = true, --Tradeskill // Elemental [21] = true, --Tradeskill // Elemental
} }
aura_env.ilvlFilter = 200 aura_env.ilvlFilter = 200
aura_env.goldFilter = 0.5 aura_env.goldFilter = 0.5
@@ -28,353 +28,367 @@ aura_env.goldFilter = aura_env.goldFilter * 10000
aura_env.throttleSell = false aura_env.throttleSell = false
aura_env.whitelist = { aura_env.whitelist = {
["Pygmy Suckerfish"] = 1, ["Pygmy Suckerfish"] = 1,
["Drakkari Offerings"] = 1, ["Drakkari Offerings"] = 1,
["Deepcoral Pod"] = 1, ["Deepcoral Pod"] = 1,
["Hardened Spring"] = 1, ["Hardened Spring"] = 1,
["Machined Gear Assembly"] = 1, ["Machined Gear Assembly"] = 1,
["Tempered Plating"] = 1, ["Tempered Plating"] = 1,
["Hefty Glimmershell"] = 1, ["Hefty Glimmershell"] = 1,
["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, ["Echoes of Ny'alotha"] = 1,
["Echoes of Ny'alotha"] = 1, ["Corrupted Mementos"] = 1,
["Corrupted Mementos"] = 1,
["Blood of Sargeras"] = 1,
["Blood of Sargeras"] = 1, ["Primal Sargerite"] = 1,
["Primal Sargerite"] = 1,
["Chain Ignitercoil"] = 1,
["Chain Ignitercoil"] = 1, ["Galvanic Oscillator"] = 1,
["Galvanic Oscillator"] = 1, ["Corrupted Memento"] = 1,
["Corrupted Memento"] = 1,
} }
aura_env.sellWhitelist = { aura_env.sellWhitelist = {
["Blacksmith Hammer"] = 1, ["Blacksmith Hammer"] = 1,
["Endless Tincture of Renewed Combat"] = 1, ["Endless Tincture of Renewed Combat"] = 1,
["Mr. Munchykins"] = 1, ["Mr. Munchykins"] = 1,
["Arclight Spanner"] = 1, ["Arclight Spanner"] = 1,
["Runeblade of Baron Rivendare"] = 1, ["Runeblade of Baron Rivendare"] = 1,
} }
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
[1] = { [1] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 1, ["Plate"] = 1,
["Shields"] = 1, ["Shields"] = 1,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 1, ["Two-Handed Axes"] = 1,
["Bows"] = 1, ["Bows"] = 1,
["Guns"] = 1, ["Guns"] = 1,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 1, ["Two-Handed Maces"] = 1,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 1, ["Two-Handed Swords"] = 1,
["Warglaives"] = 1, ["Warglaives"] = 1,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 1, ["Crossbows"] = 1,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Paladin --Paladin
[2] = { [2] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 1, ["Plate"] = 1,
["Shields"] = 1, ["Shields"] = 1,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 1, ["Two-Handed Axes"] = 1,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 1, ["Two-Handed Maces"] = 1,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 1, ["Two-Handed Swords"] = 1,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 0, ["Staves"] = 0,
["Fist Weapons"] = 0, ["Fist Weapons"] = 0,
["Daggers"] = 0, ["Daggers"] = 0,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Hunter --Hunter
[3] = { [3] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 1, ["Mail"] = 1,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 1, ["Two-Handed Axes"] = 1,
["Bows"] = 1, ["Bows"] = 1,
["Guns"] = 1, ["Guns"] = 1,
["One-Handed Maces"] = 0, ["One-Handed Maces"] = 0,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 1, ["Two-Handed Swords"] = 1,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 1, ["Crossbows"] = 1,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Rogue --Rogue
[4] = { [4] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 1, ["Leather"] = 1,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 0, ["Staves"] = 0,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Priest --Priest
[5] = { [5] = {
--Armor Skills --Armor Skills
["Cloth"] = 1, ["Cloth"] = 1,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 0, ["One-Handed Axes"] = 0,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 0, ["One-Handed Swords"] = 0,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 0, ["Fist Weapons"] = 0,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 1, ["Wands"] = 1,
}, },
--Death Knight --Death Knight
[6] = { [6] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 1, ["Plate"] = 1,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 1, ["Two-Handed Axes"] = 1,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 1, ["Two-Handed Maces"] = 1,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 1, ["Two-Handed Swords"] = 1,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 0, ["Staves"] = 0,
["Fist Weapons"] = 0, ["Fist Weapons"] = 0,
["Daggers"] = 0, ["Daggers"] = 0,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Shaman --Shaman
[7] = { [7] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 1, ["Mail"] = 1,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 1, ["Shields"] = 1,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 0, ["One-Handed Swords"] = 0,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Mage --Mage
[8] = { [8] = {
--Armor Skills --Armor Skills
["Cloth"] = 1, ["Cloth"] = 1,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 0, ["One-Handed Axes"] = 0,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 0, ["One-Handed Maces"] = 0,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 0, ["Fist Weapons"] = 0,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 1, ["Wands"] = 1,
}, },
--Warlock --Warlock
[9] = { [9] = {
--Armor Skills --Armor Skills
["Cloth"] = 1, ["Cloth"] = 1,
["Leather"] = 0, ["Leather"] = 0,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 0, ["One-Handed Axes"] = 0,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 0, ["One-Handed Maces"] = 0,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 0, ["Fist Weapons"] = 0,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 1, ["Wands"] = 1,
}, },
--Monk --Monk
[10] = { [10] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 1, ["Leather"] = 1,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 1, ["Plate"] = 1,
["Shields"] = 1, ["Shields"] = 1,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 0, ["Daggers"] = 0,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Druid --Druid
[11] = { [11] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 1, ["Leather"] = 1,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 0, ["One-Handed Axes"] = 0,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 1, ["One-Handed Maces"] = 1,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 1, ["Polearms"] = 1,
["One-Handed Swords"] = 0, ["One-Handed Swords"] = 0,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 0, ["Warglaives"] = 0,
["Staves"] = 1, ["Staves"] = 1,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 1, ["Daggers"] = 1,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
--Demon Hunter --Demon Hunter
[12] = { [12] = {
--Armor Skills --Armor Skills
["Cloth"] = 0, ["Cloth"] = 0,
["Leather"] = 1, ["Leather"] = 1,
["Mail"] = 0, ["Mail"] = 0,
["Plate"] = 0, ["Plate"] = 0,
["Shields"] = 0, ["Shields"] = 0,
--Weapon Skills --Weapon Skills
["One-Handed Axes"] = 1, ["One-Handed Axes"] = 1,
["Two-Handed Axes"] = 0, ["Two-Handed Axes"] = 0,
["Bows"] = 0, ["Bows"] = 0,
["Guns"] = 0, ["Guns"] = 0,
["One-Handed Maces"] = 0, ["One-Handed Maces"] = 0,
["Two-Handed Maces"] = 0, ["Two-Handed Maces"] = 0,
["Polearms"] = 0, ["Polearms"] = 0,
["One-Handed Swords"] = 1, ["One-Handed Swords"] = 1,
["Two-Handed Swords"] = 0, ["Two-Handed Swords"] = 0,
["Warglaives"] = 1, ["Warglaives"] = 1,
["Staves"] = 0, ["Staves"] = 0,
["Fist Weapons"] = 1, ["Fist Weapons"] = 1,
["Daggers"] = 0, ["Daggers"] = 0,
["Crossbows"] = 0, ["Crossbows"] = 0,
["Wands"] = 0, ["Wands"] = 0,
}, },
} }

View File

@@ -1,308 +1,294 @@
local function StrSplit(inputString, separator) local function StrSplit(inputString, separator)
local outputTable = {} local outputTable = {}
for str in string.gmatch(inputString, "([^" .. separator .. "]+)") do for str in string.gmatch(inputString, "([^" .. separator .. "]+)") do
outputTable[#outputTable + 1] = str outputTable[#outputTable + 1] = str
end end
return outputTable return outputTable
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
aura_env.GetClassColor = function(class) aura_env.GetClassColor = function(class)
if class == "Death Knight" then if class == "Death Knight" then
return "\124cFFC41E3A" return "\124cFFC41E3A"
elseif class == "Druid" then elseif class == "Druid" then
return "\124cFFFF7C0A" return "\124cFFFF7C0A"
elseif class == "Hunter" then elseif class == "Hunter" then
return "\124cFFAAD372" return "\124cFFAAD372"
elseif class == "Mage" then elseif class == "Mage" then
return "\124cFF3FC7EB" return "\124cFF3FC7EB"
elseif class == "Paladin" then elseif class == "Paladin" then
return "\124cFFF48CBA" return "\124cFFF48CBA"
elseif class == "Priest" then elseif class == "Priest" then
return "\124cFFFFFFFF" return "\124cFFFFFFFF"
elseif class == "Rogue" then elseif class == "Rogue" then
return "\124cFFFFF468" return "\124cFFFFF468"
elseif class == "Shaman" then elseif class == "Shaman" then
return "\124cFF0070DD" return "\124cFF0070DD"
elseif class == "Warlock" then elseif class == "Warlock" then
return "\124cFF8788EE" return "\124cFF8788EE"
elseif class == "Warrior" then elseif class == "Warrior" then
return "\124cFFC69B6D" return "\124cFFC69B6D"
end end
end end
local Unit = { local Unit = {
New = function(self, unit) New = function(self, unit)
o = { o = {
["unit"] = unit, ["unit"] = unit,
} }
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
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
return { return {
[UnitName(self.unit)] = { [UnitName(self.unit)] = {
["duration"] = duration, ["duration"] = duration,
["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()
local unitPrefix = "party" local unitPrefix = "party"
if raidMem > num then if raidMem > num then
unitPrefix = "raid" unitPrefix = "raid"
num = raidMem num = raidMem
end 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)
if aura ~= nil then if aura ~= nil then
auras[UnitName(unitPrefix .. i)] = { auras[UnitName(unitPrefix .. i)] = {
["duration"] = duration, ["duration"] = duration,
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
["class"] = UnitClass(unitPrefix .. i) or "Paladin", ["class"] = UnitClass(unitPrefix .. i) or "Paladin",
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} }
end end
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)
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,
["class"] = UnitClass(unitPrefix .. i) or "Paladin", ["class"] = UnitClass(unitPrefix .. i) or "Paladin",
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} }
end end
end end
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(auraPrefix .. i, name) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(auraPrefix .. i, name)
if aura ~= nil then if aura ~= nil then
auras[UnitName(unitPrefix .. i)] = { auras[UnitName(unitPrefix .. i)] = {
["duration"] = duration, ["duration"] = duration,
["expirationTime"] = expirationTime, ["expirationTime"] = expirationTime,
["spellID"] = spellID, ["spellID"] = spellID,
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} }
end end
end end
return auras return auras
end end
local UnitFactory = { local UnitFactory = {
New = function(self) New = function(self)
o = {} o = {}
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
return o return o
end, end,
CreateUnit = function(self, target) CreateUnit = function(self, target)
target = string.lower(target) target = string.lower(target)
if target == "player" or target == "target" or target == "focus" then if target == "player" or target == "target" or target == "focus" then
return BasicUnit:New(target) return BasicUnit:New(target)
elseif target == "group" then elseif target == "group" then
return GroupUnit:New(target) return GroupUnit:New(target)
elseif target == "nameplate" then elseif target == "nameplate" then
return NameplateUnit:New(target) return NameplateUnit:New(target)
end end
end, end,
} }
local unitFactory = UnitFactory:New() local unitFactory = UnitFactory:New()
local Aura = { local Aura = {
New = function(self, entry, index) New = function(self, entry, index)
o = { o = {
["name"] = entry.auraName, ["name"] = entry.auraName,
["unit"] = entry.target, ["unit"] = entry.target,
["hasCooldown"] = entry.hasCooldown, ["hasCooldown"] = entry.hasCooldown,
["index"] = index, ["index"] = index,
["GetAura"] = entry.GetAura, ["GetAura"] = entry.GetAura,
} }
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
return o return o
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
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 return GetSpellCooldown(self.name) > 0
end end,
return GetSpellCooldown(self.name) > 0
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)
allstates[self.name .. k] = { allstates[self.name .. k] = {
changed = true, changed = true,
show = true, show = true,
resort = true, resort = true,
progressType = "timed", progressType = "timed",
duration = duration, duration = duration,
expirationTime = expirationTime, expirationTime = expirationTime,
index = self.index, index = self.index,
icon = icon, icon = icon,
pname = k, pname = k,
stacks = v.stacks, stacks = v.stacks,
pclass = v.class, pclass = v.class,
IsOnCooldown = true, IsOnCooldown = true,
IsActive = true, IsActive = true,
IsBad = self.GetAura == UnitDebuff, IsBad = self.GetAura == UnitDebuff,
} }
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 startTime, duration = GetSpellCooldown(self.name)
end icon = self:GetSpellIcon()
startTime, duration = GetSpellCooldown(self.name) allstates[self.name] = {
icon = self:GetSpellIcon() changed = true,
allstates[self.name] = { show = true,
changed = true, resort = true,
show = true, progressType = "timed",
resort = true, duration = duration,
progressType = "timed", expirationTime = startTime + duration,
duration = duration, index = self.index,
expirationTime = startTime + duration, icon = icon,
index = self.index, IsOnCooldown = true,
icon = icon, IsActive = false,
IsOnCooldown = true, IsBad = self.GetAura == UnitDebuff,
IsActive = false, }
IsBad = self.GetAura == UnitDebuff, end,
} AddAsIcon = function(self, allstates)
end, if not self.hasCooldown then return false end
AddAsIcon = function(self, allstates) icon = self:GetSpellIcon()
if not self.hasCooldown then allstates[self.name] = {
return false changed = true,
end show = true,
icon = self:GetSpellIcon() resort = true,
allstates[self.name] = { progressType = "static",
changed = true, value = 1,
show = true, total = 1,
resort = true, index = self.index,
progressType = "static", icon = icon,
value = 1, IsOnCooldown = false,
total = 1, IsActive = false,
index = self.index, IsBad = self.GetAura == UnitDebuff,
icon = icon, }
IsOnCooldown = false, end,
IsActive = false,
IsBad = self.GetAura == UnitDebuff,
}
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 = {
New = function(self, entry) New = function(self, entry)
entry = self:TrimWhitespace(entry) entry = self:TrimWhitespace(entry)
local entryData = StrSplit(entry, ",") local entryData = StrSplit(entry, ",")
local name = self:ReadEntryData(entryData, 1) local name = self:ReadEntryData(entryData, 1)
local type = self:ReadEntryData(entryData, 2) or "Buff" local type = self:ReadEntryData(entryData, 2) or "Buff"
local target = unitFactory:CreateUnit(self:ReadEntryData(entryData, 3) or "Player") local target = unitFactory:CreateUnit(self:ReadEntryData(entryData, 3) or "Player")
local cooldown = (self:ReadEntryData(entryData, 4) == "0") or false local cooldown = (self:ReadEntryData(entryData, 4) == "0") or false
cooldown = not cooldown cooldown = not cooldown
local GetAura = UnitBuff local GetAura = UnitBuff
if type == "Debuff" then GetAura = UnitDebuff end
o = { if type == "Debuff" then GetAura = UnitDebuff end
["entry"] = entry,
["auraName"] = name,
["GetAura"] = GetAura,
["target"] = target,
["hasCooldown"] = cooldown,
}
setmetatable(o, self)
self.__index = self
return o
end,
ReadEntryData = function(self, entryData, index) o = {
local str = entryData[index] ["entry"] = entry,
if str == nil then ["auraName"] = name,
return nil ["GetAura"] = GetAura,
end ["target"] = target,
str = self:TrimWhitespace(str) ["hasCooldown"] = cooldown,
return str }
end, setmetatable(o, self)
self.__index = self
return o
end,
TrimWhitespace = function(self, str) ReadEntryData = function(self, entryData, index)
str = str:gsub("^[ ]+", "") local str = entryData[index]
str = str:gsub("\n$", "") if str == nil then return nil end
str = str:gsub("[ ]+$", "") str = self:TrimWhitespace(str)
return str return str
end, end,
TrimWhitespace = function(self, str)
str = str:gsub("^[ ]+", "")
str = str:gsub("\n$", "")
str = str:gsub("[ ]+$", "")
return str
end,
} }
aura_env.auras = {} aura_env.auras = {}
for entry in string.gmatch(aura_env.config.spellList, "([a-zA-Z,0-9 ]+)") do for entry in string.gmatch(aura_env.config.spellList, "([a-zA-Z,0-9 ]+)") do
entry = Entry:New(entry) entry = Entry:New(entry)
auraObj = Aura:New(entry, #aura_env.auras + 1) auraObj = Aura:New(entry, #aura_env.auras + 1)
aura_env.auras[#aura_env.auras + 1] = auraObj aura_env.auras[#aura_env.auras + 1] = auraObj
end end
aura_env.HandleEvent = function(allstates) aura_env.HandleEvent = function(allstates)
for k, v in ipairs(aura_env.auras) do for k, v in ipairs(aura_env.auras) do
if v:IsActive() then if v:IsActive() then
v:AddAsAura(allstates) v:AddAsAura(allstates)
elseif v:IsOnCooldown() and not v:IsActive() then elseif v:IsOnCooldown() and not v:IsActive() then
v:AddAsCooldown(allstates) v:AddAsCooldown(allstates)
elseif not v:IsOnCooldown() and not v:IsActive() then elseif not v:IsOnCooldown() and not v:IsActive() then
v:AddAsIcon(allstates) v:AddAsIcon(allstates)
end end
end end
end end

View File

@@ -1,317 +1,304 @@
local function StrSplit(inputString, separator) local function StrSplit(inputString, separator)
local outputTable = {} local outputTable = {}
for str in string.gmatch(inputString, "([^" .. separator .. "]+)") do for str in string.gmatch(inputString, "([^" .. separator .. "]+)") do
outputTable[#outputTable + 1] = str outputTable[#outputTable + 1] = str
end end
return outputTable return outputTable
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
local function GetAuraIndex(func, unit, name) local function GetAuraIndex(func, unit, name)
for i = 1, 40 do for i = 1, 40 do
local aura = func(unit, i) local aura = func(unit, i)
if aura == "name" then return i end if aura == "name" then return i end
if aura == nil then return 0 end if aura == nil then return 0 end
end end
return 0 return 0
end end
aura_env.GetClassColor = function(class) aura_env.GetClassColor = function(class)
if class == "Death Knight" then if class == "Death Knight" then
return "\124cFFC41E3A" return "\124cFFC41E3A"
elseif class == "Druid" then elseif class == "Druid" then
return "\124cFFFF7C0A" return "\124cFFFF7C0A"
elseif class == "Hunter" then elseif class == "Hunter" then
return "\124cFFAAD372" return "\124cFFAAD372"
elseif class == "Mage" then elseif class == "Mage" then
return "\124cFF3FC7EB" return "\124cFF3FC7EB"
elseif class == "Paladin" then elseif class == "Paladin" then
return "\124cFFF48CBA" return "\124cFFF48CBA"
elseif class == "Priest" then elseif class == "Priest" then
return "\124cFFFFFFFF" return "\124cFFFFFFFF"
elseif class == "Rogue" then elseif class == "Rogue" then
return "\124cFFFFF468" return "\124cFFFFF468"
elseif class == "Shaman" then elseif class == "Shaman" then
return "\124cFF0070DD" return "\124cFF0070DD"
elseif class == "Warlock" then elseif class == "Warlock" then
return "\124cFF8788EE" return "\124cFF8788EE"
elseif class == "Warrior" then elseif class == "Warrior" then
return "\124cFFC69B6D" return "\124cFFC69B6D"
end end
end end
local Unit = { local Unit = {
New = function(self, unit) New = function(self, unit)
o = { o = {
["unit"] = unit, ["unit"] = unit,
} }
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
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
return { return {
[UnitName(self.unit)] = { [UnitName(self.unit)] = {
["duration"] = duration, ["duration"] = duration,
["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" auras = {}
end for i = 1, num do
auras = {} -- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name)
for i = 1, num do local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name)
-- local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc(unitPrefix .. i, name) if auraIndex > 0 then
local auraIndex = GetAuraIndex(auraFunc, unitPrefix .. i, name) local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID =
if auraIndex > 0 then 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, ["spellID"] = spellID,
["spellID"] = spellID, ["class"] = UnitClass(unitPrefix .. i) or "Paladin",
["class"] = UnitClass(unitPrefix .. i) or "Paladin", ["stacks"] = stacks or 1,
["stacks"] = stacks or 1, }
} end
end 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)
local auraIndex = GetAuraIndex(auraFunc, "player", name)if auraIndex > 0 then 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,
["class"] = UnitClass(unitPrefix .. i) or "Paladin", ["class"] = UnitClass(unitPrefix .. i) or "Paladin",
["stacks"] = stacks or 1, ["stacks"] = stacks or 1,
} }
end end
end end
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)
local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex) if auraIndex > 0 then
auras[UnitName(unitPrefix .. i)] = { local aura, _, _, stacks, _, duration, expirationTime, _, _, _, spellID = auraFunc("player", auraIndex)
["duration"] = duration, auras[UnitName(unitPrefix .. i)] = {
["expirationTime"] = expirationTime, ["duration"] = duration,
["spellID"] = spellID, ["expirationTime"] = expirationTime,
["stacks"] = stacks or 1, ["spellID"] = spellID,
} ["stacks"] = stacks or 1,
end }
end end
return auras end
return auras
end end
local UnitFactory = { local UnitFactory = {
New = function(self) New = function(self)
o = {} o = {}
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
return o return o
end, end,
CreateUnit = function(self, target) CreateUnit = function(self, target)
target = string.lower(target) target = string.lower(target)
if target == "player" or target == "target" or target == "focus" then if target == "player" or target == "target" or target == "focus" then
return BasicUnit:New(target) return BasicUnit:New(target)
elseif target == "group" then elseif target == "group" then
return GroupUnit:New(target) return GroupUnit:New(target)
elseif target == "nameplate" then elseif target == "nameplate" then
return NameplateUnit:New(target) return NameplateUnit:New(target)
end end
end, end,
} }
local unitFactory = UnitFactory:New() local unitFactory = UnitFactory:New()
local Aura = { local Aura = {
New = function(self, entry, index) New = function(self, entry, index)
o = { o = {
["name"] = entry.auraName, ["name"] = entry.auraName,
["unit"] = entry.target, ["unit"] = entry.target,
["hasCooldown"] = entry.hasCooldown, ["hasCooldown"] = entry.hasCooldown,
["index"] = index, ["index"] = index,
["GetAura"] = entry.GetAura, ["GetAura"] = entry.GetAura,
} }
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
return o return o
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 return GetSpellCooldown(self.name) > 0
end end,
return GetSpellCooldown(self.name) > 0
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)
allstates[self.name .. k] = { allstates[self.name .. k] = {
changed = true, changed = true,
show = true, show = true,
resort = true, resort = true,
progressType = "timed", progressType = "timed",
duration = duration, duration = duration,
expirationTime = expirationTime, expirationTime = expirationTime,
index = self.index, index = self.index,
icon = icon, icon = icon,
pname = k, pname = k,
stacks = v.stacks, stacks = v.stacks,
pclass = v.class, pclass = v.class,
IsOnCooldown = true, IsOnCooldown = true,
IsActive = true, IsActive = true,
IsBad = self.GetAura == UnitDebuff, IsBad = self.GetAura == UnitDebuff,
} }
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 startTime, duration = GetSpellCooldown(self.name)
end icon = self:GetSpellIcon()
startTime, duration = GetSpellCooldown(self.name) allstates[self.name] = {
icon = self:GetSpellIcon() changed = true,
allstates[self.name] = { show = true,
changed = true, resort = true,
show = true, progressType = "timed",
resort = true, duration = duration,
progressType = "timed", expirationTime = startTime + duration,
duration = duration, index = self.index,
expirationTime = startTime + duration, icon = icon,
index = self.index, IsOnCooldown = true,
icon = icon, IsActive = false,
IsOnCooldown = true, IsBad = self.GetAura == UnitDebuff,
IsActive = false, }
IsBad = self.GetAura == UnitDebuff, end,
} AddAsIcon = function(self, allstates)
end, if not self.hasCooldown then return false end
AddAsIcon = function(self, allstates) icon = self:GetSpellIcon()
if not self.hasCooldown then allstates[self.name] = {
return false changed = true,
end show = true,
icon = self:GetSpellIcon() resort = true,
allstates[self.name] = { progressType = "static",
changed = true, value = 1,
show = true, total = 1,
resort = true, index = self.index,
progressType = "static", icon = icon,
value = 1, IsOnCooldown = false,
total = 1, IsActive = false,
index = self.index, IsBad = self.GetAura == UnitDebuff,
icon = icon, }
IsOnCooldown = false, end,
IsActive = false,
IsBad = self.GetAura == UnitDebuff,
}
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 = {
New = function(self, entry) New = function(self, entry)
entry = self:TrimWhitespace(entry) entry = self:TrimWhitespace(entry)
local entryData = StrSplit(entry, ",") local entryData = StrSplit(entry, ",")
local name = self:ReadEntryData(entryData, 1) local name = self:ReadEntryData(entryData, 1)
local type = self:ReadEntryData(entryData, 2) or "Buff" local type = self:ReadEntryData(entryData, 2) or "Buff"
local target = unitFactory:CreateUnit(self:ReadEntryData(entryData, 3) or "Player") local target = unitFactory:CreateUnit(self:ReadEntryData(entryData, 3) or "Player")
local cooldown = (self:ReadEntryData(entryData, 4) == "0") or false local cooldown = (self:ReadEntryData(entryData, 4) == "0") or false
cooldown = not cooldown cooldown = not cooldown
local GetAura = UnitBuff local GetAura = UnitBuff
if type == "Debuff" then GetAura = UnitDebuff end
o = { if type == "Debuff" then GetAura = UnitDebuff end
["entry"] = entry,
["auraName"] = name,
["GetAura"] = GetAura,
["target"] = target,
["hasCooldown"] = cooldown,
}
setmetatable(o, self)
self.__index = self
return o
end,
ReadEntryData = function(self, entryData, index) o = {
local str = entryData[index] ["entry"] = entry,
if str == nil then ["auraName"] = name,
return nil ["GetAura"] = GetAura,
end ["target"] = target,
str = self:TrimWhitespace(str) ["hasCooldown"] = cooldown,
return str }
end, setmetatable(o, self)
self.__index = self
return o
end,
TrimWhitespace = function(self, str) ReadEntryData = function(self, entryData, index)
str = str:gsub("^[ ]+", "") local str = entryData[index]
str = str:gsub("\n$", "") if str == nil then return nil end
str = str:gsub("[ ]+$", "") str = self:TrimWhitespace(str)
return str return str
end, end,
TrimWhitespace = function(self, str)
str = str:gsub("^[ ]+", "")
str = str:gsub("\n$", "")
str = str:gsub("[ ]+$", "")
return str
end,
} }
aura_env.auras = {} aura_env.auras = {}
for entry in string.gmatch(aura_env.config.spellList, "([a-zA-Z,0-9 ]+)") do for entry in string.gmatch(aura_env.config.spellList, "([a-zA-Z,0-9 ]+)") do
entry = Entry:New(entry) entry = Entry:New(entry)
auraObj = Aura:New(entry, #aura_env.auras + 1) auraObj = Aura:New(entry, #aura_env.auras + 1)
aura_env.auras[#aura_env.auras + 1] = auraObj aura_env.auras[#aura_env.auras + 1] = auraObj
end end
aura_env.HandleEvent = function(allstates) aura_env.HandleEvent = function(allstates)
for k, v in ipairs(aura_env.auras) do for k, v in ipairs(aura_env.auras) do
if v:IsActive() then if v:IsActive() then
v:AddAsAura(allstates) v:AddAsAura(allstates)
elseif v:IsOnCooldown() and not v:IsActive() then elseif v:IsOnCooldown() and not v:IsActive() then
v:AddAsCooldown(allstates) v:AddAsCooldown(allstates)
elseif not v:IsOnCooldown() and not v:IsActive() then elseif not v:IsOnCooldown() and not v:IsActive() then
v:AddAsIcon(allstates) v:AddAsIcon(allstates)
end end
end end
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

@@ -1,37 +1,39 @@
aura_env.buffs = { aura_env.buffs = {
["Null Barrier"] = 1, ["Null Barrier"] = 1,
["Empowered Null Barrier"] = 1, ["Empowered Null Barrier"] = 1,
} }
aura_env.max = 0 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 return 0
end
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()
local abs = 0 local abs = 0
for k, v in pairs(aura_env.buffs) do for k, v in pairs(aura_env.buffs) do
abs = abs + aura_env.GetAbsorb(k) abs = abs + aura_env.GetAbsorb(k)
end end
return abs return abs
end end
aura_env.PrettyPrintNum = function(n) aura_env.PrettyPrintNum = function(n)
if n > 1e6 then if n > 1e6 then
return string.format("%.2fM", n / 1e6) return string.format("%.2fM", n / 1e6)
elseif n > 1e3 then elseif n > 1e3 then
return string.format("%.2fk", n / 1e3) return string.format("%.2fk", n / 1e3)
else else
return n return n
end end
end end

View File

@@ -1,4 +1,4 @@
aura_env.buffs = { aura_env.buffs = {
["Null Barrier"] = 1, ["Null Barrier"] = 1,
} }
aura_env.timeApplied = 0 aura_env.timeApplied = 0

View File

@@ -1,41 +1,43 @@
aura_env.buffs = { aura_env.buffs = {
["Null Barrier"] = 1, ["Null Barrier"] = 1,
["Empowered Null Barrier"] = 1, ["Empowered Null Barrier"] = 1,
["Resounding Protection"] = 1, ["Resounding Protection"] = 1,
["Guard"] = 1, ["Guard"] = 1,
["Void Shroud"] = 1, ["Void Shroud"] = 1,
["Stoneskin"] = 1, ["Stoneskin"] = 1,
} }
aura_env.max = 0 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 return 0
end
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()
local abs = 0 local abs = 0
for k, v in pairs(aura_env.buffs) do for k, v in pairs(aura_env.buffs) do
abs = abs + aura_env.GetAbsorb(k) abs = abs + aura_env.GetAbsorb(k)
end end
return abs return abs
end end
aura_env.PrettyPrintNum = function(n) aura_env.PrettyPrintNum = function(n)
if n > 1e6 then if n > 1e6 then
return string.format("%.2fM", n / 1e6) return string.format("%.2fM", n / 1e6)
elseif n > 1e3 then elseif n > 1e3 then
return string.format("%.2fk", n / 1e3) return string.format("%.2fk", n / 1e3)
else else
return n return n
end end
end end

View File

@@ -1,17 +1,17 @@
aura_env.specStatTable = { aura_env.specStatTable = {
["Windwalker"] = 2, ["Windwalker"] = 2,
["Brewmaster"] = 2, ["Brewmaster"] = 2,
["Mistweaver"] = 4, ["Mistweaver"] = 4,
} }
aura_env.maxStat = 0 aura_env.maxStat = 0
aura_env.currentStat = 0 aura_env.currentStat = 0
aura_env.GetPrimaryStat = function() aura_env.GetPrimaryStat = function()
stat = UnitStat("player", aura_env.GetPrimStatID()) stat = UnitStat("player", aura_env.GetPrimStatID())
return stat return stat
end end
aura_env.GetPrimStatID = function() aura_env.GetPrimStatID = function()
specID, specName = GetSpecializationInfo(GetSpecialization()) specID, specName = GetSpecializationInfo(GetSpecialization())
return aura_env.specStatTable[specName] return aura_env.specStatTable[specName]
end end