Advertisement
rafaelflz

Untitled

Apr 11th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. local CONFIG = {
  2. DRAW_TYPE = "border",
  3. ORIENTATION = "right",
  4. POSITION = {X = 8, Y = 12},
  5. MAX_TEXT_LENGTH = 17,
  6. TEXT_DISTANCE = 130,
  7. LINE_DISTANCE = 14,
  8. }
  9.  
  10.  
  11. HUD = {
  12.  
  13. TITLE = "Awsome Loot Counter",
  14.  
  15. ITEMS = {
  16.  
  17. LOOT = {
  18. {NAME = "knight armor", VALUE = 5000},
  19. {NAME = "knight legs", VALUE = 5000},
  20. {NAME = "spider silk", VALUE = 5000},
  21. {NAME = "platinum amulet", VALUE = 2500},
  22. {NAME = "lightning headband", VALUE = 2500},
  23. {NAME = "two handed sword", VALUE = 450},
  24. {NAME = "steel helmet", VALUE = 293},
  25. {NAME = "plate legs", VALUE = 115},
  26. {NAME = "time ring", VALUE = 100},
  27. {NAME = "tarantula egg", VALUE = 80},
  28. {NAME = "spider fangs", VALUE = 10},
  29. {NAME = "gold coin", VALUE = 1},
  30. {NAME = "mercenary sword", VALUE = 12000},
  31. {NAME = "flask of warrior's sweat", VALUE = 10000},
  32. {NAME = "tower shield", VALUE = 8000},
  33. {NAME = "batwing hat", VALUE = 8000},
  34. {NAME = "crusader helmet", VALUE = 6000},
  35. {NAME = "angelic axe", VALUE = 5000},
  36. {NAME = "spellbook of enlightenment", VALUE = 4000},
  37. {NAME = "glorious axe", VALUE = 3000},
  38. {NAME = "knight axe", VALUE = 2000},
  39. {NAME = "guardian shield", VALUE = 2000},
  40. {NAME = "bat wing", VALUE = 100},
  41. {NAME = "belted cape", VALUE = 500},
  42. {NAME = "mutated bat ear", VALUE = 420},
  43. {NAME = "sabretooth", VALUE = 400},
  44. {NAME = "black pearl", VALUE = 280},
  45. {NAME = "stealth ring", VALUE = 200},
  46. {NAME = "energy ring", VALUE = 200},
  47. {NAME = "small amethyst", VALUE = 200},
  48. {NAME = "broken gladiator shield", VALUE = 190},
  49. {NAME = "mutated rat tail", VALUE = 150},
  50. {NAME = "strong health potion", VALUE = 100},
  51. {NAME = "striped fur", VALUE = 50},
  52. {NAME = "health potion", VALUE = 45},
  53. {NAME = "green mushroom", VALUE = 0},
  54. {NAME = "plate armor", VALUE = 400},
  55. {NAME = "obsidian lance", VALUE = 500},
  56. {NAME = "halberd", VALUE = 400},
  57. {NAME = "beastslayer axe", VALUE = 1500},
  58. {NAME = "red piece of cloth", VALUE = 20000},
  59. {NAME = "fur boots", VALUE = 2000},
  60. {NAME = "shard", VALUE = 2000},
  61. {NAME = "two handed sword", VALUE = 450},
  62. {NAME = "spool of yarn", VALUE = 50000},
  63. {NAME = "sweet smelling bait", VALUE = 100000},
  64. },
  65.  
  66. SUPPLY = {
  67. {NAME = "Mana Potion", VALUE = 50},
  68. {NAME = "Strong Mana Potion", VALUE = 80},
  69. {NAME = "Great Health Potion", VALUE = 190},
  70. }
  71. },
  72.  
  73. COLORS = {SHADOW = -16119286, TITLE = -1128192, TEXT1 = -1, TEXT2 = -2968436, SUBTITLE = -33024, PROFIT = -9320847, WASTE = -3342336},
  74.  
  75. VERSION = "1.1"
  76. }
  77.  
  78. --[[ DONT EDIT NOTHING BELOW THIS LINE --]]
  79.  
  80. function formatnumber(n, s)
  81. local result, sign, before, after = '', string.match(tostring(n), '^([%+%-]?)(%d*)(%.?.*)$')
  82.  
  83. while #before > 3 do
  84. result = (s or '.') .. string.sub(before, -3, -1) .. result
  85. before = string.sub(before, 1, -4)
  86. end
  87.  
  88. return sign .. before .. result .. after
  89. end
  90.  
  91. function addcustomtext(TEXT, X, Y, COLOR)
  92. setfontcolor(rgbcolor(10, 10, 10))
  93. if CONFIG.DRAW_TYPE:upper() == "SHADOW" then
  94. addtext(TEXT, X + 1, Y + 1)
  95. elseif CONFIG.DRAW_TYPE:upper() == "BORDER" then
  96. addtext(TEXT, X + 1, Y + 1)
  97. addtext(TEXT, X - 1, Y - 1)
  98. addtext(TEXT, X - 1, Y + 1)
  99. addtext(TEXT, X + 1, Y - 1)
  100. addtext(TEXT, X, Y + 1)
  101. addtext(TEXT, X, Y - 1)
  102. addtext(TEXT, X + 1, Y)
  103. addtext(TEXT, X - 1, Y)
  104. end
  105. setfontcolor(COLOR)
  106. return addtext(TEXT, X, Y)
  107. end
  108.  
  109. local X, Y, INDEX, TOTAL, TOTAL_LOOTED, TOTAL_WASTED = (CONFIG.ORIENTATION:lower() == "right" and worldwin.right + 10
  110. or clientwin.left + 10) + CONFIG.POSITION.X, worldwin.top + 20 + CONFIG.POSITION.Y, 1, 0, 0, 0
  111.  
  112. addcustomtext(HUD.TITLE, X, Y, HUD.COLORS.TITLE)
  113.  
  114. Y = Y + 20
  115.  
  116. addcustomtext("ITEMS LOOTED:", X, Y, HUD.COLORS.SUBTITLE)
  117.  
  118. Y = Y + 5
  119.  
  120. for _, ITEM in ipairs(HUD.ITEMS.LOOT) do
  121. local ITEM_LOOTED = getitems(itemid(ITEM.NAME))
  122. if ITEM_LOOTED[ITEM_LOOTED.count - 1].loot > 0 then
  123. Y = Y + CONFIG.LINE_DISTANCE
  124. addcustomtext((#ITEM.NAME < CONFIG.MAX_TEXT_LENGTH and ITEM.NAME or ITEM.NAME:sub(1,
  125. CONFIG.MAX_TEXT_LENGTH) .. "..."):gsub("(%a)([%w_']*)", function(s1, s2) return s1:upper() .. s2:lower() end), X, Y,
  126. HUD.COLORS.TEXT1)
  127. addcustomtext(string.format("%s (%sk)", formatnumber(ITEM_LOOTED[0].loot), math.floor(ITEM_LOOTED[0].loot *
  128. (ITEM.VALUE or itemvalue(ITEM.NAME)) / 100) / 10), X + CONFIG.TEXT_DISTANCE, Y, HUD.COLORS.TEXT2)
  129. TOTAL, TOTAL_LOOTED = TOTAL + ITEM_LOOTED[0].loot * (ITEM.VALUE or itemvalue(ITEM.NAME)), TOTAL_LOOTED +
  130. (ITEM_LOOTED[0].loot * (ITEM.VALUE or itemvalue(ITEM.NAME)))
  131. end
  132. end
  133.  
  134. Y = Y + 20
  135.  
  136. addcustomtext("Total: ", X, Y, HUD.COLORS.TEXT2)
  137. addcustomtext(formatnumber(TOTAL_LOOTED) .. " GPs", X + CONFIG.TEXT_DISTANCE, Y, HUD.COLORS.TITLE)
  138.  
  139. Y = Y + 25
  140.  
  141. addcustomtext("ITEMS USED:", X, Y, HUD.COLORS.SUBTITLE)
  142.  
  143. Y = Y + 5
  144.  
  145. for _, ITEM in ipairs(HUD.ITEMS.SUPPLY) do
  146. local ITEM_USED = getitems(itemid(ITEM.NAME))
  147. if ITEM_USED[ITEM_USED.count - 1].usage > 0 then
  148. Y = Y + CONFIG.LINE_DISTANCE
  149.  
  150. addcustomtext((#ITEM.NAME < CONFIG.MAX_TEXT_LENGTH and ITEM.NAME or ITEM.NAME:sub(1, CONFIG.MAX_TEXT_LENGTH) .. "..."):gsub("(%a)([%w_']*)", function(s1, s2) return s1:upper() .. s2:lower() end), X, Y,
  151. HUD.COLORS.TEXT1)
  152. addcustomtext(string.format("%s (%sk)", formatnumber(ITEM_USED[0].usage), math.floor(ITEM_USED[0].usage *
  153. (ITEM.VALUE or itemvalue(ITEM.NAME)) / 100) / 10), X + CONFIG.TEXT_DISTANCE, Y, HUD.COLORS.TEXT2)
  154. TOTAL, TOTAL_WASTED = TOTAL - ITEM_USED[0].usage * (ITEM.VALUE or itemvalue(ITEM.NAME)), TOTAL_WASTED +
  155. (ITEM_USED[0].usage * (ITEM.VALUE or itemvalue(ITEM.NAME)))
  156. end
  157. end
  158.  
  159. Y = Y + 20
  160.  
  161. addcustomtext("Total: ", X, Y, HUD.COLORS.TEXT2)
  162. addcustomtext("-" .. formatnumber(TOTAL_WASTED) .. " GPs", X + CONFIG.TEXT_DISTANCE, Y, HUD.COLORS.TITLE)
  163.  
  164. Y = Y + 25
  165.  
  166. addcustomtext(TOTAL_LOOTED - TOTAL_WASTED >= 0 and "Profit:" or "Waste:", X, Y, TOTAL_LOOTED - TOTAL_WASTED >= 0
  167. and HUD.COLORS.PROFIT or HUD.COLORS.WASTE)
  168. addcustomtext(string.format("%s GPs (%s k/h)", formatnumber(TOTAL_LOOTED - TOTAL_WASTED), math.floor(((TOTAL_LOOTED -
  169. TOTAL_WASTED) / (tosec(timehunt) / 3600)) / 100) / 10), X + CONFIG.TEXT_DISTANCE, Y, TOTAL_LOOTED - TOTAL_WASTED
  170. >= 0 and HUD.COLORS.PROFIT or HUD.COLORS.WASTE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement