Advertisement
Guest User

dump-wear.lua

a guest
Aug 11th, 2015
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- Marks all unowned items with a minimum wear value for dumping
  2. local function markDump(minWear)
  3.    local count = 0
  4.    -- iterate through all the items
  5.    for _, item in ipairs(df.global.world.items.all) do
  6.       -- if item wear meets the minimum, check if its unowned and mark it for dump
  7.       if (item.wear >= minWear) and (item.flags.owned == false) and (item.flags.trader == false) and (item.flags.dump == false) then
  8.          item.flags.dump = true
  9.          count = count + 1
  10.       end
  11.    end
  12.    print(count .. ' worn items were marked for dump')
  13. end
  14.  
  15. local args = {...}
  16.  
  17. if (args[1] == 'help') then
  18.    -- print usage
  19.    print([[dump-wear - this script marks for dump all unowned items with a min wear level
  20.  
  21. dump-wear
  22.   use the default minimum wear level of x(pig tail fiber sock)x
  23. dump-wear minlevel
  24.   specifies a minimum wear level for dumping
  25.   minlevel = 'x', 'X', or 'XX'
  26. ]])
  27. elseif (args[1] == 'x') then
  28.    markDump(1)
  29. elseif (args[1] == 'X') then
  30.    markDump(2)
  31. elseif (args[1] == 'XX') then
  32.    markDump(3)
  33. else
  34.    -- default dump level of x(pig tail fiber sock)x
  35.    markDump(1)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement