Results 1 to 6 of 6

Thread: Loot counter not working

  1. #1
    Normal User
    Join Date
    Apr 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    3

    Question Loot counter not working

    My loot counter seems to only show how much mana's i have wasted and doesnt count any loot collected at all. Anybody here that knows what the problem could be ?

  2. #2
    Banned
    Join Date
    Jan 2013
    Posts
    1,792
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    76 Post(s)
    Reputation
    191
    Rep Power
    0
    probably you use MMH and you didn't change getnewmsg from 19 to 20. Use the New ibot Counter HUD, if you want use the old one (MMH) post it here and i will edit it for you.

    Lua Code:
     
    --[[
        Name: iBot Loot Counter HUD
        Version: v1.0.0
        Last Updated: 21 Jan 2014
    ]]--
     
     
    HUD = {
     
        TITLE = "iBot Loot Counter",
     
        CONFIG = {
            ORIENTATION = "right",
            START_POSITION = {35, 25},
            MAX_TEXT_LENGTH = 15,
            TEXT_DISTANCE = 115,
            LINE_DISTANCE = 12,
        },
     
        ITEMS =
        {
            LOOT = getlootitems(),
     
            SUPPLY =
        {
                {NAME = "mana potion", VALUE = 50},
                {NAME = "strong mana potion", VALUE = 80},
                {NAME = "great mana potion", VALUE = 120},
                {NAME = "health potion", VALUE = 45},
                {NAME = "strong health potion", VALUE = 100},
                {NAME = "great health potion", VALUE = 190},
                {NAME = "ultimate health potion", VALUE = 310},
                {NAME = "Assassin Star", VALUE = 100},
                {NAME = "prismatic bolt", VALUE = 20},
                {NAME = "crystalline arrow", VALUE = 20},
                {NAME = "great fireball rune", VALUE = 45},
                {NAME = "sudden death rune", VALUE = 108},
                {NAME = "avalanche rune", VALUE = 45},
                {NAME = "icicle rune", VALUE = 30},
                {NAME = "fireball rune", VALUE = 30},
                {NAME = "thunderstorm rune", VALUE = 37},
                {NAME = "Soft Boots", VALUE = 10000},
                {NAME = "Rust Remover", VALUE = 50}
            }
        },
     
        --[[ Just edit below if you know what you're doing --]]
     
        COLORS = {
        SHADOW = rgbcolor(10, 10, 10),
        TITLE = rgbcolor(255, 165, 0),
        TEXT1 = rgbcolor(205, 200, 177),
        TEXT2 = rgbcolor(255, 255, 255),
        SUBTITLE = rgbcolor(30, 144, 255),
        PROFIT = rgbcolor(107, 142, 35),
        WASTE = rgbcolor(178, 34, 34),
        },
     
        VERSION = "1.0"
    }
     
    --[[ DONT EDIT NOTHING BELOW THIS LINE --]]
     
    function formatnumber(n, s)
        local result, sign, before, after = '', string.match(tostring(n), '^([%+%-]?)(%d*)(%.?.*)$')
     
        while #before > 3 do
            result = (s or '.') .. string.sub(before, -3, -1) .. result
            before = string.sub(before, 1, -4)
        end
     
        return sign .. before .. result .. after
    end
     
    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
     
    setfontcolor(HUD.COLORS.TITLE)
    addtextstroke(HUD.TITLE, X, Y)
     
    Y = Y + 20
     
    setfontcolor(HUD.COLORS.SUBTITLE)
    addtextstroke("ITEMS LOOTED:", X, Y)
     
    Y = Y + 5
     
    local lootqtd = HUD.ITEMS.LOOT.count-1
     
    for it = 0, lootqtd do
        local ITEM = HUD.ITEMS.LOOT[it]
        if ITEM.lootmessage > 0 then
            Y = Y + HUD.CONFIG.LINE_DISTANCE
     
        local itemvalue = ITEM.npcsell
        if ITEM.custom ~= 0 then
            itemvalue = ITEM.custom
        end
     
        setfontcolor(HUD.COLORS.TEXT1)
            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)
     
        setfontcolor(HUD.COLORS.TEXT2)
        addtextstroke(string.format("%s (%s k)", formatnumber(ITEM.lootmessage), math.floor(ITEM.lootmessage * itemvalue / 100) / 10), X + HUD.CONFIG.TEXT_DISTANCE, Y)
     
            TOTAL, TOTAL_LOOTED = TOTAL + ITEM.lootmessage * itemvalue, TOTAL_LOOTED + (ITEM.lootmessage * itemvalue)
        end
    end
     
    Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
     
    setfontcolor(HUD.COLORS.TEXT2)
    addtextstroke("Total: ", X, Y)
     
    setfontcolor(HUD.COLORS.TITLE)
    addtextstroke(formatnumber(TOTAL_LOOTED) .. " GPs", X+35, Y)
     
    Y = Y + 25
     
    setfontcolor(HUD.COLORS.SUBTITLE)
    addtextstroke("SUPPLIES USED:", X, Y)
     
    Y = Y + 5
     
    for _, ITEM in ipairs(HUD.ITEMS.SUPPLY) do
        local ITEM_USED = itemproperty(ITEM.NAME)
        if ITEM_USED.usagemessage > 0 then
            Y = Y + HUD.CONFIG.LINE_DISTANCE
     
        setfontcolor(HUD.COLORS.TEXT1)
            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)
     
        setfontcolor(HUD.COLORS.TEXT2)
        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)
     
            TOTAL, TOTAL_WASTED = TOTAL - ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)), TOTAL_WASTED + (ITEM_USED.usagemessage * (ITEM.VALUE or itemvalue(ITEM.NAME)))
        end
    end
     
    Y = Y + HUD.CONFIG.LINE_DISTANCE + 2
     
    setfontcolor(HUD.COLORS.TEXT2)
    addtextstroke("Total: ", X, Y)
     
    setfontcolor(HUD.COLORS.TITLE)
    addtextstroke("-" .. formatnumber(TOTAL_WASTED) .. " GPs", X + 35, Y)
     
    Y = Y + 25
     
    setfontcolor(TOTAL_LOOTED - TOTAL_WASTED >= 0 and HUD.COLORS.PROFIT or HUD.COLORS.WASTE)
    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)

  3. #3
    Normal User
    Join Date
    Apr 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    3
    Lua Code:
    -- [[ INIT START ]] --
        --
        --                       88                                                                
        --                       ""                                                ,d              
        --                                                                         88              
        --            ,adPPYba,  88  8b,dPPYba,  88,dPYba,,adPYba,   ,adPPYYba,  MM88MMM  ,adPPYba,
        --            I8[    ""  88  88P'   "Y8  88P'   "88"    "8a  ""     `Y8    88    a8P_____88
        --             `"Y8ba,   88  88          88      88      88  ,adPPPPP88    88    8PP"""""""
        --            aa    ]8I  88  88          88      88      88  88,    ,88    88,   "8b,   ,aa
        --   Author:  `"YbbdP"'  88  88          88      88      88  `"8bbdP"Y8    "Y888  `"Ybbd8"'
        --   
        --   Monitor My Hunting!
        --
        --   Version: 1.0
        --   Created: 7.09.2012
        --   Last update: 18.09.2012
        --
     
        MONITOR_MY_HUNTING = MONITOR_MY_HUNTING or {
        SCRIPT_NAME = "Gothic Scripts Tarpit Tomb Flame -3 MS/ED",
        SCRIPT_VERSION = "1.1",
     
            CLEARED_STATS = false,
            INITIALIZED = false,
        }
     
        MONITOR_MY_HUNTING.SHOW_ALL_ITEMS = false
        MONITOR_MY_HUNTING.ITEMS_LIST = {
            {NAME = "Gold Coin", VALUE = 1},
            {NAME = "Ghoul Snack", VALUE = 60},
            {NAME = "Rotten Piece of Cloth", VALUE = 30},
            {NAME = "Brown piece of Cloth", VALUE = 100},
            {NAME = "Pile of Grave Earth", VALUE = 25},
            {NAME = "Life Ring", VALUE = 600},
            {NAME = "Flask of Embalming Fluid", VALUE = 30},
            {NAME = "Gauze Bandage", VALUE = 90},
            {NAME = "Silver Brooch", VALUE = 150},
            {NAME = "Black pearl", VALUE = 280},
            {NAME = "Crystal Ring", VALUE = 250},
            {NAME = "Yellow Piece of Cloth", VALUE = 150},
            {NAME = "Black Shield", VALUE = 800},
            {NAME = "Mini Mummy", VALUE = 300000},
            {NAME = "Half-Digested piece of meat", VALUE = 55},
            {NAME = "Small Diamond", VALUE = 300},
            {NAME = "Demonic Skeletal Hand", VALUE = 80},
            {NAME = "Health Potion", VALUE = 40},
            {NAME = "Mana Potion", VALUE = 50},
            {NAME = "Small Ruby", VALUE = 250},
            {NAME = "Guardian Shield", VALUE = 2000},
            {NAME = "Vampire Teeth", VALUE = 275},
            {NAME = "Blood Preservation", VALUE = 320},
            {NAME = "Strong Health Potion", VALUE = 70},
            {NAME = "Spike Sword", VALUE = 1000},
            {NAME = "Ice Rapier", VALUE = 100},
            {NAME = "Vampire Shield", VALUE = 15000},
            {NAME = "Emerald Bangle", VALUE = 900},
            {NAME = "Bony Tail", VALUE = 210},
            {NAME = "Green Mushroom", VALUE = 100},
            {NAME = "Hardened Bone", VALUE = 5000},
            {NAME = "Bonebeast Trophy", VALUE = 6000},
            {NAME = "Stone Wing", VALUE = 120},
            {NAME = "Sulphurous Stone", VALUE = 100},
            {NAME = "Ancient Stone", VALUE = 200},
            {NAME = "Iron ore", VALUE = 500},
            {NAME = "Shiny Stone", VALUE = 500},
            {NAME = "Red Gem", VALUE = 1000},
            }
     
        MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES = false
        MONITOR_MY_HUNTING.SUPPLIES_LIST = {
            {NAME = "Strong Mana Potion", PRICE = 80},
            {NAME = "Prismatic Bolt", PRICE = 20},
            {NAME = "Power Bolt", PRICE = 7},   
            {NAME = "Drill Bolt", PRICE = 12},  
            {NAME = "Royal spear", PRICE = 20},  
            {NAME = "Crystalline Arrow", PRICE = 20},   
        }
     
        -- [[ DO NOT CHANGE ANYTHING BELOW THIS LINE. ]] --
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST = MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or {}
        MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST or {}
        MONITOR_MY_HUNTING.COLORS = MONITOR_MY_HUNTING.COLORS or {
            BLACK = rgbcolor(1, 1, 1),
            ORANGE = rgbcolor(255, 165, 0),
            BLUE = rgbcolor(30, 144, 255),
            CORNSILK = rgbcolor(205, 200, 177),
            WHITE = rgbcolor(255, 255, 255),
            GREEN = rgbcolor(107, 142, 35),
            RED = rgbcolor(178, 34, 34),
        }
     
        local function CreateMessageObject(MESSAGE_DATA)
            if (type(MESSAGE_DATA) ~= "userdata") then
                return setmetatable({__data = {TYPE = -1, TIME_STAMP = -1, SENDER_NAME = "", SENDER_LEVEL = -1, CONTENT = ""}}, MessageMetaTable)
            else
                return setmetatable({__data = {TYPE = MESSAGE_DATA.type, TIME_STAMP = Misc.ConvertToSeconds(string.sub(MESSAGE_DATA.text  , 1, 5)), SENDER_NAME = MESSAGE_DATA.sender, SENDER_LEVEL = tonumber((tostring(string.match(MESSAGE_DATA.text, ".+ (%b[]): .+")):gsub("[^%d]", ""))) or 0, CONTENT = string.sub(MESSAGE_DATA.text, 7)}}, MessageMetaTable)
            end
        end
     
        local function addtextshadow(DISPLAY_TEXT, X_OFFSET, Y_OFFSET, FONT_COLOR)
            setfontcolor(MONITOR_MY_HUNTING.COLORS.BLACK)
            addtext(DISPLAY_TEXT, X_OFFSET + 1, Y_OFFSET + 1)
            setfontcolor(FONT_COLOR)
            addtext(DISPLAY_TEXT, X_OFFSET, Y_OFFSET)
        end
    -- [[ INIT END ]] --
     
    if (not Stats.Update()) then
        local SERVER_LOG_MESSAGES = getnewmessages("Server Log")
        local SERVER_LOG_MESSAGES_COUNT = SERVER_LOG_MESSAGES.count - 1
     
        for INDEX = 0, SERVER_LOG_MESSAGES_COUNT do
            local MESSAGE_OBJECT = CreateMessageObject(SERVER_LOG_MESSAGES[SERVER_LOG_MESSAGES_COUNT - INDEX])
     
            if (MESSAGE_OBJECT:Type() == 19 and MESSAGE_OBJECT:Content():lower():match("^loot of")) then
                local LOOT_INFO = Message.ParseLootMessage(MESSAGE_OBJECT, true)
     
                if (#LOOT_INFO.NAME > 0) then
                    Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] = (Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] or 0) + 1
     
                    for _, LOOT_ITEM in ipairs(LOOT_INFO.ITEMS) do
                        if (Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID]) then
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY = Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY + LOOT_ITEM.QUANTITY
                        else
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID] = {ID = LOOT_ITEM.ID, NAME = LOOT_ITEM.NAME, QUANTITY = LOOT_ITEM.QUANTITY, VALUE = Item.GetValue(LOOT_ITEM.ID)}
                        end
                    end
                end
            end
        end
    end
     
    local RESET_ITEMS_AND_SUPPLIES = <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .ITEMS_LIST ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .SUPPLIES_LIST ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            if (LOOT_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].NAME or LOOT_ITEM.VALUE ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].VALUE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            if (SUPPLY_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].NAME or SUPPLY_ITEM.PRICE ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].PRICE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not MONITOR_MY_HUNTING.INITIALIZED or RESET_ITEMS_AND_SUPPLIES) then
        if (not MONITOR_MY_HUNTING.CLEARED_STATS) then
            Stats.Clear(CLEAR_STATS_ALL)
            Stats.Update()
     
            MONITOR_MY_HUNTING.CLEARED_STATS = true
        end
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = {}, {}
     
        for _, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            local LOOT_ITEM_ID = Item.GetID(type(LOOT_ITEM.NAME) ~= "table" and LOOT_ITEM.NAME or unpack(LOOT_ITEM.NAME))
     
            Stats.AddItemsLooted(LOOT_ITEM_ID, 0, LOOT_ITEM.VALUE)
            table.insert(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, {ID = LOOT_ITEM_ID, NAME = LOOT_ITEM.NAME, VALUE = LOOT_ITEM.VALUE})
        end
     
        for _, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            local SUPPLY_ITEM_ID = Item.GetID(type(SUPPLY_ITEM.NAME) ~= "table" and SUPPLY_ITEM.NAME or unpack(SUPPLY_ITEM.NAME))
     
            Stats.AddSuppliesUsed(SUPPLY_ITEM_ID, 0, SUPPLY_ITEM.PRICE)
            table.insert(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST  , {ID = SUPPLY_ITEM_ID, NAME = SUPPLY_ITEM.NAME, PRICE = SUPPLY_ITEM.PRICE})
        end
     
        MONITOR_MY_HUNTING.INITIALIZED = true
    end
     
    setposition(Client.ClientWindow().left, Client.WorldWindow().top + 5)
     
    local Y_POSITION, INDEX, ITEMS_LOOTED_WORTH, SUPPLIES_USED_WORTH = 30, 0, 0, 0
     
    addtextshadow(sprintf("%s v%s", MONITOR_MY_HUNTING.SCRIPT_NAME:upper(), MONITOR_MY_HUNTING.SCRIPT_VERSION), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("ITEMS LOOTED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, LOOT_ITEM in pairs(Stats.GetItemsLooted()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_ITEMS or table.find(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, LOOT_ITEM.ID, "ID")) and LOOT_ITEM.QUANTITY > 0) then
        addtextshadow(((#LOOT_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(LOOT_ITEM.NAME, 1, 17), "(.-)%s?$"))) or LOOT_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
        addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(LOOT_ITEM.QUANTITY), tostring(math.floor(LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
        INDEX, ITEMS_LOOTED_WORTH = INDEX + 1, ITEMS_LOOTED_WORTH + (LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(ITEMS_LOOTED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("SUPPLIES USED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, SUPPLY_ITEM in pairs(Stats.GetSuppliesUsed()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES or table.find(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST, SUPPLY_ITEM.ID, "ID")) and SUPPLY_ITEM.QUANTITY > 0) then
            addtextshadow(((#SUPPLY_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(SUPPLY_ITEM.NAME, 1, 17), "(.-)%s?$"))) or SUPPLY_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
            addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(SUPPLY_ITEM.QUANTITY), tostring(math.floor(SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
            INDEX, SUPPLIES_USED_WORTH = INDEX + 1, SUPPLIES_USED_WORTH + (SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(SUPPLIES_USED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow(sprintf("%s: %s GPs (%s K/H)", ((ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and ("PROFIT")) or ("WASTE")), Misc.FormatNumber(ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH), tostring(math.floor(((ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH) * 3600) / (System.HuntingTime() / 1000) / 100) / 10)), 10, Y_POSITION + (INDEX * 16), ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and MONITOR_MY_HUNTING.COLORS.GREEN or MONITOR_MY_HUNTING.COLORS.RED)
    Last edited by shanp; 04-11-2014 at 07:14 PM. Reason: [luas][./luas]

  4. #4
    Premium User Eldar's Avatar
    Join Date
    Apr 2013
    Location
    Poland
    Posts
    1,335
    Mentioned
    37 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    62 Post(s)
    Reputation
    159
    Rep Power
    7
    Lua Code:
    -- [[ INIT START ]] --
        --
        --                       88                                                                
        --                       ""                                                ,d              
        --                                                                         88              
        --            ,adPPYba,  88  8b,dPPYba,  88,dPYba,,adPYba,   ,adPPYYba,  MM88MMM  ,adPPYba,
        --            I8[    ""  88  88P'   "Y8  88P'   "88"    "8a  ""     `Y8    88    a8P_____88
        --             `"Y8ba,   88  88          88      88      88  ,adPPPPP88    88    8PP"""""""
        --            aa    ]8I  88  88          88      88      88  88,    ,88    88,   "8b,   ,aa
        --   Author:  `"YbbdP"'  88  88          88      88      88  `"8bbdP"Y8    "Y888  `"Ybbd8"'
        --   
        --   Monitor My Hunting!
        --
        --   Version: 1.0
        --   Created: 7.09.2012
        --   Last update: 18.09.2012
        --
     
        MONITOR_MY_HUNTING = MONITOR_MY_HUNTING or {
        SCRIPT_NAME = "Gothic Scripts Tarpit Tomb Flame -3 MS/ED",
        SCRIPT_VERSION = "1.1",
     
            CLEARED_STATS = false,
            INITIALIZED = false,
        }
     
        MONITOR_MY_HUNTING.SHOW_ALL_ITEMS = false
        MONITOR_MY_HUNTING.ITEMS_LIST = {
            {NAME = "Gold Coin", VALUE = 1},
            {NAME = "Ghoul Snack", VALUE = 60},
            {NAME = "Rotten Piece of Cloth", VALUE = 30},
            {NAME = "Brown piece of Cloth", VALUE = 100},
            {NAME = "Pile of Grave Earth", VALUE = 25},
            {NAME = "Life Ring", VALUE = 600},
            {NAME = "Flask of Embalming Fluid", VALUE = 30},
            {NAME = "Gauze Bandage", VALUE = 90},
            {NAME = "Silver Brooch", VALUE = 150},
            {NAME = "Black pearl", VALUE = 280},
            {NAME = "Crystal Ring", VALUE = 250},
            {NAME = "Yellow Piece of Cloth", VALUE = 150},
            {NAME = "Black Shield", VALUE = 800},
            {NAME = "Mini Mummy", VALUE = 300000},
            {NAME = "Half-Digested piece of meat", VALUE = 55},
            {NAME = "Small Diamond", VALUE = 300},
            {NAME = "Demonic Skeletal Hand", VALUE = 80},
            {NAME = "Health Potion", VALUE = 40},
            {NAME = "Mana Potion", VALUE = 50},
            {NAME = "Small Ruby", VALUE = 250},
            {NAME = "Guardian Shield", VALUE = 2000},
            {NAME = "Vampire Teeth", VALUE = 275},
            {NAME = "Blood Preservation", VALUE = 320},
            {NAME = "Strong Health Potion", VALUE = 70},
            {NAME = "Spike Sword", VALUE = 1000},
            {NAME = "Ice Rapier", VALUE = 100},
            {NAME = "Vampire Shield", VALUE = 15000},
            {NAME = "Emerald Bangle", VALUE = 900},
            {NAME = "Bony Tail", VALUE = 210},
            {NAME = "Green Mushroom", VALUE = 100},
            {NAME = "Hardened Bone", VALUE = 5000},
            {NAME = "Bonebeast Trophy", VALUE = 6000},
            {NAME = "Stone Wing", VALUE = 120},
            {NAME = "Sulphurous Stone", VALUE = 100},
            {NAME = "Ancient Stone", VALUE = 200},
            {NAME = "Iron ore", VALUE = 500},
            {NAME = "Shiny Stone", VALUE = 500},
            {NAME = "Red Gem", VALUE = 1000},
            }
     
        MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES = false
        MONITOR_MY_HUNTING.SUPPLIES_LIST = {
            {NAME = "Strong Mana Potion", PRICE = 80},
            {NAME = "Prismatic Bolt", PRICE = 20},
            {NAME = "Power Bolt", PRICE = 7},   
            {NAME = "Drill Bolt", PRICE = 12},  
            {NAME = "Royal spear", PRICE = 20},  
            {NAME = "Crystalline Arrow", PRICE = 20},   
        }
     
        -- [[ DO NOT CHANGE ANYTHING BELOW THIS LINE. ]] --
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST = MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or {}
        MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST or {}
        MONITOR_MY_HUNTING.COLORS = MONITOR_MY_HUNTING.COLORS or {
            BLACK = rgbcolor(1, 1, 1),
            ORANGE = rgbcolor(255, 165, 0),
            BLUE = rgbcolor(30, 144, 255),
            CORNSILK = rgbcolor(205, 200, 177),
            WHITE = rgbcolor(255, 255, 255),
            GREEN = rgbcolor(107, 142, 35),
            RED = rgbcolor(178, 34, 34),
        }
     
        local function CreateMessageObject(MESSAGE_DATA)
            if (type(MESSAGE_DATA) ~= "userdata") then
                return setmetatable({__data = {TYPE = -1, TIME_STAMP = -1, SENDER_NAME = "", SENDER_LEVEL = -1, CONTENT = ""}}, MessageMetaTable)
            else
                return setmetatable({__data = {TYPE = MESSAGE_DATA.type, TIME_STAMP = Misc.ConvertToSeconds(string.sub(MESSAGE_DATA.text  , 1, 5)), SENDER_NAME = MESSAGE_DATA.sender, SENDER_LEVEL = tonumber((tostring(string.match(MESSAGE_DATA.text, ".+ (%b[]): .+")):gsub("[^%d]", ""))) or 0, CONTENT = string.sub(MESSAGE_DATA.text, 7)}}, MessageMetaTable)
            end
        end
     
        local function addtextshadow(DISPLAY_TEXT, X_OFFSET, Y_OFFSET, FONT_COLOR)
            setfontcolor(MONITOR_MY_HUNTING.COLORS.BLACK)
            addtext(DISPLAY_TEXT, X_OFFSET + 1, Y_OFFSET + 1)
            setfontcolor(FONT_COLOR)
            addtext(DISPLAY_TEXT, X_OFFSET, Y_OFFSET)
        end
    -- [[ INIT END ]] --
     
    if (not Stats.Update()) then
        local SERVER_LOG_MESSAGES = getnewmessages("Server Log")
        local SERVER_LOG_MESSAGES_COUNT = SERVER_LOG_MESSAGES.count - 1
     
        for INDEX = 0, SERVER_LOG_MESSAGES_COUNT do
            local MESSAGE_OBJECT = CreateMessageObject(SERVER_LOG_MESSAGES[SERVER_LOG_MESSAGES_COUNT - INDEX])
     
            if (MESSAGE_OBJECT:Type() == 20 and MESSAGE_OBJECT:Content():lower():match("^loot of")) then
                local LOOT_INFO = Message.ParseLootMessage(MESSAGE_OBJECT, true)
     
                if (#LOOT_INFO.NAME > 0) then
                    Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] = (Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] or 0) + 1
     
                    for _, LOOT_ITEM in ipairs(LOOT_INFO.ITEMS) do
                        if (Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID]) then
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY = Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY + LOOT_ITEM.QUANTITY
                        else
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID] = {ID = LOOT_ITEM.ID, NAME = LOOT_ITEM.NAME, QUANTITY = LOOT_ITEM.QUANTITY, VALUE = Item.GetValue(LOOT_ITEM.ID)}
                        end
                    end
                end
            end
        end
    end
     
    local RESET_ITEMS_AND_SUPPLIES = <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .ITEMS_LIST ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .SUPPLIES_LIST ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            if (LOOT_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].NAME or LOOT_ITEM.VALUE ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].VALUE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            if (SUPPLY_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].NAME or SUPPLY_ITEM.PRICE ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].PRICE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not MONITOR_MY_HUNTING.INITIALIZED or RESET_ITEMS_AND_SUPPLIES) then
        if (not MONITOR_MY_HUNTING.CLEARED_STATS) then
            Stats.Clear(CLEAR_STATS_ALL)
            Stats.Update()
     
            MONITOR_MY_HUNTING.CLEARED_STATS = true
        end
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = {}, {}
     
        for _, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            local LOOT_ITEM_ID = Item.GetID(type(LOOT_ITEM.NAME) ~= "table" and LOOT_ITEM.NAME or unpack(LOOT_ITEM.NAME))
     
            Stats.AddItemsLooted(LOOT_ITEM_ID, 0, LOOT_ITEM.VALUE)
            table.insert(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, {ID = LOOT_ITEM_ID, NAME = LOOT_ITEM.NAME, VALUE = LOOT_ITEM.VALUE})
        end
     
        for _, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            local SUPPLY_ITEM_ID = Item.GetID(type(SUPPLY_ITEM.NAME) ~= "table" and SUPPLY_ITEM.NAME or unpack(SUPPLY_ITEM.NAME))
     
            Stats.AddSuppliesUsed(SUPPLY_ITEM_ID, 0, SUPPLY_ITEM.PRICE)
            table.insert(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST  , {ID = SUPPLY_ITEM_ID, NAME = SUPPLY_ITEM.NAME, PRICE = SUPPLY_ITEM.PRICE})
        end
     
        MONITOR_MY_HUNTING.INITIALIZED = true
    end
     
    setposition(Client.ClientWindow().left, Client.WorldWindow().top + 5)
     
    local Y_POSITION, INDEX, ITEMS_LOOTED_WORTH, SUPPLIES_USED_WORTH = 30, 0, 0, 0
     
    addtextshadow(sprintf("%s v%s", MONITOR_MY_HUNTING.SCRIPT_NAME:upper(), MONITOR_MY_HUNTING.SCRIPT_VERSION), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("ITEMS LOOTED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, LOOT_ITEM in pairs(Stats.GetItemsLooted()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_ITEMS or table.find(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, LOOT_ITEM.ID, "ID")) and LOOT_ITEM.QUANTITY > 0) then
        addtextshadow(((#LOOT_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(LOOT_ITEM.NAME, 1, 17), "(.-)%s?$"))) or LOOT_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
        addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(LOOT_ITEM.QUANTITY), tostring(math.floor(LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
        INDEX, ITEMS_LOOTED_WORTH = INDEX + 1, ITEMS_LOOTED_WORTH + (LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(ITEMS_LOOTED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("SUPPLIES USED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, SUPPLY_ITEM in pairs(Stats.GetSuppliesUsed()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES or table.find(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST, SUPPLY_ITEM.ID, "ID")) and SUPPLY_ITEM.QUANTITY > 0) then
            addtextshadow(((#SUPPLY_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(SUPPLY_ITEM.NAME, 1, 17), "(.-)%s?$"))) or SUPPLY_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
            addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(SUPPLY_ITEM.QUANTITY), tostring(math.floor(SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
            INDEX, SUPPLIES_USED_WORTH = INDEX + 1, SUPPLIES_USED_WORTH + (SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(SUPPLIES_USED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow(sprintf("%s: %s GPs (%s K/H)", ((ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and ("PROFIT")) or ("WASTE")), Misc.FormatNumber(ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH), tostring(math.floor(((ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH) * 3600) / (System.HuntingTime() / 1000) / 100) / 10)), 10, Y_POSITION + (INDEX * 16), ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and MONITOR_MY_HUNTING.COLORS.GREEN or MONITOR_MY_HUNTING.COLORS.RED)

  5. #5
    Banned
    Join Date
    Jan 2013
    Posts
    1,792
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    76 Post(s)
    Reputation
    191
    Rep Power
    0
    Lua Code:
     
    -- [[ INIT START ]] --
        --
        --                       88                                                                
        --                       ""                                                ,d              
        --                                                                         88              
        --            ,adPPYba,  88  8b,dPPYba,  88,dPYba,,adPYba,   ,adPPYYba,  MM88MMM  ,adPPYba,
        --            I8[    ""  88  88P'   "Y8  88P'   "88"    "8a  ""     `Y8    88    a8P_____88
        --             `"Y8ba,   88  88          88      88      88  ,adPPPPP88    88    8PP"""""""
        --            aa    ]8I  88  88          88      88      88  88,    ,88    88,   "8b,   ,aa
        --   Author:  `"YbbdP"'  88  88          88      88      88  `"8bbdP"Y8    "Y888  `"Ybbd8"'
        --   
        --   Monitor My Hunting!
        --
        --   Version: 1.0
        --   Created: 7.09.2012
        --   Last update: 18.09.2012
        --
     
        MONITOR_MY_HUNTING = MONITOR_MY_HUNTING or {
        SCRIPT_NAME = "Gothic Scripts Tarpit Tomb Flame -3 MS/ED",
        SCRIPT_VERSION = "1.1",
     
            CLEARED_STATS = false,
            INITIALIZED = false,
        }
     
        MONITOR_MY_HUNTING.SHOW_ALL_ITEMS = false
        MONITOR_MY_HUNTING.ITEMS_LIST = {
            {NAME = "Gold Coin", VALUE = 1},
            {NAME = "Ghoul Snack", VALUE = 60},
            {NAME = "Rotten Piece of Cloth", VALUE = 30},
            {NAME = "Brown piece of Cloth", VALUE = 100},
            {NAME = "Pile of Grave Earth", VALUE = 25},
            {NAME = "Life Ring", VALUE = 600},
            {NAME = "Flask of Embalming Fluid", VALUE = 30},
            {NAME = "Gauze Bandage", VALUE = 90},
            {NAME = "Silver Brooch", VALUE = 150},
            {NAME = "Black pearl", VALUE = 280},
            {NAME = "Crystal Ring", VALUE = 250},
            {NAME = "Yellow Piece of Cloth", VALUE = 150},
            {NAME = "Black Shield", VALUE = 800},
            {NAME = "Mini Mummy", VALUE = 300000},
            {NAME = "Half-Digested piece of meat", VALUE = 55},
            {NAME = "Small Diamond", VALUE = 300},
            {NAME = "Demonic Skeletal Hand", VALUE = 80},
            {NAME = "Health Potion", VALUE = 40},
            {NAME = "Mana Potion", VALUE = 50},
            {NAME = "Small Ruby", VALUE = 250},
            {NAME = "Guardian Shield", VALUE = 2000},
            {NAME = "Vampire Teeth", VALUE = 275},
            {NAME = "Blood Preservation", VALUE = 320},
            {NAME = "Strong Health Potion", VALUE = 70},
            {NAME = "Spike Sword", VALUE = 1000},
            {NAME = "Ice Rapier", VALUE = 100},
            {NAME = "Vampire Shield", VALUE = 15000},
            {NAME = "Emerald Bangle", VALUE = 900},
            {NAME = "Bony Tail", VALUE = 210},
            {NAME = "Green Mushroom", VALUE = 100},
            {NAME = "Hardened Bone", VALUE = 5000},
            {NAME = "Bonebeast Trophy", VALUE = 6000},
            {NAME = "Stone Wing", VALUE = 120},
            {NAME = "Sulphurous Stone", VALUE = 100},
            {NAME = "Ancient Stone", VALUE = 200},
            {NAME = "Iron ore", VALUE = 500},
            {NAME = "Shiny Stone", VALUE = 500},
            {NAME = "Red Gem", VALUE = 1000},
            }
     
        MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES = false
        MONITOR_MY_HUNTING.SUPPLIES_LIST = {
            {NAME = "Strong Mana Potion", PRICE = 80},
            {NAME = "Prismatic Bolt", PRICE = 20},
            {NAME = "Power Bolt", PRICE = 7},   
            {NAME = "Drill Bolt", PRICE = 12},  
            {NAME = "Royal spear", PRICE = 20},  
            {NAME = "Crystalline Arrow", PRICE = 20},   
        }
     
        -- [[ DO NOT CHANGE ANYTHING BELOW THIS LINE. ]] --
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST = MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or {}
        MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST or {}
        MONITOR_MY_HUNTING.COLORS = MONITOR_MY_HUNTING.COLORS or {
            BLACK = rgbcolor(1, 1, 1),
            ORANGE = rgbcolor(255, 165, 0),
            BLUE = rgbcolor(30, 144, 255),
            CORNSILK = rgbcolor(205, 200, 177),
            WHITE = rgbcolor(255, 255, 255),
            GREEN = rgbcolor(107, 142, 35),
            RED = rgbcolor(178, 34, 34),
        }
     
        local function CreateMessageObject(MESSAGE_DATA)
            if (type(MESSAGE_DATA) ~= "userdata") then
                return setmetatable({__data = {TYPE = -1, TIME_STAMP = -1, SENDER_NAME = "", SENDER_LEVEL = -1, CONTENT = ""}}, MessageMetaTable)
            else
                return setmetatable({__data = {TYPE = MESSAGE_DATA.type, TIME_STAMP = Misc.ConvertToSeconds(string.sub(MESSAGE_DATA.text  , 1, 5)), SENDER_NAME = MESSAGE_DATA.sender, SENDER_LEVEL = tonumber((tostring(string.match(MESSAGE_DATA.text, ".+ (%b[]): .+")):gsub("[^%d]", ""))) or 0, CONTENT = string.sub(MESSAGE_DATA.text, 7)}}, MessageMetaTable)
            end
        end
     
        local function addtextshadow(DISPLAY_TEXT, X_OFFSET, Y_OFFSET, FONT_COLOR)
            setfontcolor(MONITOR_MY_HUNTING.COLORS.BLACK)
            addtext(DISPLAY_TEXT, X_OFFSET + 1, Y_OFFSET + 1)
            setfontcolor(FONT_COLOR)
            addtext(DISPLAY_TEXT, X_OFFSET, Y_OFFSET)
        end
    -- [[ INIT END ]] --
     
    if (not Stats.Update()) then
        local SERVER_LOG_MESSAGES = getnewmessages("Server Log")
        local SERVER_LOG_MESSAGES_COUNT = SERVER_LOG_MESSAGES.count - 1
     
        for INDEX = 0, SERVER_LOG_MESSAGES_COUNT do
            local MESSAGE_OBJECT = CreateMessageObject(SERVER_LOG_MESSAGES[SERVER_LOG_MESSAGES_COUNT - INDEX])
     
            if (MESSAGE_OBJECT:Type() == 20 and MESSAGE_OBJECT:Content():lower():match("^loot of")) then
                local LOOT_INFO = Message.ParseLootMessage(MESSAGE_OBJECT, true)
     
                if (#LOOT_INFO.NAME > 0) then
                    Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] = (Stats.__data.MONSTERS_KILLED[LOOT_INFO.NAME] or 0) + 1
     
                    for _, LOOT_ITEM in ipairs(LOOT_INFO.ITEMS) do
                        if (Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID]) then
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY = Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID].QUANTITY + LOOT_ITEM.QUANTITY
                        else
                            Stats.__data.ITEMS_LOOTED[LOOT_ITEM.ID] = {ID = LOOT_ITEM.ID, NAME = LOOT_ITEM.NAME, QUANTITY = LOOT_ITEM.QUANTITY, VALUE = Item.GetValue(LOOT_ITEM.ID)}
                        end
                    end
                end
            end
        end
    end
     
    local RESET_ITEMS_AND_SUPPLIES = <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .ITEMS_LIST ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST or <a href="http://www.tibiaibot.com/forum/usertag.php?do=list&action=hash&hash=MONITOR_MY_HUNTING" target="_blank">#MONITOR_MY_HUNTING</a> .SUPPLIES_LIST ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            if (LOOT_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].NAME or LOOT_ITEM.VALUE ~= MONITOR_MY_HUNTING.TEMP_ITEMS_LIST[INDEX].VALUE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not RESET_ITEMS_AND_SUPPLIES) then
        for INDEX, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            if (SUPPLY_ITEM.NAME ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].NAME or SUPPLY_ITEM.PRICE ~= MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST[INDEX].PRICE) then
                RESET_ITEMS_AND_SUPPLIES = true
                break
            end
        end
    end
     
    if (not MONITOR_MY_HUNTING.INITIALIZED or RESET_ITEMS_AND_SUPPLIES) then
        if (not MONITOR_MY_HUNTING.CLEARED_STATS) then
            Stats.Clear(CLEAR_STATS_ALL)
            Stats.Update()
     
            MONITOR_MY_HUNTING.CLEARED_STATS = true
        end
     
        MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST = {}, {}
     
        for _, LOOT_ITEM in ipairs(MONITOR_MY_HUNTING.ITEMS_LIST) do
            local LOOT_ITEM_ID = Item.GetID(type(LOOT_ITEM.NAME) ~= "table" and LOOT_ITEM.NAME or unpack(LOOT_ITEM.NAME))
     
            Stats.AddItemsLooted(LOOT_ITEM_ID, 0, LOOT_ITEM.VALUE)
            table.insert(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, {ID = LOOT_ITEM_ID, NAME = LOOT_ITEM.NAME, VALUE = LOOT_ITEM.VALUE})
        end
     
        for _, SUPPLY_ITEM in ipairs(MONITOR_MY_HUNTING.SUPPLIES_LIST) do
            local SUPPLY_ITEM_ID = Item.GetID(type(SUPPLY_ITEM.NAME) ~= "table" and SUPPLY_ITEM.NAME or unpack(SUPPLY_ITEM.NAME))
     
            Stats.AddSuppliesUsed(SUPPLY_ITEM_ID, 0, SUPPLY_ITEM.PRICE)
            table.insert(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST  , {ID = SUPPLY_ITEM_ID, NAME = SUPPLY_ITEM.NAME, PRICE = SUPPLY_ITEM.PRICE})
        end
     
        MONITOR_MY_HUNTING.INITIALIZED = true
    end
     
    setposition(Client.ClientWindow().left, Client.WorldWindow().top + 5)
     
    local Y_POSITION, INDEX, ITEMS_LOOTED_WORTH, SUPPLIES_USED_WORTH = 30, 0, 0, 0
     
    addtextshadow(sprintf("%s v%s", MONITOR_MY_HUNTING.SCRIPT_NAME:upper(), MONITOR_MY_HUNTING.SCRIPT_VERSION), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("ITEMS LOOTED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, LOOT_ITEM in pairs(Stats.GetItemsLooted()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_ITEMS or table.find(MONITOR_MY_HUNTING.TEMP_ITEMS_LIST, LOOT_ITEM.ID, "ID")) and LOOT_ITEM.QUANTITY > 0) then
        addtextshadow(((#LOOT_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(LOOT_ITEM.NAME, 1, 17), "(.-)%s?$"))) or LOOT_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
        addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(LOOT_ITEM.QUANTITY), tostring(math.floor(LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
        INDEX, ITEMS_LOOTED_WORTH = INDEX + 1, ITEMS_LOOTED_WORTH + (LOOT_ITEM.VALUE * LOOT_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(ITEMS_LOOTED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow("SUPPLIES USED", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.BLUE)
     
    Y_POSITION = Y_POSITION + 20
     
    for _, SUPPLY_ITEM in pairs(Stats.GetSuppliesUsed()) do
        if ((MONITOR_MY_HUNTING.SHOW_ALL_SUPPLIES or table.find(MONITOR_MY_HUNTING.TEMP_SUPPLIES_LIST, SUPPLY_ITEM.ID, "ID")) and SUPPLY_ITEM.QUANTITY > 0) then
            addtextshadow(((#SUPPLY_ITEM.NAME > 17 and sprintf("%s...", string.match(string.sub(SUPPLY_ITEM.NAME, 1, 17), "(.-)%s?$"))) or SUPPLY_ITEM.NAME):ucwords(), 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.CORNSILK)
            addtextshadow(sprintf("%s (%sK)", Misc.FormatNumber(SUPPLY_ITEM.QUANTITY), tostring(math.floor(SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY / 100) / 10)), 140, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
     
            INDEX, SUPPLIES_USED_WORTH = INDEX + 1, SUPPLIES_USED_WORTH + (SUPPLY_ITEM.PRICE * SUPPLY_ITEM.QUANTITY)
        end
    end
     
    addtextshadow("Total:", 10, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.WHITE)
    addtextshadow(sprintf("%s GPs", Misc.FormatNumber(SUPPLIES_USED_WORTH)), 10 + 35, Y_POSITION + (INDEX * 16), MONITOR_MY_HUNTING.COLORS.ORANGE)
     
    Y_POSITION = Y_POSITION + 20
     
    addtextshadow(sprintf("%s: %s GPs (%s K/H)", ((ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and ("PROFIT")) or ("WASTE")), Misc.FormatNumber(ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH), tostring(math.floor(((ITEMS_LOOTED_WORTH - SUPPLIES_USED_WORTH) * 3600) / (System.HuntingTime() / 1000) / 100) / 10)), 10, Y_POSITION + (INDEX * 16), ITEMS_LOOTED_WORTH >= SUPPLIES_USED_WORTH and MONITOR_MY_HUNTING.COLORS.GREEN or MONITOR_MY_HUNTING.COLORS.RED)


    EDIT - you were faster eldar. ;( I'm sad.
    Last edited by ampegox; 04-11-2014 at 02:58 PM.

  6. #6
    Normal User
    Join Date
    Apr 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    3
    Ty really much for the help guys really appriciate it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •