Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[v0.1] Hunting Hud (Check your profit!)
#1
Hello.

This HUD script will calculate your profit/loss based on looted and dropped items located on "Looter" tab and also check your used supplies on "Healer".
You should to add it to "Hud's" tab, NOT PERSISTENT'S.

SETUP
Basically, you just need to setup the table with every item and its prices that you wanna calculate to the profit/loss math.
You should include LOOT item (gold coin, etc.) and SUPPLY items (mana fluid, ultimate healing rune, etc.). There are some added already as example, for example:
[3031] = 1, --gold coin
3031 = gold coin id
1 = its value (in gold coins)
-- gold coin = just a comment to help to know what's it, not required.

You CAN also add items that are not on Healer/Targeting/Looter, but that you wanna display how many you have used. Notice that it will not COUNT (check if a item has been used), it will only add such items to be displayed on such categories.

local OTHER_SUPPLIES_ITEMS = { 'arrow', 'bolt' }
local OTHER_LOOTED_ITEMS = { '' }
local OTHER_DROPPED_ITEMS = { '' }

By default, it will add "Hunting Arrow" to the "Used Supplies" table.
REMEMBER that it will not count how many you have used, but only display. To count (add/sum) how many items you have used, you need to use "addhudsupply()", "addhudloot()", "addhuddropped()" on the persistent, cavebot action or whatever you used to you shoot the rune or count how many hunting arrows left.
|Only Registered members can see download links. | Click here to buy subscription or here to register.


Example:
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.loading="lazy" alt="[Image: BMhons2.png]" class="mycode_img" />

CODE:
--[[
      OTHER ITEMS
Those TABLES/LISTS must contain items that are not on healer, targeting or lootlist that you also want to be showed up on HUD.
Notice that it will not make Mastercores OTBot count such items, but only display on this HUD.

To count different items, you will need to such the following functions:
--addhudloot(string item) [void]: Add (+1) an item's count to loot's counter.
--sethudloot(string item, number count) [void]: Set an item's count to loot's counter.
--addhuddropped(string item) [void]: Add (+1) an item's count to droppeds' counter.
--sethuddropped(string item, number count) [void]: Add an item's count to droppeds' counter.
--addhudsupply(string item) [void]: Add (+1) an item's count to supplies' counter.
--sethudsupply(string item, number count) [void]: Set an item's count to supplies' counter.
Functions & Variables' thread:
|Only Registered members can see download links. | Click here to buy subscription or here to register.

--]]

local OTHER_SUPPLIES_ITEMS = { 'bolt', 'arrow' }
local OTHER_LOOTED_ITEMS = { '' }
local OTHER_DROPPED_ITEMS = { '' }

------------- Item's price ---------------
local itemsPrice = {
  [3031] = 1, --gold coin
  [3266] = 80, --battle axe
  [3349] = 160, --crossbow
  [3351] = 293, -- steel helmet
  [3264] = 25, -- sword
  [3286] = 30, -- mace
  [3446] = 2, -- bolt
   [3447] = 1, -- arrow
  [3160] = 150, --ultimate healing rune
}

--------------- START VARS ---------------

local clientwindow = { left = 0, top = 0 }

setfontcolor('white')
setpen('black', 2)

local yPos = 65

------------- Hunt Informations ---------------


setfillcolor('#3d79b2')
addrect(clientwindow.left + 5, yPos, 190, 20)
addtextstroke('Hunt Information\'s', clientwindow.left + 45, yPos + 2)
yPos = yPos + 22

local timeHunting = runningtime()
if timeHunting > 0 then
  addtextstroke('Hunting time: ' .. string.format("%.2d:%.2d:%.2d", timeHunting/(60*60), timeHunting/60%60, timeHunting%60) .. ' hours', clientwindow.left + 15, yPos)
else
  addtextstroke('Hunting time: 00:00:00', clientwindow.left + 15, yPos)
end
yPos = yPos + 20

addtextstroke('Exp gained: ' .. format(expgained()) .. ' (' .. format(exphour()) .. ' k/h)', clientwindow.left + 15, yPos)
yPos = yPos + 20

------------- Supplies ---------------

setfillcolor('#3d79b2')
addrect(clientwindow.left + 5, yPos, 190, 20)
addtextstroke('Used Supplies', clientwindow.left + 55, yPos + 2)

yPos = yPos + 22

local usedSupplies = getsupplyitems()
local TOTAL_SUPPLY_ITEMS = 0
local TOTAL_SUPPLY_WORTH = 0

setfontstyle('Tahoma', 10, 'B')
setfontcolor('#D2B48C')

for _, supply in ipairs(usedSupplies) do

  ITEM_SUPPLY_QUANTITY = supply.count
  if ITEM_SUPPLY_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[supply.id] or 0
      ITEM_SUPPLY_WORTH = ITEM_VALUE * ITEM_SUPPLY_QUANTITY

      TOTAL_SUPPLY_ITEMS = TOTAL_SUPPLY_ITEMS + ITEM_SUPPLY_QUANTITY
      TOTAL_SUPPLY_WORTH = TOTAL_SUPPLY_WORTH + ITEM_SUPPLY_WORTH
      local item_name = supply.name
      if item_name == '' then
          item_name = itemname(supply.id):gsub("^%l", string.upper)
      else
          item_name = item_name:gsub("^%l", string.upper)
      end

      addtextstroke(item_name .. ': ' .. format(supply.count) .. ' (' .. string.format("%.2f", (ITEM_SUPPLY_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end
for _, itemSupply in ipairs(OTHER_SUPPLIES_ITEMS) do
  local supplyId = itemid(itemSupply)
  ITEM_SUPPLY_QUANTITY = gethudsupply(supplyId)
  if ITEM_SUPPLY_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[supplyId] or 0
      ITEM_SUPPLY_WORTH = ITEM_VALUE * ITEM_SUPPLY_QUANTITY

      TOTAL_SUPPLY_ITEMS = TOTAL_SUPPLY_ITEMS + ITEM_SUPPLY_QUANTITY
      TOTAL_SUPPLY_WORTH = TOTAL_SUPPLY_WORTH + ITEM_SUPPLY_WORTH

      local item_name = itemname(itemSupply):gsub("^%l", string.upper)

      addtextstroke(item_name .. ': ' .. format(ITEM_SUPPLY_QUANTITY) .. ' (' .. string.format("%.2f", (ITEM_SUPPLY_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end

if TOTAL_SUPPLY_ITEMS == 0 then
  addtextstroke('-none-', clientwindow.left + 15, yPos)
  yPos = yPos + 20
else
  setfontcolor('#FFFFFF')
  addtextstroke('Total: ' .. TOTAL_SUPPLY_ITEMS .. ' items' .. ' (' .. string.format("%.2f", (TOTAL_SUPPLY_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
  yPos = yPos + 20
end


------------- Loots ---------------
setfillcolor('#3eb27a')
setfontcolor('#FFFFFF')
addrect(clientwindow.left + 5, yPos, 190, 20)
addtextstroke('Looted Items', clientwindow.left + 55, yPos + 2)

yPos = yPos + 22

local lootItems = getlootitems()
local TOTAL_LOOTED_ITEMS = 0
local TOTAL_LOOTED_WORTH = 0

setfontstyle('Tahoma', 10, 'B')
setfontcolor('#D2B48C')

for _, loot in ipairs(lootItems) do

  ITEM_LOOTED_QUANTITY = loot.count
  if ITEM_LOOTED_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[loot.id] or 0
      ITEM_LOOTED_WORTH = ITEM_VALUE * ITEM_LOOTED_QUANTITY

      TOTAL_LOOTED_ITEMS = TOTAL_LOOTED_ITEMS + ITEM_LOOTED_QUANTITY
      TOTAL_LOOTED_WORTH = TOTAL_LOOTED_WORTH + ITEM_LOOTED_WORTH

      local item_name = loot.name
      if item_name == '' then
          item_name = itemname(loot.id):gsub("^%l", string.upper)
      else
          item_name = item_name:gsub("^%l", string.upper)
      end

      addtextstroke(item_name .. ' (' .. loot.id .. '): ' .. format(loot.count) .. ' (' .. string.format("%.2f", (ITEM_LOOTED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end
for _, itemLoot in ipairs(OTHER_LOOTED_ITEMS) do

  local lootId = itemid(itemLoot)
  ITEM_LOOTED_QUANTITY = gethudloot(lootId)
  if ITEM_LOOTED_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[lootId] or 0
      ITEM_LOOTED_WORTH = ITEM_VALUE * ITEM_LOOTED_QUANTITY

      TOTAL_LOOTED_ITEMS = TOTAL_LOOTED_ITEMS + ITEM_LOOTED_QUANTITY
      TOTAL_LOOTED_WORTH = TOTAL_LOOTED_WORTH + ITEM_LOOTED_WORTH

      local item_name = itemname(itemLoot):gsub("^%l", string.upper)

      addtextstroke(item_name .. ' (' .. lootId .. '): ' .. format(ITEM_LOOTED_QUANTITY) .. ' (' .. string.format("%.2f", (ITEM_LOOTED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end

if TOTAL_LOOTED_ITEMS == 0 then
  addtextstroke('-none-', clientwindow.left + 15, yPos)
  yPos = yPos + 20
else
  setfontcolor('#FFFFFF')
  addtextstroke('Total: ' .. TOTAL_LOOTED_ITEMS .. ' items' .. ' (' .. string.format("%.2f", (TOTAL_LOOTED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
  yPos = yPos + 20
end

------------- Dropped ---------------
setfillcolor('#f7886f')
setfontcolor('#FFFFFF')
addrect(clientwindow.left + 5, yPos, 190, 20)
addtextstroke('Dropped Items', clientwindow.left + 55, yPos + 2)

yPos = yPos + 22

local droppedItems = getdroppeditems()
local TOTAL_DROPPED_ITEMS = 0
local TOTAL_DROPPED_WORTH = 0

setfontstyle('Tahoma', 10, 'B')
setfontcolor('#D2B48C')

for _, dropped in ipairs(droppedItems) do
  ITEM_DROPPED_QUANTITY = dropped.count
  if ITEM_DROPPED_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[dropped.id] or 0
      ITEM_DROPPED_WORTH = ITEM_VALUE * ITEM_DROPPED_QUANTITY

      TOTAL_DROPPED_ITEMS = TOTAL_DROPPED_ITEMS + ITEM_DROPPED_QUANTITY
      TOTAL_DROPPED_WORTH = TOTAL_DROPPED_WORTH + ITEM_DROPPED_WORTH

      local item_name = dropped.name
      if item_name == '' then
          item_name = itemname(dropped.id):gsub("^%l", string.upper)
      else
          item_name = item_name:gsub("^%l", string.upper)
      end

      addtextstroke(item_name .. ' (' .. dropped.id .. '): ' .. format(ITEM_DROPPED_QUANTITY) .. ' (' .. string.format("%.2f", (ITEM_DROPPED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end
for _, itemDropped in ipairs(OTHER_DROPPED_ITEMS) do

  local droppedId = itemid(itemLoot)
  ITEM_DROPPED_QUANTITY = gethuddropped(droppedId)
  if ITEM_DROPPED_QUANTITY > 0 then
      ITEM_VALUE = itemsPrice[droppedId] or 0
      ITEM_DROPPED_WORTH = ITEM_VALUE * ITEM_DROPPED_QUANTITY

      TOTAL_DROPPED_ITEMS = TOTAL_DROPPED_ITEMS + ITEM_DROPPED_QUANTITY
      TOTAL_DROPPED_WORTH = TOTAL_DROPPED_WORTH + ITEM_DROPPED_WORTH

      local item_name = itemname(dropped.id):gsub("^%l", string.upper)


      addtextstroke(item_name .. ' (' .. droppedId .. '): ' .. format(ITEM_DROPPED_QUANTITY) .. ' (' .. string.format("%.2f", (ITEM_DROPPED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
      yPos = yPos + 20
  end
end

if TOTAL_DROPPED_ITEMS == 0 then
  addtextstroke('-none-', clientwindow.left + 15, yPos)
  yPos = yPos + 20
else
  setfontcolor('#FFFFFF')
  addtextstroke('Total: ' .. TOTAL_DROPPED_ITEMS .. ' items' .. ' (' .. string.format("%.2f", (TOTAL_DROPPED_WORTH / 100) / 10) .. 'K)', clientwindow.left + 15, yPos)
  yPos = yPos + 20
end

setfontstyle('Tahoma', 10, 'B')
local HUNT_CALC = TOTAL_DROPPED_WORTH + TOTAL_LOOTED_WORTH - TOTAL_SUPPLY_WORTH
local HUNT_CALC_K = string.format("%.2f", (HUNT_CALC / 100) / 10)
if HUNT_CALC >= 0 then
  setfontcolor('#3cb231')
  addtextstroke('PROFIT: ' .. HUNT_CALC_K .. 'K (' .. string.format("%.2f", ((((HUNT_CALC * 3600) / runningtime()) / 100) / 10)) .. ' Ks/H)', clientwindow.left + 15, yPos)
else
  setfontcolor('#b23131')
  addtextstroke('WASTE: ' .. HUNT_CALC_K .. 'K (' .. string.format("%.2f", ((((HUNT_CALC * 3600) / runningtime()) / 100) / 10)) .. ' Ks/H)', clientwindow.left + 15, yPos)
end
yPos = yPos + 20



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016