Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.08 KB | None | 0 0
  1. HUD = {
  2.  
  3.     TITLE = "DRAKKE'S SCRIPTS",
  4.  
  5.     CONFIG = {
  6.     ORIENTATION = "left",
  7.     START_POSITION = {10, 20},
  8.         MAX_TEXT_LENGTH = 15,
  9.         TEXT_DISTANCE = 110,
  10.         LINE_DISTANCE = 12,
  11.     },
  12.  
  13.     ITEMS =
  14.     {
  15.         LOOT = getlootitems(),
  16.  
  17.         SUPPLY =
  18.     {
  19.             {NAME = "mana potion", VALUE = 50},
  20.             {NAME = "strong mana potion", VALUE = 80},
  21.             {NAME = "great mana potion", VALUE = 120},
  22.             {NAME = "health potion", VALUE = 45},
  23.             {NAME = "strong health potion", VALUE = 100},
  24.             {NAME = "great health potion", VALUE = 190},
  25.             {NAME = "ultimate health potion", VALUE = 310},
  26.             {NAME = "Assassin Star", VALUE = 100},
  27.             {NAME = "prismatic bolt", VALUE = 20},
  28.             {NAME = "crystalline arrow", VALUE = 20},
  29.             {NAME = "great fireball rune", VALUE = 45},
  30.             {NAME = "sudden death rune", VALUE = 108},
  31.             {NAME = "avalanche rune", VALUE = 45},
  32.             {NAME = "icicle rune", VALUE = 30},
  33.             {NAME = "fireball rune", VALUE = 30},
  34.             {NAME = "thunderstorm rune", VALUE = 37},
  35.             {NAME = "Soft Boots", VALUE = 10000},
  36.             {NAME = "Rust Remover", VALUE = 50}
  37.         }
  38.     },
  39.  
  40.     --[[ Just edit below if you know what you're doing --]]
  41.  
  42.     COLORS = {
  43.     SHADOW = rgbcolor(0, 0, 0),
  44.     TITLE = rgbcolor(205, 200, 177),
  45.     TEXT1 = rgbcolor(205, 200, 177),
  46.     TEXT2 = rgbcolor(255, 255, 255),
  47.     SUBTITLE = rgbcolor(210, 20, 10),
  48.     TOTALLOOT = rgbcolor(107, 142, 35),
  49.     TOTALSUPS = rgbcolor(178, 34, 34),
  50.     PROFIT = rgbcolor(107, 142, 35),
  51.     WASTE = rgbcolor(178, 34, 34),
  52.     },
  53.  
  54.     VERSION = "1.0"
  55. }
  56.  
  57. --[[ DONT EDIT NOTHING BELOW THIS LINE --]]
  58.  
  59. function formatnumber(n, s)
  60.     local result, sign, before, after = '', string.match(tostring(n), '^([%+%-]?)(%d*)(%.?.*)$')
  61.  
  62.     while #before > 3 do
  63.         result = (s or '.') .. string.sub(before, -3, -1) .. result
  64.         before = string.sub(before, 1, -4)
  65.     end
  66.  
  67.     return sign .. before .. result .. after
  68. end
  69.  
  70. local X, Y, INDEX, TOTAL, TOTAL_LOOTED, TOTAL_WASTED = (HUD.CONFIG.ORIENTATION:lower() == "right" and worldwin.right + 10 or clientwin.left + 10) + HUD.CONFIG.START_POSITION[1], worldwin.top + 10 + HUD.CONFIG.START_POSITION[2], 1, 0, 0, 0
  71.  
  72. setfontcolor(HUD.COLORS.TITLE)
  73. addtextstroke(HUD.TITLE, X, Y)
  74.  
  75. Y = Y + 20
  76.  
  77. setfontcolor(HUD.COLORS.SUBTITLE)
  78. addtextstroke("ITEMS LOOTED:", X, Y)
  79.  
  80. Y = Y + 5
  81.  
  82. local lootqtd = HUD.ITEMS.LOOT.count-1
  83.  
  84. for it = 0, lootqtd do
  85.     local ITEM = HUD.ITEMS.LOOT[it]
  86.     if ITEM.lootmessage > 0 then
  87.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  88.  
  89.     local itemvalue = ITEM.npcsell
  90.     if ITEM.custom ~= 0 then
  91.         itemvalue = ITEM.custom
  92.     end
  93.  
  94.     setfontcolor(HUD.COLORS.TEXT1)
  95.         addtextstroke((#ITEM.NAME < HUD.CONFIG.MAX_TEXT_LENGTH and ITEM.NAME or ITEM.NAME:sub(1, HUD.CONFIG.MAX_TEXT_LENGTH) .. "..."):gsub("(%a)([%w_']*)", function(s1, s2) return s1:upper() .. s2:lower() end), X, Y)
  96.  
  97.     setfontcolor(HUD.COLORS.TEXT2)
  98.     addtextstroke(string.format("%s (%s k)", formatnumber(ITEM.lootmessage), math.floor(ITEM.lootmessage * itemvalue / 100) / 10), X + HUD.CONFIG.TEXT_DISTANCE, Y)
  99.  
  100.         TOTAL, TOTAL_LOOTED = TOTAL + ITEM.lootmessage * itemvalue, TOTAL_LOOTED + (ITEM.lootmessage * itemvalue)
  101.     end
  102. end
  103.  
  104. Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
  105.  
  106. setfontcolor(HUD.COLORS.TEXT2)
  107. addtextstroke("Total: ", X, Y)
  108.  
  109. setfontcolor(HUD.COLORS.TOTALLOOT)
  110. addtextstroke("+" .. formatnumber(TOTAL_LOOTED) .. " GPs", X+35, Y)
  111.  
  112. Y = Y + 25
  113.  
  114. setfontcolor(HUD.COLORS.SUBTITLE)
  115. addtextstroke("SUPPLIES USED:", X, Y)
  116.  
  117. Y = Y + 5
  118.  
  119. for _, ITEM in ipairs(HUD.ITEMS.SUPPLY) do
  120.     local ITEM_USED = itemproperty(ITEM.NAME)
  121.     if ITEM_USED.usagemessage > 0 then
  122.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  123.  
  124.     setfontcolor(HUD.COLORS.TEXT1)
  125.         addtextstroke((#ITEM.NAME < HUD.CONFIG.MAX_TEXT_LENGTH and ITEM.NAME or ITEM.NAME:sub(1, HUD.CONFIG.MAX_TEXT_LENGTH) .. "..."):gsub("(%a)([%w_']*)", function(s1, s2) return s1:upper() .. s2:lower() end), X, Y)
  126.  
  127.     setfontcolor(HUD.COLORS.TEXT2)
  128.     addtextstroke(string.format("%s (%sk)", formatnumber(ITEM_USED.usagemessage), math.floor(ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)) / 100) / 10), X + HUD.CONFIG.TEXT_DISTANCE, Y)
  129.  
  130.         TOTAL, TOTAL_WASTED = TOTAL - ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)), TOTAL_WASTED + (ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)))
  131.     end
  132. end
  133.  
  134. Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
  135.  
  136. setfontcolor(HUD.COLORS.TEXT2)
  137. addtextstroke("Total: ", X, Y)
  138.  
  139. setfontcolor(HUD.COLORS.TOTALSUPS)
  140. addtextstroke("-" .. formatnumber(TOTAL_WASTED) .. " GPs", X + 35, Y)
  141.  
  142. Y = Y + 25
  143.  
  144. setfontcolor(TOTAL_LOOTED - TOTAL_WASTED >= 0 and HUD.COLORS.PROFIT or HUD.COLORS.WASTE)
  145. addtextstroke(string.format("%s %s GPs (%s k/h)", TOTAL_LOOTED - TOTAL_WASTED >= 0 and "PROFIT:" or "WASTE:", formatnumber(TOTAL_LOOTED - TOTAL_WASTED), math.floor(((TOTAL_LOOTED - TOTAL_WASTED) / (tosec(timehunt) / 3600)) / 100) / 10), X, Y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement