-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautobuyWater.lua
28 lines (24 loc) · 913 Bytes
/
autobuyWater.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- trigger: MERCHANT_SHOW
function(event, ...)
local count = GetItemCount(aura_env.config.itemId, false, false) or 0
local deficit = aura_env.config.maxCount - count
if deficit > 0 then
for itemIndex = 1, GetMerchantNumItems() do
if GetMerchantItemID(itemIndex) == aura_env.config.itemId then
-- We get an error if we try to buy more than one stack in one
-- call to 'BuyMerchantItem', so we loop.
while deficit ~= 0 do
local loopBuyCount
if deficit > 20 then
loopBuyCount = 20
else
loopBuyCount = deficit
end
deficit = deficit - loopBuyCount
BuyMerchantItem(itemIndex, loopBuyCount)
end
end
end
end
return false
end