Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- init start
- -- Created by Hultin
- -- 2014-02-19 - Updated 2014-03-10
- -- Thanks to:
- -- Rafael (Borrowed code)
- -- Sirmate (Colors and inspiration)
- -- Lucas Terra (Making Tibia worth playing again "playing")
- -- Dworak (Suggestions)
- local scriptinfo = {
- name = "Yalahar - Monsters",
- items = {
- {"Author", "Hultin"},
- {"Version", "1.0.0"},
- },
- development = false,
- -- Set to true if you wish to see coordinates and such.
- -- Can also be toggled using the +/- sign next to scriptname.
- }
- -- Taken from Sirmate's MMH
- local gradient = {
- blue = {0.0, color(36, 68, 105, 20), 0.23, color(39, 73, 114, 20), 0.76, color(21, 39, 60, 20)},
- black = {0.0, color(75, 75, 75, 20), 0.23, color(45, 45, 45, 20), 0.76, color(19, 19, 19, 20)},
- red = {0.0, color(136, 35, 12, 20), 0.23, color(139, 37, 13, 20), 0.76, color(92, 6, 6, 20)},
- green = {0.0, color(65, 96, 12, 20), 0.23, color(67, 99, 13, 20), 0.76, color(36, 52, 6, 20)},
- yellow = {0.0, color(145, 95, 0, 20), 0.23, color(158, 104, 0, 20), 0.76, color(84, 55, 0, 20)},
- }
- -- Engines taken from Raphael "Engine states"
- local engines = {'Cavebot', 'Looting', 'Targeting', 'Spell Healer', 'Potion Healer', 'Condition Healer', 'Mana Trainer'}
- -- Show hide sections variables
- local showbotting = true
- local showcharacter = true
- -- Toggle all function
- function togglestates(state)
- for _, e in ipairs(engines) do
- setsetting(e.name:gsub(' ', '') .. '/Enabled', state)
- end
- end
- -- keys, mouseclicks, mousemoves, stealfocus
- filterinput(false, true, false, false)
- function firstToUpper(str)
- return (str:gsub("^%l", string.upper))
- end
- local Moving, Temp, Moved = false, {0, 0}, {0, 0}
- toggleallstate = true
- function inputevents(e)
- if e.type == IEVENT_LMOUSEUP then
- for _, v in ipairs(engines) do
- if e.elementid == v.shape then
- toggle(v.name:gsub(' ', '') .. '/Enabled')
- return
- end
- end
- if e.elementid == config then
- if (scriptinfo.development) then
- scriptinfo.development = false
- else
- scriptinfo.development = true
- end
- end
- -- Start / Stop all
- if e.elementid == toggleall then
- if(toggleallstate) then
- togglestates("no")
- toggleallstate = false
- else
- togglestates("yes")
- toggleallstate = true
- end
- end
- -- Show/Hide Botting
- if e.elementid == showhidebotting then
- if(showbotting) then
- showbotting = false
- else
- showbotting = true
- end
- end
- if e.elementid == showhidechar then
- if(showcharacter) then
- showcharacter = false
- else
- showcharacter = true
- end
- end
- end
- if (e.type == IEVENT_MMOUSEDOWN) then
- Moving, Temp = true, {$cursor.x - Moved[1], $cursor.y - Moved[2]}
- end
- if (e.type == IEVENT_MMOUSEUP) then
- Moving = false
- end
- end
- -- Credit to Raphael
- for k, v in ipairs(engines) do
- engines[k] = {
- name = v,
- shape = nil
- }
- end
- -- Do not edit
- local hud = {
- author = "Hultin",
- version = "1.1.0",
- }
- -- Credit to SIRMATE
- function WeaponSkill()
- local SkillTypes = {
- ['axe'] = {type = 'axe', skill = $axe, skillpc = $axepc},
- ['club'] = {type = 'club', skill = $club, skillpc = $clubpc},
- ['sword'] = {type = 'sword', skill = $sword, skillpc = $swordpc},
- ['bow'] = {type = 'distance', skill = $distance, skillpc = $distancepc},
- ['distance weapon'] = {type = 'distance', skill = $distance, skillpc = $distancepc},
- ['no weapon'] = {type = 'fist', skill = $fist, skillpc = $fistpc},
- ['rod'] = {type = 'magic', skill = $mlevel, skillpc = $mlevelpc},
- ['wand'] = {type = 'magic', skill = $mlevel, skillpc = $mlevelpc},
- }
- return SkillTypes[findweapontype()]
- end
- -- Function by Donatello
- function getsecs(msg)
- local times = {
- a = '+',
- h = '* 3600',
- m = '* 60',
- s = '* 1'
- }
- local time = msg:gsub(' (%l)(%l+)', ' %1'):gsub('(%l)', function( t ) return times[t] end)
- return loadstring('return ' .. time)()
- end
- init end
- if (Moving) then
- auto(10)
- Moved = {$cursor.x - Temp[1], $cursor.y - Temp[2]}
- end
- setposition($clientwin.left + 5 + Moved[1], $worldwin.top + Moved[2])
- setfontstyle('Tahoma', 8, 75, 0xFFFFFF, 1, 0x000000)
- setfillstyle('gradient', 'linear', 2, 0, 0, 0, 21)
- setbordercolor(color(0, 0, 0, 50))
- setantialiasing(true)
- function minuteorhour()
- local t = $timetonextlevel
- if(t > 60 and t < 120) then
- v = "hour"
- elseif(t > 120) then
- v = "hours"
- else
- v = "min"
- end
- return v
- end
- local total, online = 0,0
- function viptext()
- foreach vipentry v do
- total = total +1
- if(v.isonline) then
- online = online + 1
- end
- end
- return total..' ('..online..')'
- end
- local softDuration = time(softTime) or 0;
- local bottingstats = {
- {"Experience", num($exp)..' exp'},
- {"Experience/hour", num($exphour)},
- {"Experience left", num(exptolevel())..' exp'},
- {"Experience gained", num($expgained)..' exp'},
- {"Time online", time(math.floor($timems / 1000))},
- {"Time to level", time(timetolevel())..minuteorhour()..'~'}, -- Minutes work, hours don't. Need fix.
- {"Ping", $ping .. ' (avg: ' .. $pingaverage .. ')'},
- }
- local offskill = WeaponSkill() or {type = 'magic', skill = $mlevel, skillpc = $mlevelpc}
- local characterstats = {
- {"Level", $level .. ' (' .. 100 - math.floor(($exp - expatlvl($level)) * 100 / (expatlvl($level + 1) - expatlvl($level))) .. '%)'},
- {firstToUpper(offskill.type)..' level', offskill.skill .. ' (' .. 100 - offskill.skillpc .. '%)'},
- {"Balance", num($balance)},
- {"Stamina", time($stamina)},
- {"Softboots duration", softDuration},
- {"Vip (Online)", viptext()}
- }
- local lastypos = 0
- -- Script info
- addgradcolors(table.unpack(gradient.blue))
- header3 = addshape('rect', 0, lastypos, 250, 20, 3, 3)
- addtext(scriptinfo.name, 8, lastypos+3)
- -- Devbutton start
- if(scriptinfo.development) then
- addgradcolors(table.unpack(gradient.red))
- config = addshape('rect', 230, lastypos, 20, 20, 3, 3)
- addtext("-", 238, lastypos+3)
- else
- addgradcolors(table.unpack(gradient.green))
- config = addshape('rect', 230, lastypos, 20, 20, 3, 3)
- addtext("+", 236, lastypos+3)
- end
- -- Devbutton end
- for k, v in ipairs(scriptinfo.items) do
- lastypos = lastypos + 23
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos, 140, 20, 3, 3)
- addtext(v[1], 8, lastypos + 3)
- addgradcolors(table.unpack(gradient.yellow))
- addshape('rect', 140, lastypos, 110, 20, 3, 3)
- addtext(v[2], 150, lastypos + 3)
- end
- lastypos = lastypos + 23
- -- Engine states
- addgradcolors(table.unpack(gradient.blue))
- header = addshape('rect', 0, lastypos, 250, 20, 3, 3)
- addtext('Engine states', 8, lastypos + 3)
- -- Toggle all
- if(toggleallstate) then
- addgradcolors(table.unpack(gradient.green))
- toggleall = addshape('rect', 198, lastypos, 52, 20, 3, 3)
- addtext("ALL ON", 206, lastypos+3)
- else
- addgradcolors(table.unpack(gradient.red))
- toggleall = addshape('rect', 198, lastypos, 52, 20, 3, 3)
- addtext("ALL OFF", 204, lastypos+3)
- end
- local isEnabled
- for k, v in ipairs(engines) do
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos + 23, 200, 20, 3, 3)
- addtext(v.name, 6, lastypos + 26)
- isEnabled = get(v.name:gsub(' ', '') .. '/Enabled') == 'yes'
- addgradcolors(table.unpack(tern(isEnabled, gradient.green, gradient.red)))
- engines[k].shape = addshape('rect', 198, lastypos + 23, 52, 20, 3, 3)
- addtext(tern(isEnabled, 'ON', 'OFF'), 213 + tern(isEnabled, 2, 0), lastypos + 26)
- lastypos = lastypos + 23
- end
- lastypos = lastypos+23
- -- Botting stats
- addgradcolors(table.unpack(gradient.blue))
- header = addshape('rect', 0, lastypos, 250, 20, 3, 3)
- addtext('Botting stats', 8, lastypos+3)
- -- Show/Hide button
- if(showbotting) then
- addgradcolors(table.unpack(gradient.red))
- showhidebotting = addshape('rect', 210, lastypos, 40, 20, 3, 3)
- addtext('Hide', 219, lastypos+3)
- else
- addgradcolors(table.unpack(gradient.green))
- showhidebotting = addshape('rect', 210, lastypos, 40, 20, 3, 3)
- addtext('Show', 216, lastypos+3)
- end
- local botstartypos = lastypos+63
- if(showbotting) then
- for k, v in ipairs(bottingstats) do
- local name = v[1]
- local value = v[2]
- -- Fieldname
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos + 23, 140, 20, 3, 3)
- addtext(name, 6, lastypos+23 + 3)
- lastypos = lastypos + 23
- -- Field value
- if($expgained < 0 and name == "Experience") then
- addgradcolors(table.unpack(gradient.red))
- elseif(name == "Experience" and $expgained > 0) then
- addgradcolors(table.unpack(gradient.green))
- else
- addgradcolors(table.unpack(gradient.yellow))
- end
- addshape('rect', 140, lastypos, 110, 20, 3, 3)
- addtext(value, 150, lastypos+3)
- end
- end
- -- Character stats
- addgradcolors(table.unpack(gradient.blue))
- header2 = addshape('rect', 0, lastypos+23, 250, 20, 3, 3)
- addtext('Character stats', 8, lastypos+26)
- -- Show/Hide button
- if(showcharacter) then
- addgradcolors(table.unpack(gradient.red))
- showhidechar = addshape('rect', 210, lastypos+23, 40, 20, 3, 3)
- addtext('Hide', 219, lastypos+26)
- else
- addgradcolors(table.unpack(gradient.green))
- showhidechar = addshape('rect', 210, lastypos+23, 40, 20, 3, 3)
- addtext('Show', 216, lastypos+26)
- end
- lastypos = lastypos+23
- local botstartypos = lastypos+63
- if(showcharacter) then
- for k, v in ipairs(characterstats) do
- lastypos = lastypos + 23
- local name = v[1]
- local value = v[2]
- -- Fieldname
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos, 140, 20, 3, 3)
- addtext(name, 6, lastypos + 3)
- -- Field value
- if(name == "Stamina") then
- if($stamina >= (40*60)+1) then -- Green
- addgradcolors(table.unpack(gradient.green))
- elseif($stamina >= 14*60 and $stamina <= 40*60) then -- Yellow
- addgradcolors(table.unpack(gradient.yellow))
- else -- Red
- addgradcolors(table.unpack(gradient.red))
- end
- else
- addgradcolors(table.unpack(gradient.yellow))
- end
- addshape('rect', 140, lastypos, 110, 20, 3, 3)
- addtext(value, 150, lastypos+3)
- end
- end
- -- Hud info
- lastypos = lastypos + 23
- addgradcolors(table.unpack(gradient.blue))
- header2 = addshape('rect', 0, lastypos, 250, 20, 3, 3)
- addtext('Hultins HUD', 8, lastypos +3)
- addtext('Version 1.1.1', 170, lastypos + 3)
- lastypos = lastypos + 23
- -----
- -- Development tools
- -----
- if(scriptinfo.development) then
- lastypos = lastypos + 20 -- We want some spacing from the main HUD
- -- Header
- addgradcolors(table.unpack(gradient.blue))
- addshape('rect', 0, lastypos, 250, 20, 3, 3)
- addtext('Development toolkit', 8, lastypos +3)
- lastypos = lastypos + 23
- -- Coords
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos, 140, 20, 3, 3)
- addtext('Coords (x/y/z)', 8, lastypos + 3)
- addgradcolors(table.unpack(gradient.yellow))
- addshape('rect', 140, lastypos, 110, 20, 3, 3)
- addtext($posx..'/'..$posy..'/'..$posz, 148, lastypos + 3)
- lastypos = lastypos + 23
- -- Mouseover itemid
- addgradcolors(table.unpack(gradient.black))
- addshape('rect', 0, lastypos, 140, 20, 3, 3)
- addtext('Mouse itemid', 8, lastypos + 3)
- addgradcolors(table.unpack(gradient.yellow))
- addshape('rect', 140, lastypos, 110, 20, 3, 3)
- addtext($cursorinfo.id, 148, lastypos + 3)
- lastypos = lastypos + 23
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement