Last active
June 12, 2023 09:27
-
-
Save cowboy/e628fe09cd873417ab6a94841c2507a2 to your computer and use it in GitHub Desktop.
WoW Classic :: CB_VendorAutoBuy :: Automatically buy rare items from vendors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copyright (c) 2019 "Cowboy" Ben Alman | |
-- Licensed under the MIT license | |
local frameName = "CB_VENDOR_AUTO_BUY_FRAME" | |
if not _G[frameName] then | |
_G[frameName] = CreateFrame("Frame") | |
_G[frameName]:RegisterEvent("MERCHANT_SHOW") | |
end | |
local function Set(list) | |
local set = {} | |
for _, l in ipairs(list) do set[l] = true end | |
return set | |
end | |
local vendors = { | |
["Qia"] = Set { | |
"Pattern: Runecloth Gloves", | |
"Pattern: Runecloth Bag" | |
} | |
} | |
local function p(msg) | |
print("[CB_VendorAutoBuy] " .. msg) | |
end | |
local frame = _G[frameName] | |
frame:SetScript("OnEvent", function(self, event, ...) | |
if IsShiftKeyDown() then return end | |
local targetName = UnitName("target") | |
if not targetName then return end | |
local vendor = vendors[targetName] | |
if not vendor then return end | |
local numItems = GetMerchantNumItems() | |
for i = numItems, 1, -1 do | |
local name = GetMerchantItemInfo(i) | |
if vendor[name] then | |
p("Buying: " .. name) | |
pcall(function() BuyMerchantItem(i) end) | |
end | |
end | |
local count = 0 | |
frame:SetScript("OnUpdate", function(self) | |
count = count + 1 | |
if count > 10 then | |
CloseMerchant() | |
frame:SetScript("OnUpdate", nil) | |
end | |
end) | |
end) | |
p("loaded!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Interface: 11302 | |
## Title: CB_VendorAutoBuy | |
## Notes: Automatically buy rare items from vendors | |
## Author: Cowboy | |
## Version: v0.0.4 | |
CB_VendorAutoBuy.lua |
Hey
Great addon, love it. :)
I have 2 questions.
Is it possible to add another vendor to look for stuff there ?
Is it possible to use ID and not names ?
I'm not playing WoW anymore, I don't remember!
you know your project is being used by MR_OCX_MONEY_MAKER_FRAME ,,, i noticed you had a copyright in there.. so just fyi
you know your project is being used by MR_OCX_MONEY_MAKER_FRAME ,,, i noticed you had a copyright in there.. so just fyi
I have no idea what that is, but it sounds... devious 😂
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
World of Warcraft\_classic_\Interface\Addons\CB_VendorAutoBuy
folder and put these files in thereInteract with target
Notes:
Shift
to prevent the addon from attempting to auto-buy the item