Advertisement
Guest User

Untitled

a guest
Jan 28th, 2014
1,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.86 KB | None | 0 0
  1. --[[
  2.     Name: iBot Loot Counter HUD
  3.     Version: v1.0.0
  4.     Last Updated: 21 Jan 2014
  5. ]]--
  6.  
  7.  
  8. HUD = {
  9.  
  10.     TITLE = "iBot Loot Counter",
  11.  
  12.     CONFIG = {
  13.         ORIENTATION = "right",
  14.         START_POSITION = {35, 25},
  15.         MAX_TEXT_LENGTH = 15,
  16.         TEXT_DISTANCE = 115,
  17.         LINE_DISTANCE = 12,
  18.     },
  19.  
  20.     ITEMS =
  21.     {
  22.         LOOT = getlootitems(),
  23.  
  24.         SUPPLY =
  25.     {
  26.             {NAME = "mana potion", VALUE = 50},
  27.             {NAME = "strong mana potion", VALUE = 80},
  28.             {NAME = "great mana potion", VALUE = 120},
  29.             {NAME = "health potion", VALUE = 45},
  30.             {NAME = "strong health potion", VALUE = 100},
  31.             {NAME = "great health potion", VALUE = 190},
  32.             {NAME = "ultimate health potion", VALUE = 310},
  33.             {NAME = "Assassin Star", VALUE = 100},
  34.             {NAME = "prismatic bolt", VALUE = 20},
  35.             {NAME = "crystalline arrow", VALUE = 20},
  36.             {NAME = "great fireball rune", VALUE = 45},
  37.             {NAME = "sudden death rune", VALUE = 108},
  38.             {NAME = "avalanche rune", VALUE = 45},
  39.             {NAME = "icicle rune", VALUE = 30},
  40.             {NAME = "fireball rune", VALUE = 30},
  41.             {NAME = "thunderstorm rune", VALUE = 37},
  42.             {NAME = "Soft Boots", VALUE = 10000},
  43.             {NAME = "Rust Remover", VALUE = 50}
  44.         }
  45.     },
  46.  
  47.     --[[ Just edit below if you know what you're doing --]]
  48.  
  49.     COLORS = {
  50.     SHADOW = rgbcolor(10, 10, 10),
  51.     TITLE = rgbcolor(255, 165, 0),
  52.     TEXT1 = rgbcolor(205, 200, 177),
  53.     TEXT2 = rgbcolor(255, 255, 255),
  54.     SUBTITLE = rgbcolor(30, 144, 255),
  55.     PROFIT = rgbcolor(107, 142, 35),
  56.     WASTE = rgbcolor(178, 34, 34),
  57.     },
  58.  
  59.     VERSION = "1.0"
  60. }
  61.  
  62. --[[ DONT EDIT NOTHING BELOW THIS LINE --]]
  63.  
  64. function formatnumber(n, s)
  65.     local result, sign, before, after = '', string.match(tostring(n), '^([%+%-]?)(%d*)(%.?.*)$')
  66.  
  67.     while #before > 3 do
  68.         result = (s or '.') .. string.sub(before, -3, -1) .. result
  69.         before = string.sub(before, 1, -4)
  70.     end
  71.  
  72.     return sign .. before .. result .. after
  73. end
  74.  
  75. 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
  76.  
  77. setfontcolor(HUD.COLORS.TITLE)
  78. addtextstroke(HUD.TITLE, X, Y)
  79.  
  80. Y = Y + 20
  81.  
  82. -- ADDED HUNTING INFORMATION PART BY SHANP
  83.  
  84.     setfontcolor(HUD.COLORS.SUBTITLE)
  85.     addtextstroke("HUNTING INFORMATION:", X, Y)
  86.     Y = Y + 20
  87.    
  88.     local STATNAME = {"Level", "Exp/h (Ibot info)", "Exp/h (Tibia info)", "Exp Gained", "Exp to level", "Time to level", "Time Played", "Bank Balance", "Cursor ID", "Stamina"}
  89.     local STATVALUE = {level, formatnumber(exphour), formatnumber(tibiaexphour), formatnumber(expgained), formatnumber(exptolevel()), timetolevel, timehunt, formatnumber(balance), cursorinfo().id, (math.floor(stamina/60)..":"..string.format("%02s", (stamina-60*math.floor(stamina/60)))) }
  90.    
  91.     for i=1, #STATNAME do
  92.         setfontcolor(HUD.COLORS.TEXT1)
  93.         addtextstroke(STATNAME[i], X, Y)
  94.         setfontcolor(HUD.COLORS.TEXT2)
  95.         if i > 9 then
  96.             if stamina > 2400 then
  97.             setfontcolor(HUD.COLORS.PROFIT)
  98.             elseif stamina < 840 then
  99.             setfontcolor(HUD.COLORS.WASTE)
  100.             else setfontcolor(HUD.COLORS.TITLE)
  101.             end
  102.         end
  103.     addtextstroke(STATVALUE[i], X+HUD.CONFIG.TEXT_DISTANCE, Y)
  104.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  105.     end
  106.  
  107.     local ENGINE = {"Cavebot", "Looting", "Targeting"}
  108.     local ENGINEVALUE = {cavebot, looting, targeting}
  109.     for i=1, #ENGINE do
  110.         setfontcolor(HUD.COLORS.TEXT1)
  111.         addtextstroke(ENGINE[i], X, Y)
  112.         setfontcolor(HUD.COLORS.TEXT2)
  113.             if ENGINEVALUE[i] then
  114.             setfontcolor(HUD.COLORS.PROFIT)
  115.             addtextstroke("ON", X+HUD.CONFIG.TEXT_DISTANCE, Y)
  116.             else
  117.             setfontcolor(HUD.COLORS.WASTE)
  118.             addtextstroke("OFF", X+HUD.CONFIG.TEXT_DISTANCE, Y)
  119.             end
  120.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  121.     end
  122. Y = Y + 20
  123. --- END OF ADDED PART
  124.  
  125.  
  126. setfontcolor(HUD.COLORS.SUBTITLE)
  127. addtextstroke("ITEMS LOOTED:", X, Y)
  128.  
  129. Y = Y + 5
  130.  
  131. local lootqtd = HUD.ITEMS.LOOT.count-1
  132.  
  133. for it = 0, lootqtd do
  134.     local ITEM = HUD.ITEMS.LOOT[it]
  135.     if ITEM.lootmessage > 0 then
  136.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  137.  
  138.     local itemvalue = ITEM.npcsell
  139.     if ITEM.custom ~= 0 then
  140.         itemvalue = ITEM.custom
  141.     end
  142.  
  143.     setfontcolor(HUD.COLORS.TEXT1)
  144.         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)
  145.  
  146.     setfontcolor(HUD.COLORS.TEXT2)
  147.     addtextstroke(string.format("%s (%s k)", formatnumber(ITEM.lootmessage), math.floor(ITEM.lootmessage * itemvalue / 100) / 10), X + HUD.CONFIG.TEXT_DISTANCE, Y)
  148.  
  149.         TOTAL, TOTAL_LOOTED = TOTAL + ITEM.lootmessage * itemvalue, TOTAL_LOOTED + (ITEM.lootmessage * itemvalue)
  150.     end
  151. end
  152.  
  153. Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
  154.  
  155. setfontcolor(HUD.COLORS.TEXT2)
  156. addtextstroke("Total: ", X, Y)
  157.  
  158. setfontcolor(HUD.COLORS.TITLE)
  159. addtextstroke(formatnumber(TOTAL_LOOTED) .. " GPs", X+35, Y)
  160.  
  161. Y = Y + 25
  162.  
  163. setfontcolor(HUD.COLORS.SUBTITLE)
  164. addtextstroke("SUPPLIES USED:", X, Y)
  165.  
  166. Y = Y + 5
  167.  
  168. for _, ITEM in ipairs(HUD.ITEMS.SUPPLY) do
  169.     local ITEM_USED = itemproperty(ITEM.NAME)
  170.     if ITEM_USED.usagemessage > 0 then
  171.         Y = Y + HUD.CONFIG.LINE_DISTANCE
  172.  
  173.     setfontcolor(HUD.COLORS.TEXT1)
  174.         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)
  175.  
  176.     setfontcolor(HUD.COLORS.TEXT2)
  177.     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)
  178.  
  179.         TOTAL, TOTAL_WASTED = TOTAL - ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)), TOTAL_WASTED + (ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)))
  180.     end
  181. end
  182.  
  183. Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
  184.  
  185. setfontcolor(HUD.COLORS.TEXT2)
  186. addtextstroke("Total: ", X, Y)
  187.  
  188. setfontcolor(HUD.COLORS.TITLE)
  189. addtextstroke("-" .. formatnumber(TOTAL_WASTED) .. " GPs", X + 35, Y)
  190.  
  191. Y = Y + 25
  192.  
  193. setfontcolor(TOTAL_LOOTED - TOTAL_WASTED >= 0 and HUD.COLORS.PROFIT or HUD.COLORS.WASTE)
  194. 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