Extend castaurabar functionality to include buffs and debuffs from various sources

This commit is contained in:
PhatDave
2022-01-01 04:04:50 +01:00
parent 5f35c4e4e2
commit 06b11f955c
8 changed files with 774 additions and 26 deletions

View File

@@ -7,12 +7,12 @@ function()
if aura_env.sellPriceThresholds[itemID] then if aura_env.sellPriceThresholds[itemID] then
if v.minPrice > aura_env.sellPriceThresholds[itemID] then if v.minPrice > aura_env.sellPriceThresholds[itemID] then
print(itemName, "too expensive") print(itemName, "too expensive")
return true SendChatMessage("POKE", "WHISPER", nil, UnitName("player"))
end end
elseif aura_env.buyPriceThresholds[itemID] then elseif aura_env.buyPriceThresholds[itemID] then
if v.minPrice < aura_env.buyPriceThresholds[itemID] then if v.minPrice < aura_env.buyPriceThresholds[itemID] then
print(itemName, "too cheap") print(itemName, "too cheap")
return true SendChatMessage("POKE", "WHISPER", nil, UnitName("player"))
end end
end end
end end

View File

@@ -5,6 +5,10 @@ aura_env.sellPriceThresholds = {
[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
[168496] = 4500 * 100 * 100; -- Force Multiplier
[168593] = 4500 * 100 * 100; -- Machinist's Brilliance
[168598] = 4500 * 100 * 100; -- Naga Hide
} }
aura_env.buyPriceThresholds = { aura_env.buyPriceThresholds = {

380
NewAge/Automation/INIT.lua Normal file
View File

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

View File

@@ -0,0 +1,205 @@
function(e)
local aura_env = aura_env
if e == "LOOT_READY" or e == "LOOT_OPENED" then --Auto Loot
local slot = 1
local lootinfo = GetLootInfo()
for k, v in pairs(lootinfo) do
if v.locked == false then
local link = GetLootSlotLink(slot)
local looted = false
if not link then link = GetLootSlotLink(slot) end
if aura_env.filter[1] == true and (v.item:match("%d+ Gold") or v.item:match("%d+ Silver") or v.item:match("%d+ Copper")) then
LootSlot(slot)
elseif aura_env.filter[2] == true and link:match("Azerite") then
LootSlot(slot)
elseif aura_env.filter[3] == true and v.item:match("War Resources") then
LootSlot(slot)
elseif aura_env.filter[4] == true and v.item:match("Residuum") then
LootSlot(slot)
elseif aura_env.filter[5] == true and v.item:match("Manapearl") then
LootSlot(slot)
end
if link then
local icon = v.texture
local id = link:match("item:(%d+):")
local type = select(6, GetItemInfo(link)) or ""
local subtype = select(7, GetItemInfo(link)) or ""
local ilvl = select(4, GetItemInfo(link)) or 0
local equip = select(9, GetItemInfo(link))
if aura_env.filter[6] == true and (select(7, GetItemInfo(link)) or 0) == "Mount" then
LootSlot(slot)
elseif aura_env.filter[7] == true and ilvl > aura_env.ilvlFilter then
LootSlot(slot)
elseif aura_env.filter[8] == true and (select(7, GetItemInfo(link)) or 0) == "Herb" then
LootSlot(slot)
elseif aura_env.filter[9] == true and (select(7, GetItemInfo(link)) or 0) == "Cooking" then
LootSlot(slot)
elseif aura_env.filter[10] == true and (select(7, GetItemInfo(link)) or 0) == "Cloth" and type == "Tradeskill" then
LootSlot(slot)
elseif aura_env.filter[11] == true and (select(7, GetItemInfo(link)) or 0) == "Metal & Stone" then
LootSlot(slot)
elseif aura_env.filter[12] == true and (select(11, GetItemInfo(link)) or 0) > aura_env.goldFilter and v.quality == 0 then
LootSlot(slot)
elseif aura_env.filter[13] == true and v.quality > 1 and v.quality < 4 and type ~= "Weapon" and type ~= "Armor" then
LootSlot(slot)
elseif aura_env.filter[14] == true and v.isQuestItem == true then
LootSlot(slot)
elseif aura_env.filter[15] == true and v.quality == 0 then
LootSlot(slot)
elseif aura_env.filter[16] == true and aura_env.whitelist[v.item] then
LootSlot(slot)
elseif aura_env.filter[17] == true and type == "Quest" and subtype == "Quest" then
LootSlot(slot)
elseif aura_env.filter[21] == true and type == "Tradeskill" and subtype == "Elemental" then
LootSlot(slot)
else
if type == "Weapon" or type == "Armor" then
if aura_env.filter[18] == true and aura_env.skills[select(3, UnitClass("player"))][subtype] == 1 and v.quality > 2 then
LootSlot(slot)
elseif aura_env.filter[19] == true and (equip == "INVTYPE_FINGER" or equip == "INVTYPE_TRINKET" or equip == "INVTYPE_CLOAK" or equip == "INVTYPE_NECK") and v.quality > 2 then
LootSlot(slot)
end
elseif aura_env.filter[20] == true and type == "Miscellaneous" then
if subtype == "Mount" then
LootSlot(slot)
end
end
end
end
slot = slot + 1
end
end
--CloseLoot()
elseif e == "EQUIP_BIND_CONFIRM" then
StaticPopup1Button1:Click()
elseif e == "SCRAPPING_MACHINE_SHOW" then
for i = 0, 4 do
for j = 1, GetContainerNumSlots(i) do
local link = select(7, GetContainerItemInfo(i, j))
if link then
local name = GetItemInfo(link)
local rarity = select(3, GetItemInfo(link))
local ilvl = select(4, GetItemInfo(link)) or 0
local type = select(6, GetItemInfo(link))
local equip = select(9, GetItemInfo(link)) or ""
local price = select(11, GetItemInfo(link))
if aura_env.sellWhitelist[name] ~= 1 then
if name and rarity and ilvl and type and equip and price then
if (type == "Armor" or type == "Weapon") and rarity <= 3 and aura_env.getequipID(equip) then
UseContainerItem(i, j)
elseif rarity > 3 and aura_env.getequipID(equip) then
if equip ~= "INVTYPE_FINGER" then
local eqID = aura_env.getequipID(equip)
local elink = GetInventoryItemLink("player", eqID)
local eilvl = select(4, GetItemInfo(elink)) or 0
if eilvl > ilvl + 5 then
print("Scrapping " .. link .. "over " .. eilvl - ilvl .. " ilvl difference from " .. elink)
UseContainerItem(i, j)
end
elseif equip == "INVTYPE_FINGER" then
local eqID1, eqID2 = 11, 12
local elink1, elink2 = GetInventoryItemLink("player", eqID1), GetInventoryItemLink("player", eqID2)
local eilvl1, eilvl2 = select(4, GetItemInfo(elink1)) or 0, select(4, GetItemInfo(elink2)) or 0
if eilvl1 > ilvl + 5 then
print("Scrapping " .. link .. " over " .. eilvl1 - ilvl .. " ilvl difference from " .. elink1)
UseContainerItem(i, j)
elseif eilvl2 > ilvl + 5 then
print("Scrapping " .. link .. " over " .. eilvl2 - ilvl .. " ilvl difference from " .. elink2)
UseContainerItem(i, j)
end
end
end
end
end
end
end
end
elseif e == "MERCHANT_SHOW" then --Sell grey and white wepaon
if CanMerchantRepair() == true then RepairAllItems() end
local i, j = 0, 1
for c = 0, 4 do
for s = 1, GetContainerNumSlots(c) do
local link = select(7, GetContainerItemInfo(c, s))
if link then
local name = GetItemInfo(link)
local rarity = select(3, GetItemInfo(link))
local ilvl = select(4, GetItemInfo(link)) or 0
local type = select(6, GetItemInfo(link))
local price = select(11, GetItemInfo(link))
if price and price > 0 then
if aura_env.sellWhitelist[name] ~= 1 then
if rarity == 0 then
if aura_env.throttleSell == true then
aura_env.toSell[#aura_env.toSell + 1] = {["c"] = c, ["s"] = s}
else
UseContainerItem(c, s)
end
elseif (type == "Armor" or type == "Weapon") and ilvl < 200 then
if aura_env.throttleSell == true then
aura_env.toSell[#aura_env.toSell + 1] = {["c"] = c, ["s"] = s}
else
UseContainerItem(c, s)
end
end
end
end
end
end
end
if aura_env.throttleSell == true then
aura_env.ticker = C_Timer.NewTicker(0.05, function()
if aura_env.toSell[1] then
UseContainerItem(aura_env.toSell[1].c, aura_env.toSell[1].s)
table.remove(aura_env.toSell, 1)
else
aura_env.ticker:Cancel()
end
if j >= GetContainerNumSlots(i) then i = i + 1
j = 1 end
if i >= 4 then aura_env.ticker:Cancel() end
end)
end
elseif e == "MERCHANT_CLOSED" then
if aura_env.ticker then aura_env.ticker:Cancel() end
aura_env.toSell = {}
elseif e == "QUEST_POI_UPDATE" then
CloseGossip()
elseif e == "QUEST_DETAIL" then
AcceptQuest()
elseif e == "QUEST_COMPLETE" then
if GetNumQuestChoices() <= 1 then
GetQuestReward(1)
end
elseif e == "GOSSIP_SHOW" then
local quests = GetNumGossipAvailableQuests()
local complquests = GetNumGossipActiveQuests()
local opt = GetNumGossipOptions()
if complquests > 0 and opt == 0 then
for i = 1, complquests do
SelectGossipActiveQuest(i)
end
end
if quests > 0 and opt == 0 then
SelectGossipAvailableQuest(1)
end
if opt == 1 and quests + complquests == 0 then
SelectGossipOption(1)
end
elseif e == "QUEST_GREETING" then
local quests = GetNumGossipAvailableQuests()
local complquests = GetNumGossipActiveQuests()
if complquests > 0 then
for i = 1, complquests do
SelectActiveQuest(1)
end
end
if quests > 0 then
SelectAvailableQuest(1)
end
elseif e == "QUEST_PROGRESS" then
if IsQuestCompletable(i) then
CompleteQuest()
end
end
end

View File

@@ -0,0 +1,69 @@
-- LOOT_READY LOOT_OPENED
function(e, ...)
local slot = 1
local lootinfo = GetLootInfo()
for k, v in pairs(lootinfo) do
if v.locked == false then
local link = GetLootSlotLink(slot)
if not link then link = GetLootSlotLink(slot) end
if aura_env.filter[1] == true and (v.item:match("%d+ Gold") or v.item:match("%d+ Silver") or v.item:match("%d+ Copper")) then
LootSlot(slot)
elseif aura_env.filter[2] == true and link:match("Azerite") then
LootSlot(slot)
elseif aura_env.filter[3] == true and v.item:match("War Resources") then
LootSlot(slot)
elseif aura_env.filter[4] == true and v.item:match("Residuum") then
LootSlot(slot)
elseif aura_env.filter[5] == true and v.item:match("Manapearl") then
LootSlot(slot)
end
if link then
local type = select(6, GetItemInfo(link)) or ""
local subtype = select(7, GetItemInfo(link)) or ""
local ilvl = select(4, GetItemInfo(link)) or 0
local equip = select(9, GetItemInfo(link))
if aura_env.filter[6] == true and (select(7, GetItemInfo(link)) or 0) == "Mount" then
LootSlot(slot)
elseif aura_env.filter[7] == true and ilvl > aura_env.ilvlFilter then
LootSlot(slot)
elseif aura_env.filter[8] == true and (select(7, GetItemInfo(link)) or 0) == "Herb" then
LootSlot(slot)
elseif aura_env.filter[9] == true and (select(7, GetItemInfo(link)) or 0) == "Cooking" then
LootSlot(slot)
elseif aura_env.filter[10] == true and (select(7, GetItemInfo(link)) or 0) == "Cloth" and type == "Tradeskill" then
LootSlot(slot)
elseif aura_env.filter[11] == true and (select(7, GetItemInfo(link)) or 0) == "Metal & Stone" then
LootSlot(slot)
elseif aura_env.filter[12] == true and (select(11, GetItemInfo(link)) or 0) > aura_env.goldFilter and v.quality == 0 then
LootSlot(slot)
elseif aura_env.filter[13] == true and v.quality > 1 and v.quality < 4 and type ~= "Weapon" and type ~= "Armor" then
LootSlot(slot)
elseif aura_env.filter[14] == true and v.isQuestItem == true then
LootSlot(slot)
elseif aura_env.filter[15] == true and v.quality == 0 then
LootSlot(slot)
elseif aura_env.filter[16] == true and aura_env.whitelist[v.item] then
LootSlot(slot)
elseif aura_env.filter[17] == true and type == "Quest" and subtype == "Quest" then
LootSlot(slot)
elseif aura_env.filter[21] == true and type == "Tradeskill" and subtype == "Elemental" then
LootSlot(slot)
else
if type == "Weapon" or type == "Armor" then
if aura_env.filter[18] == true and aura_env.skills[select(3, UnitClass("player"))][subtype] == 1 and v.quality > 2 then
LootSlot(slot)
elseif aura_env.filter[19] == true and (equip == "INVTYPE_FINGER" or equip == "INVTYPE_TRINKET" or equip == "INVTYPE_CLOAK" or equip == "INVTYPE_NECK") and v.quality > 2 then
LootSlot(slot)
end
elseif aura_env.filter[20] == true and type == "Miscellaneous" then
if subtype == "Mount" then
LootSlot(slot)
end
end
end
end
slot = slot + 1
end
end
end

View File

@@ -0,0 +1,20 @@
{
IsOnCooldown = {
type = "bool",
test = function(state, needle)
return state.IsOnCooldown == (needle == 1)
end,
},
IsActive = {
type = "bool",
test = function(state, needle)
return state.IsActive == (needle == 1)
end,
},
IsDebuff = {
type = "bool",
test = function(state, needle)
return state.IsBad == (needle == 1)
end,
},
}

View File

@@ -1,32 +1,45 @@
local function StrSplit(inputString, separator)
local outputTable = {}
for str in string.gmatch(inputString, "([^" .. separator .. "]+)") do
outputTable[#outputTable + 1] = str
end
return outputTable
end
local function PrintTable(table)
for k,v in pairs(table) do
print(k .. " " .. v)
end
end
local Aura = { local Aura = {
New = function(self, spellName, index) New = function(self, entry, index)
o = { o = {
["name"] = spellName, ["name"] = entry.auraName,
["index"] = index or 1, ["type"] = entry.auraType,
["target"] = entry.target,
["hasCooldown"] = entry.hasCooldown,
["index"] = index,
["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)
aura = self:GetAuraName() return self.GetAura(self.target, self.name, self.type) ~= nil
print(UnitAura("player", aura))
return UnitAura("player", aura) ~= nil
end, end,
IsOnCooldown = function(self) IsOnCooldown = function(self)
if not self.hasCooldown then
return false
end
return GetSpellCooldown(self.name) > 0 return GetSpellCooldown(self.name) > 0
end, end,
GetAuraName = function(self)
aura = self.aura
if aura == nil then
aura = self.name
end
return aura
end,
AddAsAura = function(self, allstates) AddAsAura = function(self, allstates)
aura = self:GetAuraName() duration = select(6, self.GetAura(self.target, self.name, self.type))
duration = select(6, UnitAura("player", aura)) expirationTime = select(7, self.GetAura(self.target, self.name, self.type))
expirationTime = select(7, UnitAura("player", aura))
icon = self:GetAuraIcon() icon = self:GetAuraIcon()
allstates[self.name] = { allstates[self.name] = {
changed = true, changed = true,
@@ -37,9 +50,15 @@ local Aura = {
expirationTime = expirationTime, expirationTime = expirationTime,
index = self.index, index = self.index,
icon = icon, icon = icon,
IsOnCooldown = true,
IsActive = true,
IsBad = self.GetAura == UnitDebuff,
} }
end, end,
AddAsCooldown = function(self, allstates) AddAsCooldown = function(self, allstates)
if not self.hasCooldown then
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] = {
@@ -51,9 +70,15 @@ local Aura = {
expirationTime = startTime + duration, expirationTime = startTime + duration,
index = self.index, index = self.index,
icon = icon, icon = icon,
IsOnCooldown = true,
IsActive = false,
IsBad = self.GetAura == UnitDebuff,
} }
end, end,
AddAsIcon = function(self, allstates) AddAsIcon = function(self, allstates)
if not self.hasCooldown then
return false
end
icon = self:GetSpellIcon() icon = self:GetSpellIcon()
allstates[self.name] = { allstates[self.name] = {
changed = true, changed = true,
@@ -64,24 +89,69 @@ local Aura = {
total = 1, total = 1,
index = self.index, index = self.index,
icon = icon, icon = icon,
IsOnCooldown = false,
IsActive = false,
IsBad = self.GetAura == UnitDebuff,
} }
end, end,
GetSpellIcon = function(self) GetSpellIcon = function(self)
return select(3, GetSpellInfo(self.name)) return select(3, GetSpellInfo(self.name))
end, end,
GetAuraIcon = function(self) GetAuraIcon = function(self)
aura = self:GetAuraName() spellID = select(11, self.GetAura(self.target, self.name, self.type))
spellID = select(11, UnitAura("player", aura))
return select(3, GetSpellInfo(spellID)) return select(3, GetSpellInfo(spellID))
end, end,
} }
local Entry = {
New = function(self, entry)
entry = self:TrimWhitespace(entry)
local entryData = StrSplit(entry, ",")
local name = self:ReadEntryData(entryData, 1)
local type = self:ReadEntryData(entryData, 2) or "Buff"
local target = self:ReadEntryData(entryData, 3) or "Player"
local cooldown = (self:ReadEntryData(entryData, 4) == "0") or false
cooldown = not cooldown
local GetAura = UnitBuff
if type == "Debuff" then GetAura = UnitDebuff end
o = {
["entry"] = entry,
["auraName"] = name,
["GetAura"] = GetAura,
["target"] = target,
["hasCooldown"] = cooldown,
}
setmetatable(o, self)
self.__index = self
return o
end,
ReadEntryData = function(self, entryData, index)
local str = entryData[index]
if str == nil then
return nil
end
str = self:TrimWhitespace(str)
return str
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 name in string.gmatch(aura_env.config.spellList, "([a-zA-Z ]+)") do for entry in string.gmatch(aura_env.config.spellList, "([a-zA-Z,0-9 ]+)") do
name = name:gsub("^[ ]+", "") entry = Entry:New(entry)
name = name:gsub("\n$", "")
name = name:gsub("[ ]+$", "") auraObj = Aura:New(entry, #aura_env.auras + 1)
auraObj = Aura:New(name, #aura_env.auras + 1)
aura_env.auras[#aura_env.auras + 1] = auraObj aura_env.auras[#aura_env.auras + 1] = auraObj
end end

View File

@@ -3,7 +3,7 @@ function(allstates, e, ...)
v.show = false v.show = false
v.changed = true v.changed = true
end end
aura_env.HandleEvent(allstates) aura_env.HandleEvent(allstates)
return true return true
end end