herbs = { 200342, 200335, 202553, 200333, 200349, 200343, 202554, 200346, 202555, 200345, 200338, 240329, 202558, 202552, 200334, 202557, 200350, 202556, 208246} ores = { 200249, 200238, 200234, 200507, 202315, 202316, 200242, 200236, 200265, 200244, 200269, 208234, 240314, 200268, 200239, 200264, 200230, 200232, 200506 } woods = { 202318, 200297, 200332, 200310, 200306, 200300, 200293, 208240, 202317, 200312, 200508, 200298, 240323, 200304, 200326, 200509, 200307, 200295, 200331 } -- recipientCrafting = "abc" -- statue fragments idsStatueFrags = { 206638, 206639, 206640 , 206633 , 206634 , 206635 } -- vanquisher loot, idsToDelete = { 205817 } -- arcane charges, magical instr. package idsToUse = { 203635, 203487 } -- ghost cards, phirius shells idsMoveToBank = {205792, 240181} -- masters repair hammer idsMoveToISBag = {201014 } -- items to send idsSendFusionStone = {203001 } -- recipientFusionStone = "def" idsSendRepairHammer = {201967 } -- recipientRepairHammer = "ghi" idsHorseTicket = { 203033 } -- recipientHorseTicket = "jkl" function MGCleanBags(idsToDelete, idsToUse, idsMoveToISBag, deleteCommonRecipes) local name; local k; inventory:update() for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 and item.SlotNumber > 60 then name = GetIdName(item.Id); if name == nil then name = "(no name found)"; end -- delete items marked for delete for j, element in pairs(idsToDelete) do if item.Id == element then print("dropping "..name); item:delete() end end -- use items marked for use for j, element in pairs(idsToUse) do if item.Id == element then print("using "..name); k = item.ItemCount; repeat inventory:useItem(item.Id); k = k - 1; until k == 0; end end -- use items marked for move to itemshop bag for j, element in pairs(idsMoveToISBag) do if item.Id == element then print("move to itemshop bag "..name); item:moveTo("itemshop"); end end -- delete recipes, except purple ones and "serenstum" (green) if item:isType("Recipes") and item.Quality < 3 and string.find(item.Name, "Serenstum") == nil then print("dropping "..name); item:delete() end end end inventory:update() end -- requires that the bank window is already open function MGPutIntoBank(idsMoveToBank, typeNameToMove) local name; inventory:update(); local occupiedSlots, totalSlots = sendMacro("GetBagCount();") for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 then -- use items - with bank open, this will move to bank name = GetIdName(item.Id); if name == nil then name = "(no name found)"; end if typeNameToMove ~= nil then if item:isType(typeNameToMove) then print("moving "..GetIdName(item.Id).." to bank"); item:moveTo("bank"); end end print(tostring(item.Id).." "..tostring(item.SlotNumber).." "..name.."\n"); if idsMoveToBank ~= nil then for j, element in pairs(idsMoveToBank) do if item.Id == element then print("moving "..name.." to bank"); item:moveTo("bank"); end end end end end inventory:update() end function MGPutIntoGuildBank(idGuildBankSwitch, idsToMove, typeNameToMove) player:target_Object(idGuildBankSwitch,300); -- open guild bank inventory:update() for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 then if typeNameToMove ~= nil then if item:isType(typeNameToMove) then print("moving "..GetIdName(item.Id).." to guildbank"); item:moveTo("guildbank"); end end if idsToMove ~= nil then for j, element in pairs(idsToMove) do if item.Id == element then print("moving "..GetIdName(item.Id).." to guildbank"); item:moveTo("guildbank"); end end end end end inventory:update() yrest(2000); player:target_Object(idGuildBankSwitch,300); -- close guild bank end function MGmergeTables( table1, table2, table3) local result = {}; local count = 1; for i,v in pairs(table1) do result[count] = v; count = count + 1 end; for i,v in pairs(table2) do result[count] = v; count = count + 1 end; if table3 then for i,v in pairs(table3) do result[count] = v; count = count + 1 end; end return result end function MGbuildTableOfType(nameOfType) local result = {}; local count = 1; inventory:update() for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 then if item:isType(nameOfType) then result[count]=item.Id; count = count + 1; end end end return result; end function MGbuildItemTableOfType(nameOfType) local result = {}; local count = 1; inventory:update() for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 then if item:isType(nameOfType) then result[count]=item; count = count + 1; end end end return result; end -- requires that the mail window is already open -- player:target_Object("Mailbox",1000); function MGSendMail( sendTable ) for k,v in pairs(sendTable) do UMM_SendAdvanced(k,v, nil, nil, nil, nil, nil, nil, nil, nil, nil); yrest(1000); end end function MGmount() if player.Mounted == false then player:mount(); end end function MGprintTable(items) local name; local k; inventory:update() for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 and item.SlotNumber > 60 then name = GetIdName(item.Id); if name == nil then name = "(no name found)"; end for j, element in pairs(items) do if item.Id == element.Id then item:update(); print("found "..name.." "..tostring(item.Bound).." "..tostring(item.RequiredLvl)); end end end end end function selectUnboundItems(itemsToFilter) local result = {}; local count = 1; for j, element in pairs(itemsToFilter) do if element.Bound == false then result[count]=element; count = count + 1; end end return result; end function selectItemsByLvl(itemsToFilter, requiredLevel) local result = {}; local count = 1; for j, element in pairs(itemsToFilter) do if element.RequiredLvl > requiredLevel then result[count]=element; count = count + 1; end end return result; end function selectItemsByName(itemsToFilter, nameSubString) local result = {}; local count = 1; for j, element in pairs(itemsToFilter) do if string.find(element.Name,nameSubString) then result[count]=element; count = count + 1; end end return result; end function getIdsFrom(items) local result = {}; local count = 1; for j, element in pairs(items) do result[count]=element.Id; count = count + 1; end return result; end function tradeTo(RecipientName,itemTable) local tradeIndex = 1; local failCount = 1; if itemTable then -- Lets trade local Recipient = player:findNearestNameOrId(RecipientName) if Recipient then repeat player:target(Recipient) yrest(500) RoMScript("RequestTrade('target')") yrest(500) -- Not sure how long the addon needs to react and accept the trade but it will try again until it answers failCount = failCount + 1; until (RoMScript("TradeFrame:IsVisible()") or failCount > 5) RoMScript("BagFrame:Show()"); yrest(500) for j, element in pairs(itemTable) do RoMScript("PickupBagItem("..tostring(element.SlotNumber)..")"); RoMScript("ClickTradeItem("..tostring(tradeIndex)..")"); tradeIndex = tradeIndex + 1; if tradeIndex > 8 then break; end yrest(200); end yrest(500) RoMScript("AcceptTrade('".. RecipientName .."')") yrest(500) -- Again not sure what pause is necessary for addon to react RoMScript("AcceptTrade('".. RecipientName .."')") end end end function findItemsNamed(nameSubString) local result = {}; local count = 1; for i, item in pairs(inventory.BagSlot) do if item.Id ~= 0 and item.SlotNumber > 60 then name = GetIdName(item.Id); if string.find(name,nameSubString) then result[count]=item; count = count + 1; end end end return result; end