Guest User

Untitled

a guest
Mar 27th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. -- List of all types of herb that we wish to maintain a stock of
  2. local herblist = {
  3.     "yarrow",
  4.     "galingale",
  5.     "marjoram",
  6.     "colewort",
  7.     "mistletoe",
  8.     "juniper",
  9.     "faeleaf",
  10.     "chervil",
  11.     "rosehips",
  12.     "sargassum",
  13.     "sage",
  14.     "reishi",
  15.     "kafe",
  16.     "flax",
  17.     "pennyroyal",
  18.     "weed",
  19.     "wormwood",
  20.     "arnica",
  21.     "horehound",
  22.     "calamus",
  23.     "sparkleberry",
  24.     "kombu",
  25.     "coltsfoot",
  26.     "merbloom",
  27.     "myrtle",
  28.     "earwort"
  29. }
  30.  
  31. function createHerbTable()
  32.     -- Purge existing data first
  33.     myHerbs = {}
  34.     -- Now, create our table structure with a default value of 0 for each herb
  35.     for _, v in ipairs(herblist) do
  36.         myHerbs[v] = 0
  37.     end
  38. end
  39.  
  40. function parseRiftContents(limit)
  41.     local limit = tonumber(limit) or 2000
  42.     -- m&m already provides easy access to current rift values, so we'll use those
  43.     for k, v in pairs(mm.me.riftcontents) do
  44.         if v < limit then
  45.             local amt = limit - v
  46.             -- Check our herblist table to ensure we only fill those herbs we require
  47.             if table.contains(herblist, k) then
  48.                 myHerbs[k] = amt
  49.             end
  50.         end
  51.     end
  52. end
  53.  
  54. function doFillRift()
  55.     for k, v in pairs(myHerbs) do
  56.         send("buy " .. v .. " " .. k)
  57.         send("inr all " .. k)
  58.     end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment