All pastes #413992 Raw Edit

Untitled

public text v1 · immutable
#413992 ·published 2007-03-28 20:15 UTC
rendered paste body
#define MERCHANT_NAME "Cookie One-Eye"
#define ITEM_NAME "Smoked Talbuk Venison"
#define ITEM_NAME2 "Filtered Draenic Water"
function main()
{
        extension -require isxwarden
        extension -require isxwow
        call buy
}
function buy()
{
        if ${Unit[MERCHANT_NAME].IsMerchant}
        {
                Unit[MERCHANT_NAME]:Use
                wait 10
                call buyItem ITEM_NAME
                call buyItem ITEM_NAME2
        }
        else
        {
                echo MERCHANT_NAME does not seem to be a merchant
        }
}
function buyItem(string Name)
{
        declare numItems int local 0
        declare i int local 1   
        declare Index int local 0
        while  ${i:Inc} <= ${WoWScript[GetMerchantNumItems()]}
        {
                if ${WoWScript[GetMerchantItemInfo(${i})].Equal[${Name}]}
                {
                        Index:Set[${i}]
                        numItems:Set[${WoWScript[GetMerchantItemInfo(${Index}),5]}]
                }
                waitframe
        }
        if ${Index} > 0
        {
                i:Set[0]
                while ${i:Inc} <= ${numitems}
                {
                        WoWScript BuyMerchantItem(${Index})
                }
        }
        else
        {
                echo MERCHANT_NAME does not sell ${Name}
        }
}