Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. trax.cure = function(name,cure)
  2. local flag = false
  3. if name ~= "" and cure ~= "" and dban[cure] then -- OPEN
  4.  
  5. if config and config.trax == 2 then
  6. local count = 0
  7. for i=1, #dban[cure] do
  8. if has(name,dban[cure][i]) > 0 and dba[dban[cure][i]].m_take == "" then
  9. count = count + 1
  10. flag = true
  11. end
  12. end
  13.  
  14. if count > 0 then
  15. count = 1/count
  16. for i=1, #dban[cure] do
  17. local aff = dban[cure][i]
  18. if has(name,aff) > 0 and dba[aff].m_take == "" then
  19. local short = dbp.players_[name].affs_[aff]
  20. short = short - count
  21. if short < 0 then
  22. short = 0
  23. trax.take(name,aff)
  24. end
  25. dbp.players_[name].affs_[aff] = short
  26. end
  27. end
  28. end
  29.  
  30. if dbp then
  31. dbp.ui_refresh()
  32. dbp.ui_refresh_()
  33. end
  34. else
  35. -- Cycle through known afflictions to cure
  36. for i=1, #dban[cure] do -- display(dban[cure][i])
  37. if has(name,dban[cure][i]) and dba[dban[cure][i]].m_take == "" then
  38. trax.take(name,dban[cure][i])
  39. flag = true
  40. break
  41. end
  42. end
  43. end
  44.  
  45. end -- CLOSE
  46.  
  47. -- If you did not cure any afflictions, take a random aff
  48.  
  49. -- exclusion table
  50. local exc_t = {"quince","primrose","juniper","hyssop","violet","toadstool","linseed"}
  51.  
  52. if not flag and not table.contains(exc_t,cure) then
  53. local random_affs = has(name,"random_affs")
  54. if random_affs > 0 then
  55. set(name,"random_affs",random_affs - 1)
  56. cecho("\n<white>Taking Random Aff...")
  57. end
  58. end
  59.  
  60. -- Clear the memory
  61. trax.pending_name = ""
  62. trax.pending = ""
  63. end
  64.  
  65. dban.maidenhair = {
  66. "numbness",
  67. "paralysis",
  68. "metrazol",
  69. "slickness",
  70. "frozen",
  71. "hellsight",
  72. "sensitivity",
  73. "frostbite"
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement