Tumble files around a bit
This commit is contained in:
205
WeakAuras/Projects/Automation/Eventz.lua
Normal file
205
WeakAuras/Projects/Automation/Eventz.lua
Normal file
@@ -0,0 +1,205 @@
|
||||
--- LOOT_READY LOOT_OPENED MERCHANT_SHOW QUEST_POI_UPDATE QUEST_DETAIL QUEST_COMPLETE QUEST_GREETING QUEST_PROGRESS GOSSIP_SHOW SCRAPPING_MACHINE_SHOW MERCHANT_CLOSED EQUIP_BIND_CONFIRM
|
||||
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
|
||||
Reference in New Issue
Block a user