Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NEOBOT HELP FILES BACKUP 30/09/11
- --------------------------------------------
- -------------LIBRARIES FILES CONTENTS-------
- --------------------------------------------
- ------------------------------sirmate.lua---------------------------------
- SIRMATE_LIB = '1.3'
- print('sirmate library loaded. version: ' .. SIRMATE_LIB .. '.')
- -- [[ Vocation names ]] --
- VOCATIONS = {'druid', 'elder druid', 'elite knight', 'knight', 'master sorcerer', 'paladin', 'royal paladin', 'sorcerer'}
- BASIC_VOCATIONS = {'druid', 'knight', 'paladin', 'sorcerer'}
- PROMOTED_VOCATIONS = {'elder druid', 'elite knight', 'master sorcerer', 'royal paladin'}
- -- [[ Outfits IDs ]] --
- FREE_OUTFITS = {128, 129, 130, 131, 136, 137, 138, 139}
- PREMIUM_OUTFITS = {132, 133, 134, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 251, 252, 268, 269, 270, 273, 278, 279, 288, 289, 324, 325, 328, 329, 335, 336, 366, 367}
- MALE_OUTFITS = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328, 335, 367}
- FEMALE_OUTFITS = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329, 336, 366}
- -- [[ Param and Haste spells ]] --
- PARAM_SPELLS = {'utevo res ina', 'exiva', 'exura sio', 'exani hur', 'utevo res'}
- HASTE_SPELLS = {'utani hur', 'utani gran hur', 'utani tempo hur', 'utamo tempo san'}
- -- [[ List of supplies items ]] --
- POTIONS_AND_RUNES = {'antidote potion', 'berserk potion', 'bullseye potion', 'great health potion', 'great mana potion', 'great spirit potion', 'health potion', 'mana potion', 'mastermind potion', 'small health potion', 'strong health potion', 'strong mana potion', 'ultimate health potion', 'animate dead rune', 'avalanche rune', 'chameleon rune', 'convince creature rune', 'cure poison rune', 'desintegrate rune', 'destroy field rune', 'energy bomb rune', 'energy field rune', 'energy wall rune', 'explosion rune', 'fire bomb rune', 'fire field rune', 'fire wall rune', 'fireball rune', 'great fireball rune', 'heavy magic missile rune', 'holy missile rune', 'icicle rune', 'intense healing rune', 'light magic missile rune', 'magic wall rune', 'paralyze rune', 'poison bomb rune', 'poison field rune', 'poison wall rune', 'soulfire rune', 'stalagmite rune', 'stone shower rune', 'sudden death rune', 'thunderstorm rune', 'ultimate healing rune', 'wild growth rune'}
- AMMUNITION = {'arrow', 'burst arrow', 'earth arrow', 'flaming arrow', 'flash arrow', 'onyx arrow', 'poison arrow', 'shiver arrow', 'sniper arrow', 'bolt', 'infernal bolt', 'piercing bolt', 'power bolt'}
- DISTANCE_WEAPONS = {'assassin star', 'enchanted spear', 'hunting spear', 'royal spear', 'small stone', 'snowball', 'spear', 'throwing Knife', 'throwing star', 'viper star'}
- -- [[ Stats clear constants ]] --
- SC_ALL_SECTIONS = 0
- SC_MONSTERS_SEEN = 1
- SC_PLAYERS_SEEN = 2
- SC_MONSTERS_KILLED = 3
- SC_ITEMS_LOOTED = 4
- SC_SUPPLIES_USED = 5
- SC_DAMAGE_DEALT = 6
- SC_DAMAGE_RECEIVED = 7
- SC_DAMAGE_STATS = 8
- SC_HEAL_STATS = 9
- local BINARY_INSERT_COMPARE_FUNCTION_NOKEY = function(first, second) return first < second end
- local BINARY_INSERT_COMPARE_FUNCTION_WITHKEY = function(first, second, argument) return first[argument] < second[argument] end
- function table.binaryinsert(self, value, argument) -- Working
- local compare_function
- if (type(argument) == 'function') then
- compare_function = argument
- elseif (type(argument) == 'string') then
- compare_function = BINARY_INSERT_COMPARE_FUNCTION_WITHKEY
- else
- compare_function = BINARY_INSERT_COMPARE_FUNCTION_NOKEY
- end
- local left, right, mid, state = 1, #self, 1, 0
- while (left <= right) do
- mid = math.floor((left + right) / 2)
- if (compare_function(value, self[mid], ((type(argument) == 'string' and argument) or nil))) then
- right, state = mid - 1, 0
- else
- left, state = mid + 1, 1
- end
- end
- table.insert(self, mid + state, value)
- return mid + state
- end
- function arguments(function_name, function_arguments) -- Working
- for i = 1, #function_arguments, 2 do
- if (type(function_arguments[i + 1]) ~= function_arguments[i]) then
- return false, error('bad argument #' .. math.ceil(i / 2) .. ' to \'' .. function_name .. '\' (' .. function_arguments[i] .. ' expected, got ' .. type(function_arguments[i + 1]) .. ')', 3)
- end
- end
- end
- local UNIT_DATA_FILE = 'player.data'
- local UNIT_DATA_RUN_LAST = $timems
- local UNIT_DATA_RUN_DELAY = 100
- local UNIT_DATA_SAVE_LAST = $timems
- local UNIT_DATA_SAVE_DELAY = 60000
- Unit = {
- data = {}
- }
- function Unit:getPlayersData(cache_players_data) -- Working
- if (type(cache_players_data) ~= 'boolean') then cache_players_data = false end
- if (UNIT_DATA_RUN_LAST + UNIT_DATA_RUN_DELAY >= $timems) then return end
- if (#self.data == 0 and cache_players_data) then
- if (#filecontent(UNIT_DATA_FILE) ~= 0) then
- self.data = dofile('neofiles/' .. UNIT_DATA_FILE .. '.txt')
- table.newsort(self.data, 'name', 'asc')
- end
- end
- foreach newmessage m do
- if (table.find({MSG_CHANNEL, MSG_DEFAULT, MSG_PVT, MSG_SENT, MSG_TUTOR, MSG_WHISPER, MSG_YELL}, m.type) and m.level ~= 0) then
- local message_sender = m.sender:lower()
- local player_found = table.binaryfind(self.data, message_sender, 'name')
- if (player_found) then
- self.data[player_found].level = tonumber(m.level)
- else
- table.binaryinsert(self.data, {name = message_sender, level = tonumber(m.level), sex = 'unknown', vocation = 'unknown', gname = '', grank = '', gtitle = '', spells = {}}, 'name')
- player_found = table.binaryfind(self.data, message_sender, 'name')
- end
- if (m.type == MSG_DEFAULT) then
- local message_content = m.content
- for _, param_spell in ipairs(PARAM_SPELLS) do
- if (message_content:match("^" .. param_spell .. " \".+")) then
- message_content = param_spell break
- end
- end
- local spell_info = Spell:getInfo(message_content, 'words')
- if (type(spell_info) == 'table' and tonumber(m.level) >= spell_info.level) then
- local spell_found = table.binaryfind(self.data[player_found].spells, spell_info.name, 'name')
- if (table.find(HASTE_SPELLS, spell_info.words)) then
- for _, haste_spell in ipairs(HASTE_SPELLS) do
- local haste_spell_info = Spell:getInfo(haste_spell)
- local haste_spell_found = table.find(self.data[player_found].spells, haste_spell_info.name, 'name')
- if (haste_spell_found) then
- self.data[player_found].spells[haste_spell_found].lastuse = $timems - 1000 - ((haste_spell_info.cooldown > haste_spell_info.duration and haste_spell_info.cooldown) or haste_spell_info.duration) * 1000
- end
- end
- end
- if (spell_found) then
- self.data[player_found].spells[spell_found].lastuse = $timems
- else
- table.binaryinsert(self.data[player_found].spells, {name = spell_info.name, lastuse = $timems}, 'name')
- end
- if (not table.binaryfind(PROMOTED_VOCATIONS, self.data[player_found].vocation) and #self.data[player_found].spells ~= 0) then Unit:getVocation(message_sender) end
- end
- end
- elseif (m.type == MSG_INFO and m.content:match('^You see')) then
- local player_name, player_level, player_sex, player_vocation, player_guildinfo = string.match(m.content, "You see (.+) %(.-(%d+).- ([S]?[hH]e) is an? (.-)%.(.*)")
- local player_guild_name, player_guild_rank, player_guild_title = '', '', ''
- if (#(player_guildinfo or '') > 0) then
- player_guild_rank, player_guild_name = string.match(player_guildinfo, ".-is (.+) of the (.+)%.")
- if (string.find(player_guild_name, "%(")) then
- player_guild_name, player_guild_title = string.match(player_guild_name, "(.+) %((.+)%)")
- end
- end
- if (player_name and player_level and player_sex and player_vocation and player_guild_name and player_guild_rank and player_guild_title) then
- player_name = player_name:lower()
- local player_found = table.binaryfind(self.data, player_name, 'name')
- if (player_found) then
- self.data[player_found] = {name = player_name, level = tonumber(player_level), sex = (player_sex == 'He' and 'male') or 'female', vocation = player_vocation, gname = player_guild_name:lower(), grank = player_guild_rank:lower(), gtitle = player_guild_title:lower(), spells = self.data[player_found].spells}
- else
- table.binaryinsert(self.data, {name = player_name, level = tonumber(player_level), sex = (player_sex == 'He' and 'male') or 'female', vocation = player_vocation, gname = player_guild_name:lower(), grank = player_guild_rank:lower(), gtitle = player_guild_title:lower(), spells = {}}, 'name')
- end
- end
- end
- end
- if (UNIT_DATA_SAVE_LAST + UNIT_DATA_SAVE_DELAY <= $timems and cache_players_data) then
- local PLAYER_DATA = ''
- for _, p in ipairs(self.data) do
- PLAYER_DATA = PLAYER_DATA .. ' {name = "'.. p.name .. '", level = '.. p.level .. ', sex = "'.. p.sex .. '", vocation = "'.. p.vocation .. '", gname = "'.. p.gname .. '", grank = "'.. p.grank .. '", gtitle = "'.. p.gtitle .. '", spells = {}},\n'
- end
- filerewrite(UNIT_DATA_FILE, 'return {\n' .. PLAYER_DATA .. '}')
- UNIT_DATA_SAVE_LAST = $timems
- end
- UNIT_DATA_RUN_LAST = $timems
- end
- function Unit:getName(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (self:isPlayer(unit_name) or self:isMonster(unit_name) or self:isNPC(unit_name)) then
- return ((unit_name.name ~= nil and unit_name.name) or unit_name):lower()
- end
- end
- return nil
- end
- function Unit:getLevel(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $level
- elseif (self:isPlayer(unit_name)) then
- if (type(unit_name) == 'userdata') then unit_name = unit_name.name end
- local unit_found = table.binaryfind(self.data, unit_name:lower(), 'name')
- if (unit_found) then
- return self.data[unit_found].level
- end
- end
- end
- return 0
- end
- function Unit:getSex(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if self:isPlayer(unit_name) then
- local unit_found = table.binaryfind(self.data, ((unit_name.name ~= nil and unit_name.name) or unit_name):lower(), 'name')
- if (unit_found) then
- if (type(unit_name) == 'userdata' and self.data[unit_found].sex == 'unknown') then
- if (table.binaryfind(MALE_OUTFITS, unit_name.outfit)) then
- self.data[unit_found].sex = 'male'
- elseif (table.binaryfind(FEMALE_OUTFITS, unit_name.outfit)) then
- self.data[unit_found].sex = 'female'
- end
- end
- return self.data[unit_found].sex
- end
- end
- end
- return 'unknown'
- end
- function Unit:getVocation(unit_name, basic) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then unit_name = findcreature(unit_name) end
- if (type(basic) ~= 'boolean') then basic = false end
- if (self:isPlayer(unit_name)) then
- if (type(unit_name) == 'userdata') then unit_name = unit_name.name end
- local unit_found, player_vocation = table.binaryfind(self.data, unit_name:lower(), 'name'), 'unknown'
- if (unit_found) then
- player_vocation = self.data[unit_found].vocation
- if (table.binaryfind(PROMOTED_VOCATIONS, self.data[unit_found].vocation)) then
- player_vocation = self.data[unit_found].vocation
- elseif (not table.binaryfind(PROMOTED_VOCATIONS, self.data[unit_found].vocation) and #self.data[unit_found].spells ~= 0) then
- for _, spell in ipairs(self.data[unit_found].spells) do
- local spell_info = Spell:getInfo(spell.name, 'name')
- if (type(spell_info) == 'table') then
- if (spell_info.vocation ~= false) then
- player_vocation, self.data[unit_found].vocation = spell_info.vocation, spell_info.vocation
- if (table.binaryfind(PROMOTED_VOCATIONS, spell_info.vocation)) then break end
- end
- end
- end
- end
- if (unit_name:lower() == $name:lower() and player_vocation == 'unknown') then
- local _vocation = vocation()
- if (_vocation ~= 'mage') then
- player_vocation, self.data[unit_found].vocation = _vocation, _vocation
- end
- end
- end
- if (basic) then
- return player_vocation:gsub('master ', ''):gsub('elite ', ''):gsub('elder ', ''):gsub('royal ', '')
- end
- return player_vocation
- end
- end
- return 'unknown'
- end
- function Unit:getGuildInfo(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then unit_name = findcreature(unit_name) end
- if (self:isPlayer(unit_name)) then
- local unit_found = table.binaryfind(self.data, ((unit_name.name ~= nil and unit_name.name) or unit_name):lower(), 'name')
- if (unit_found) then
- if (#self.data[unit_found].gname ~= 0) then
- return {name = self.data[unit_found].gname, rank = self.data[unit_found].grank, title = self.data[unit_found].gtitle}
- end
- end
- end
- end
- return {name = '', rank = '', title = ''}
- end
- function Unit:getHealth(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $hp
- else
- local unit_health_percent, unit_health_max = self:getHealthPercent(unit_name), self:getHealthMax(unit_name)
- if (unit_health_percent ~= 0 and unit_health_max ~= 0) then
- return math.floor((unit_health_percent / 100) * unit_health_max)
- end
- end
- end
- return 0
- end
- function Unit:getHealthPercent(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.hppc
- end
- end
- return 0
- end
- function Unit:getHealthMax(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $maxhp
- end
- if (type(unit_name) == 'userdata') then
- unit_name = unit_name.name
- end
- if (self:isMonster(unit_name)) then
- return creatureinfo(unit_name).hp
- else
- local unit_found = table.binaryfind(self.data, unit_name:lower(), 'name')
- if (unit_found) then
- if (table.binaryfind({'elite knight', 'knight'}, self.data[unit_found].vocation)) then
- return (self.data[unit_found].level * 15) + 65
- elseif (table.binaryfind({'paladin', 'royal paladin'}, self.data[unit_found].vocation)) then
- return (self.data[unit_found].level * 10) + 105
- else
- return (self.data[unit_found].level * 5) + 145
- end
- end
- end
- end
- return 0
- end
- function Unit:getMana(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $mp
- end
- end
- return 0
- end
- function Unit:getManaPercent(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $mppc
- end
- end
- return 0
- end
- function Unit:getManaMax(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (((unit_name.name ~= nil and unit_name.name) or unit_name):lower() == $name:lower()) then
- return $maxmp
- elseif (self:isPlayer(unit_name)) then
- local unit_found = table.binaryfind(self.data, ((unit_name.name ~= nil and unit_name.name) or unit_name):lower(), 'name')
- if (unit_found) then
- if (table.binaryfind({'druid', 'elder druid', 'master sorcerer', 'sorcerer'}, self.data[unit_found].vocation)) then
- return (self.data[unit_found].level * 30) - 205
- elseif (table.binaryfind({'paladin', 'royal paladin'}, self.data[unit_found].vocation)) then
- return (self.data[unit_found].level * 15) - 85
- else
- return (self.data[unit_found].level * 5) - 5
- end
- end
- end
- end
- return 0
- end
- function Unit:getBaseSpeed(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (self:getLevel(unit_name) ~= 0) then
- return 220 + (2 * (self:getLevel(unit_name) - 1))
- end
- end
- return 0
- end
- function Unit:getCastedSpells(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (self:isPlayer(unit_name)) then
- local unit_found = table.binaryfind(self.data, ((unit_name.name ~= nil and unit_name.name) or unit_name):lower(), 'name')
- if (unit_found) then
- return self.data[unit_found].spells
- end
- end
- end
- return {}
- end
- function Unit:getActiveSpells(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- local active_spells = {}
- for _, spell in ipairs(self:getCastedSpells(unit_name)) do
- local spell_info = Spell:getInfo(spell.name, 'name')
- local spell_time = ((spell_info.cooldown > spell_info.duration and spell_info.cooldown) or spell_info.duration) * 1000
- if (spell.lastuse + spell_time >= $timems) then
- table.binaryinsert(active_spells, {name = spell_info.name, time = spell.lastuse - $timems + spell_time, group = spell_info.group1}, 'name')
- end
- end
- return active_spells
- end
- return {}
- end
- function Unit:getCooldown(unit_name, spell_name, group_cooldown) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (self:isPlayer(unit_name)) then
- if (type(unit_name) == 'userdata') then unit_name = unit_name.name end
- local unit_found = table.binaryfind(self.data, unit_name:lower(), 'name')
- if (unit_found and type(spell_name) ~= 'nil') then
- spell_name = spell_name:lower()
- if (type(group_cooldown) ~= 'nil') then group_cooldown = true end
- local function getGroupCooldown(unit_name, group_name)
- local group_times = {attack = 2000, healing = 1000, special = 8000, support = 2000}
- if (unit_name:lower() == $name:lower()) then
- return cooldown(group_name), group_times[group_name]
- end
- for _, spell in ipairs(Spell.data) do
- if spell.group1 == group_name then
- local spell_found = table.binaryfind(self.data[unit_found].spells, spell.name, 'name')
- if (type(spell_found) ~= 'nil') then
- local spell_lastuse = self.data[unit_found].spells[spell_found].lastuse
- if (spell_lastuse + group_times[group_name] >= $timems) then
- return spell_lastuse - $timems + group_times[group_name], group_times[group_name]
- end
- end
- end
- end
- return 0, group_times[group_name]
- end
- if table.binaryfind({'attack', 'healing', 'special', 'support'}, spell_name) then
- return getGroupCooldown(unit_name, spell_name)
- else
- local spell_info = Spell:getInfo(spell_name)
- if (type(spell_info) ~= 'nil') then
- local spell_found = table.binaryfind(self.data[unit_found].spells, spell_info.name, 'name')
- local spell_time = ((spell_info.cooldown > spell_info.duration and spell_info.cooldown) or spell_info.duration) * 1000
- if (type(spell_found) ~= 'nil') then
- local spell_lastuse = self.data[unit_found].spells[spell_found].lastuse
- if (spell_lastuse + spell_time >= $timems) then
- return spell_lastuse - $timems + spell_time, spell_time
- end
- end
- if (group_cooldown) then
- return getGroupCooldown(unit_name, spell_info.group1)
- end
- end
- end
- end
- end
- end
- return 0, 0
- end
- function Unit:isPlayer(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (table.binaryfind(self.data, ((unit_name.name ~= nil and unit_name.name) or unit_name):lower(), 'name')) then
- return true
- end
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.isplayer
- end
- end
- return false
- end
- function Unit:isMonster(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.ismonster and type(creatureinfo(unit_name.name)) == 'table'
- end
- end
- return false
- end
- function Unit:isNPC(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.ismonster and type(creatureinfo(unit_name.name)) ~= 'table'
- end
- end
- return false
- end
- function Unit:isPremium(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- if (self:isPlayer(unit_name)) then
- if (self:isPromoted(unit_name)) then
- return true
- end
- if (self:isMounted(unit_name)) then
- return true
- end
- if ((table.find(FREE_OUTFITS, unit_name.outfit) and unit_name.addons ~= 0) or table.find(PREMIUM_OUTFITS, unit_name.outfit)) then
- return true
- end
- end
- end
- end
- return false
- end
- function Unit:isPromoted(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (self:isPlayer(unit_name)) then
- if (table.binaryfind(PROMOTED_VOCATIONS, self:getVocation(unit_name))) then
- return true
- end
- end
- end
- return false
- end
- function Unit:isMounted(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.mount ~= 0
- end
- end
- return false
- end
- function Unit:isParalyzed(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.speed < self:getBaseSpeed(unit_name)
- end
- end
- return false
- end
- function Unit:isStealthed(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.outfit == 0
- end
- end
- return false
- end
- function Unit:isSwimming(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.outfit == 267
- end
- end
- return false
- end
- function Unit:isInMyGuild(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) == 'number') then
- unit_name = findcreature(unit_name)
- end
- if (self:isPlayer(unit_name)) then
- local self_guild = self:getGuildInfo($name)
- local unit_guild = self:getGuildInfo((unit_name.name ~= nil and unit_name.name) or unit_name)
- if (self_guild and unit_guild) then
- if (#self_guild.name ~= 0 and #unit_guild.name ~= 0) then
- return self_guild.name == unit_guild.name
- end
- end
- end
- end
- return false
- end
- function Unit:isInParty(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.party ~= PARTY_NOPARTY and unit_name.party ~= PARTY_INVITED_LEADER and unit_name.party ~= PARTY_INVITED_MEMBER
- end
- end
- return false
- end
- function Unit:isPartyLeader(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- return unit_name.party == PARTY_EXPSHARE_OK_LEADER or unit_name.party == PARTY_EXPSHARE_OFF_LEADER or unit_name.party == PARTY_EXPSHARE_WAIT_LEADER or unit_name.party == PARTY_ONPARTY_LEADER
- end
- end
- return false
- end
- function Unit:canMount(unit_name) -- Working
- if (table.find({'number', 'string', 'userdata'}, type(unit_name))) then
- if (type(unit_name) ~= 'userdata') then
- unit_name = findcreature(unit_name)
- end
- if (type(unit_name) == 'userdata') then
- if (self:isPlayer(unit_name)) then
- if (not self:isMounted(unit_name) and (table.binaryfind(FREE_OUTFITS, unit_name.outfit) or table.binaryfind(PREMIUM_OUTFITS, unit_name.outfit))) then
- return true
- end
- end
- end
- end
- return false
- end
- Spell = {
- data = {
- {words = "adana ani", name = "paralyze rune", group1 = "support", group2 = "", type = "rune", vocation = "elder druid", cooldown = 2, duration = 1, level = 54, mp = 1400, premium = true, soul = 3, mlevel = 18, condition = "7"},
- {words = "adana mort", name = "animate dead rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 27, mp = 600, premium = true, soul = 5, mlevel = 4, condition = "1"},
- {words = "adana pox", name = "cure poison rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 15, mp = 200, premium = false, soul = 1, mlevel = 0, condition = "7"},
- {words = "adeta sio", name = "convince creature rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 16, mp = 200, premium = false, soul = 3, mlevel = 5, condition = "7"},
- {words = "adevo grav flam", name = "fire field rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 15, mp = 240, premium = false, soul = 1, mlevel = 1, condition = "7"},
- {words = "adevo grav pox", name = "poison field rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 14, mp = 200, premium = false, soul = 1, mlevel = 0, condition = "7"},
- {words = "adevo grav tera", name = "magic wall rune", group1 = "support", group2 = "", type = "rune", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 32, mp = 750, premium = true, soul = 5, mlevel = 9, condition = "7"},
- {words = "adevo grav vis", name = "energy field rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 18, mp = 320, premium = false, soul = 2, mlevel = 3, condition = "7"},
- {words = "adevo grav vita", name = "wild growth rune", group1 = "support", group2 = "", type = "rune", vocation = "elder druid", cooldown = 2, duration = 1, level = 27, mp = 600, premium = true, soul = 5, mlevel = 8, condition = "7"},
- {words = "adevo ina", name = "chameleon rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 27, mp = 600, premium = false, soul = 2, mlevel = 4, condition = "7"},
- {words = "adevo mas flam", name = "fire bomb rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 27, mp = 600, premium = false, soul = 4, mlevel = 5, condition = "1x1"},
- {words = "adevo mas grav flam", name = "fire wall rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 33, mp = 780, premium = false, soul = 4, mlevel = 6, condition = "7"},
- {words = "adevo mas grav pox", name = "poison wall rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 29, mp = 640, premium = false, soul = 3, mlevel = 5, condition = "7"},
- {words = "adevo mas grav vis", name = "energy wall rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 41, mp = 1000, premium = false, soul = 5, mlevel = 9, condition = "7"},
- {words = "adevo mas hur", name = "explosion rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 31, mp = 570, premium = false, soul = 4, mlevel = 6, condition = "explo"},
- {words = "adevo mas pox", name = "poison bomb rune", group1 = "support", group2 = "", type = "rune", vocation = "elder druid", cooldown = 2, duration = 1, level = 25, mp = 520, premium = true, soul = 2, mlevel = 4, condition = "7"},
- {words = "adevo mas vis", name = "energy bomb rune", group1 = "support", group2 = "", type = "rune", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 37, mp = 880, premium = true, soul = 5, mlevel = 10, condition = "1x1"},
- {words = "adevo res flam", name = "soulfire rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 27, mp = 420, premium = true, soul = 3, mlevel = 7, condition = "7"},
- {words = "adito grav", name = "destroy field rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 17, mp = 120, premium = false, soul = 2, mlevel = 3, condition = "7"},
- {words = "adito tera", name = "desintegrate rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 21, mp = 200, premium = true, soul = 3, mlevel = 4, condition = "1"},
- {words = "adori flam", name = "fireball rune", group1 = "support", group2 = "", type = "rune", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 27, mp = 460, premium = true, soul = 3, mlevel = 4, condition = "7"},
- {words = "adori frigo", name = "icicle rune", group1 = "support", group2 = "", type = "rune", vocation = "elder druid", cooldown = 2, duration = 1, level = 28, mp = 460, premium = true, soul = 3, mlevel = 4, condition = "7"},
- {words = "adori gran mort", name = "sudden death rune", group1 = "support", group2 = "", type = "rune", vocation = "sorcerer", cooldown = 2, duration = 1, level = 45, mp = 985, premium = false, soul = 5, mlevel = 15, condition = "7"},
- {words = "adori mas flam", name = "great fireball rune", group1 = "support", group2 = "", type = "rune", vocation = "sorcerer", cooldown = 2, duration = 1, level = 30, mp = 530, premium = false, soul = 3, mlevel = 4, condition = "3x3"},
- {words = "adori mas frigo", name = "avalanche rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 30, mp = 530, premium = false, soul = 3, mlevel = 4, condition = "3x3"},
- {words = "adori mas tera", name = "stone shower rune", group1 = "support", group2 = "", type = "rune", vocation = "elder druid", cooldown = 2, duration = 1, level = 28, mp = 430, premium = true, soul = 3, mlevel = 4, condition = "3x3"},
- {words = "adori mas vis", name = "thunderstorm rune", group1 = "support", group2 = "", type = "rune", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 28, mp = 430, premium = true, soul = 3, mlevel = 4, condition = "3x3"},
- {words = "adori min vis", name = "light magic missile rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 15, mp = 120, premium = false, soul = 1, mlevel = 0, condition = "7"},
- {words = "adori san", name = "holy missile rune", group1 = "support", group2 = "", type = "rune", vocation = "royal palafireball runedin", cooldown = 2, duration = 1, level = 27, mp = 300, premium = true, soul = 3, mlevel = 4, condition = "7"},
- {words = "adori tera", name = "stalagmite rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 24, mp = 350, premium = false, soul = 2, mlevel = 3, condition = "7"},
- {words = "adori vis", name = "heavy magic missile rune", group1 = "support", group2 = "", type = "rune", vocation = false, cooldown = 2, duration = 1, level = 25, mp = 350, premium = false, soul = 2, mlevel = 3, condition = "7"},
- {words = "adura gran", name = "intense healing rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 15, mp = 120, premium = false, soul = 2, mlevel = 1, condition = "7"},
- {words = "adura vita", name = "ultimate healing rune", group1 = "support", group2 = "", type = "rune", vocation = "druid", cooldown = 2, duration = 1, level = 24, mp = 400, premium = false, soul = 3, mlevel = 4, condition = "7"},
- {words = "exana flam", name = "cure burning", group1 = "healing", group2 = "", type = "instant", vocation = "elder druid", cooldown = 6, duration = 1, level = 30, mp = 30, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exana ina", name = "cancel invisibility", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 26, mp = 200, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exana kor", name = "cure bleeding", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 6, duration = 1, level = 45, mp = 30, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exana mort", name = "cure curse", group1 = "healing", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 6, duration = 1, level = 80, mp = 40, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exana pox", name = "cure poison", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 1, duration = 1, level = 10, mp = 30, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exana vis", name = "cure electrification", group1 = "healing", group2 = "", type = "instant", vocation = "elder druid", cooldown = 6, duration = 1, level = 22, mp = 30, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exani hur", name = "levitate", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 12, mp = 50, premium = true, soul = 0, mlevel = 0, condition = "word"},
- {words = "exani tera", name = "magic rope", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 9, mp = 20, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exeta con", name = "enchant spear", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 45, mp = 350, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exeta res", name = "challenge", group1 = "support", group2 = "", type = "instant", vocation = "elite knight", cooldown = 2, duration = 1, level = 20, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "1x1"},
- {words = "exeta vis", name = "enchant staff", group1 = "support", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 41, mp = 80, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con", name = "conjure arrow", group1 = "support", group2 = "", type = "instant", vocation = "paladin", cooldown = 2, duration = 1, level = 13, mp = 100, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con flam", name = "conjure explosive arrow", group1 = "support", group2 = "", type = "instant", vocation = "paladin", cooldown = 2, duration = 1, level = 25, mp = 290, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con grav", name = "conjure piercing bolt", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 33, mp = 180, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con hur", name = "conjure sniper arrow", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 24, mp = 160, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con mort", name = "conjure bolt", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 17, mp = 140, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con pox", name = "conjure poisoned arrow", group1 = "support", group2 = "", type = "instant", vocation = "paladin", cooldown = 2, duration = 1, level = 16, mp = 130, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo con vis", name = "conjure power bolt", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 59, mp = 700, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo flam hur", name = "fire wave", group1 = "attack", group2 = "", type = "instant", vocation = "sorcerer", cooldown = 4, duration = 1, level = 18, mp = 25, premium = false, soul = 0, mlevel = 0, condition = "smallwave"},
- {words = "exevo frigo hur", name = "ice wave", group1 = "attack", group2 = "", type = "instant", vocation = "druid", cooldown = 4, duration = 1, level = 18, mp = 25, premium = false, soul = 0, mlevel = 0, condition = "smallwave"},
- {words = "exevo gran frigo hur", name = "strong ice wave", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 8, duration = 1, level = 40, mp = 170, premium = true, soul = 0, mlevel = 0, condition = "smallwave"},
- {words = "exevo gran mas flam", name = "hells core", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 40, duration = 1, level = 60, mp = 1100, premium = true, soul = 0, mlevel = 0, condition = "5x5"},
- {words = "exevo gran mas frigo", name = "eternal winter", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 40, duration = 1, level = 60, mp = 1050, premium = true, soul = 0, mlevel = 0, condition = "5x5"},
- {words = "exevo gran mas tera", name = "wrath of nature", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 40, duration = 1, level = 55, mp = 700, premium = true, soul = 0, mlevel = 0, condition = "6x6"},
- {words = "exevo gran mas vis", name = "rage of the skies", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 40, duration = 1, level = 55, mp = 600, premium = true, soul = 0, mlevel = 0, condition = "6x6"},
- {words = "exevo gran vis lux", name = "great energy beam", group1 = "attack", group2 = "", type = "instant", vocation = "sorcerer", cooldown = 6, duration = 1, level = 29, mp = 110, premium = false, soul = 0, mlevel = 0, condition = "bigbeam"},
- {words = "exevo mas san", name = "divine caldera", group1 = "attack", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 4, duration = 1, level = 50, mp = 160, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "exevo pan", name = "food", group1 = "support", group2 = "", type = "instant", vocation = "druid", cooldown = 2, duration = 1, level = 14, mp = 120, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exevo tera hur", name = "terra wave", group1 = "attack", group2 = "", type = "instant", vocation = "druid", cooldown = 4, duration = 1, level = 38, mp = 210, premium = false, soul = 0, mlevel = 0, condition = "bigwave"},
- {words = "exevo vis hur", name = "energy wave", group1 = "attack", group2 = "", type = "instant", vocation = "sorcerer", cooldown = 8, duration = 1, level = 38, mp = 170, premium = false, soul = 0, mlevel = 0, condition = "bigwave"},
- {words = "exevo vis lux", name = "energy beam", group1 = "attack", group2 = "", type = "instant", vocation = "sorcerer", cooldown = 4, duration = 1, level = 23, mp = 40, premium = false, soul = 0, mlevel = 0, condition = "smallbeam"},
- {words = "exiva", name = "find person", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 8, mp = 20, premium = false, soul = 0, mlevel = 0, condition = "word"},
- {words = "exori", name = "berserk", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 4, duration = 1, level = 35, mp = 115, premium = true, soul = 0, mlevel = 0, condition = "1x1"},
- {words = "exori amp vis", name = "lightning", group1 = "attack", group2 = "special", type = "instant", vocation = "master sorcerer", cooldown = 8, duration = 1, level = 55, mp = 60, premium = true, soul = 0, mlevel = 0, condition = "5"},
- {words = "exori con", name = "ethereal spear", group1 = "attack", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 23, mp = 25, premium = true, soul = 0, mlevel = 0, condition = "7"},
- {words = "exori flam", name = "flame strike", group1 = "attack", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 14, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori frigo", name = "ice strike", group1 = "attack", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 15, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori gran", name = "fierce berserk", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 6, duration = 1, level = 90, mp = 340, premium = true, soul = 0, mlevel = 0, condition = "1x1"},
- {words = "exori gran con", name = "strong ethereal spear", group1 = "attack", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 8, duration = 1, level = 90, mp = 55, premium = true, soul = 0, mlevel = 0, condition = "7"},
- {words = "exori gran flam", name = "strong flame strike", group1 = "attack", group2 = "special", type = "instant", vocation = "master sorcerer", cooldown = 8, duration = 1, level = 70, mp = 60, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori gran frigo", name = "strong ice strike", group1 = "attack", group2 = "special", type = "instant", vocation = "elder druid", cooldown = 8, duration = 1, level = 80, mp = 60, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori gran ico", name = "annihilation", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 30, duration = 1, level = 110, mp = 300, premium = true, soul = 0, mlevel = 0, condition = "5"},
- {words = "exori gran tera", name = "strong terra strike", group1 = "attack", group2 = "special", type = "instant", vocation = "elder druid", cooldown = 8, duration = 1, level = 70, mp = 60, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori gran vis", name = "strong energy strike", group1 = "attack", group2 = "special", type = "instant", vocation = "master sorcerer", cooldown = 8, duration = 1, level = 80, mp = 60, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori hur", name = "whirlwind throw", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 6, duration = 1, level = 28, mp = 40, premium = true, soul = 0, mlevel = 0, condition = "5"},
- {words = "exori ico", name = "brutal strike", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 6, duration = 1, level = 16, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "1"},
- {words = "exori mas", name = "groundshaker", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 8, duration = 1, level = 33, mp = 160, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "exori max flam", name = "ultimate flame strike", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 30, duration = 1, level = 90, mp = 100, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori max frigo", name = "ultimate ice strike", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 30, duration = 1, level = 100, mp = 100, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori max tera", name = "ultimate terra strike", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 30, duration = 1, level = 90, mp = 100, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori max vis", name = "ultimate energy strike", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 30, duration = 1, level = 100, mp = 100, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori min", name = "front sweep", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 6, duration = 1, level = 70, mp = 200, premium = true, soul = 0, mlevel = 0, condition = "front"},
- {words = "exori moe ico", name = "physical strike", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 2, duration = 1, level = 16, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori mort", name = "death strike", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 2, duration = 1, level = 16, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori san", name = "divine missile", group1 = "attack", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 1, level = 40, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "4"},
- {words = "exori tera", name = "terra strike", group1 = "attack", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 13, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exori vis", name = "energy strike", group1 = "attack", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 12, mp = 20, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "exura", name = "light healing", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 1, duration = 1, level = 9, mp = 20, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exura gran", name = "intense healing", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 1, duration = 1, level = 11, mp = 70, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exura gran ico", name = "intense wound cleansing", group1 = "healing", group2 = "", type = "instant", vocation = "elite knight", cooldown = 600, duration = 1, level = 80, mp = 200, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exura gran mas res", name = "mass healing", group1 = "healing", group2 = "", type = "instant", vocation = "elder druid", cooldown = 2, duration = 1, level = 36, mp = 150, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "exura gran san", name = "salvation", group1 = "healing", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 1, duration = 1, level = 60, mp = 210, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "exura ico", name = "wound cleansing", group1 = "healing", group2 = "", type = "instant", vocation = "knight", cooldown = 1, duration = 1, level = 10, mp = 40, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exura san", name = "divine healing", group1 = "healing", group2 = "", type = "instant", vocation = "paladin", cooldown = 1, duration = 1, level = 35, mp = 160, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "exura sio", name = "heal friend", group1 = "healing", group2 = "", type = "instant", vocation = "elder druid", cooldown = 1, duration = 1, level = 18, mp = 140, premium = true, soul = 0, mlevel = 0, condition = "word"},
- {words = "exura vita", name = "ultimate healing", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 1, duration = 1, level = 20, mp = 160, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "utamo mas sio", name = "protect party", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 120, level = 32, mp = 0, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "utamo tempo", name = "protector", group1 = "support", group2 = "", type = "instant", vocation = "elite knight", cooldown = 2, duration = 10, level = 55, mp = 200, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utamo tempo san", name = "swift foot", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 10, level = 55, mp = 400, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utamo vita", name = "magic shield", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 200, level = 14, mp = 50, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "utana vid", name = "invisible", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 200, level = 35, mp = 440, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "utani gran hur", name = "strong haste", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 8, duration = 22, level = 20, mp = 100, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utani hur", name = "haste", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 30, level = 14, mp = 60, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utani tempo hur", name = "charge", group1 = "support", group2 = "", type = "instant", vocation = "elite knight", cooldown = 2, duration = 5, level = 25, mp = 100, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utevo gran lux", name = "great light", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 695, level = 13, mp = 60, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "utevo lux", name = "light", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 370, level = 8, mp = 20, premium = false, soul = 0, mlevel = 0, condition = ""},
- {words = "utevo res", name = "summon creature", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 25, mp = 0, premium = false, soul = 0, mlevel = 0, condition = "word"},
- {words = "utevo res ina", name = "creature illusion", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1, level = 23, mp = 100, premium = false, soul = 0, mlevel = 0, condition = "word"},
- {words = "utevo vis lux", name = "ultimate light", group1 = "support", group2 = "", type = "instant", vocation = false, cooldown = 2, duration = 1980, level = 26, mp = 140, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utito mas sio", name = "train party", group1 = "support", group2 = "", type = "instant", vocation = "elite knight", cooldown = 2, duration = 120, level = 32, mp = 0, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "utito tempo", name = "blood rage", group1 = "support", group2 = "", type = "instant", vocation = "elite knight", cooldown = 2, duration = 10, level = 60, mp = 290, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utito tempo san", name = "sharpshooter", group1 = "support", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 2, duration = 10, level = 60, mp = 450, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utori flam", name = "ignite", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 30, duration = 1, level = 26, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utori kor", name = "inflict wound", group1 = "attack", group2 = "", type = "instant", vocation = "elite knight", cooldown = 30, duration = 1, level = 40, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utori mas sio", name = "enchant party", group1 = "support", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 2, duration = 120, level = 32, mp = 0, premium = true, soul = 0, mlevel = 0, condition = "3x3"},
- {words = "utori mort", name = "curse", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 50, duration = 1, level = 75, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utori pox", name = "envenom", group1 = "attack", group2 = "", type = "instant", vocation = "elder druid", cooldown = 30, duration = 1, level = 50, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utori san", name = "holy flash", group1 = "attack", group2 = "", type = "instant", vocation = "royal paladin", cooldown = 40, duration = 1, level = 70, mp = 50, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utori vis", name = "electrify", group1 = "attack", group2 = "", type = "instant", vocation = "master sorcerer", cooldown = 1, duration = 1, level = 34, mp = 30, premium = true, soul = 0, mlevel = 0, condition = "3"},
- {words = "utura", name = "recovery", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 60, duration = 60, level = 50, mp = 75, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utura gran", name = "intense recovery", group1 = "healing", group2 = "", type = "instant", vocation = false, cooldown = 60, duration = 60, level = 100, mp = 165, premium = true, soul = 0, mlevel = 0, condition = ""},
- {words = "utura mas sio", name = "heal party", group1 = "support", group2 = "", type = "instant", vocation = "elder druid", cooldown = 2, duration = 120, level = 32, mp = 0, premium = true, soul = 0, mlevel = 0, condition = "3x3"}
- }
- }
- function Spell:getInfo(spell_name, search_type) -- Working
- arguments('Spell:getInfo', {'string', spell_name})
- local spell_found
- if ((search_type or ''):lower() == 'words') then
- spell_found = table.binaryfind(self.data, spell_name:lower(), 'words')
- elseif ((search_type or ''):lower() == 'name') then
- spell_found = table.find(self.data, spell_name:lower(), 'name')
- else
- spell_found = table.binaryfind(self.data, spell_name:lower(), 'words') or table.find(self.data, spell_name:lower(), 'name')
- end
- if (spell_found) then
- return self.data[spell_found]
- end
- return nil
- end
- Untils = {
- }
- function Untils:parseLootMessage(message, with_amount) -- Working
- if (type(message) == 'userdata') then message = message.content end
- if (type(with_amount) ~= 'boolean') then with_amount = false end
- if (not string.find(message:lower(), 'loot of')) then return end
- arguments('Untils:getMonsterLoot', {'string', message, 'boolean', with_amount})
- local loot_info, exceptions = {name = '', items = {}}, {['small rubies'] = 'small ruby', ['small topazes'] = 'small topaz', ['giant shimmering pearl'] = 'giant shimmering pearl (blue)'}
- loot_info.name, loot_info.items_temp = message:match('Loot of[ an]* (.+): (.+)')
- if (loot_info.name) then
- for _, item in ipairs(loot_info.items_temp:token(nil, ', ')) do
- setwarning(WARNING_ITEM, false)
- local item_amount = tonumber(item:token(1)) or 1
- local _item_name = item:gsub('%d', ''):gsub('^a ', ''):gsub('^an ', ''):gsub('^[%s]*', ''):lower()
- if (exceptions[_item_name] ~= nil) then
- _item_name = exceptions[_item_name]
- end
- local item_name = itemname(itemid(_item_name))
- if (#item_name ~= 0) then
- if (with_amount) then
- local item_found = table.find(loot_info.items, item_name, 'name')
- if (item_found) then
- loot_info.items[item_found].amount = loot_info.items[item_found].amount + item_amount
- else
- table.insert(loot_info.items, {name = item_name, amount = item_amount})
- end
- elseif (not table.find(loot_info.items, item_name)) then
- table.insert(loot_info.items, item_name)
- end
- end
- end
- loot_info.items_temp = nil
- return loot_info
- end
- return {name = '', items = {}}
- end
- function Untils:parseAttackMessage(message) -- Working
- if (type(message) == 'userdata') then message = message.content end
- if (not string.find(message, 'lose')) then return end
- arguments('Untils:parseAttackMessage', {'string', message})
- local damage_info = {damage = 0, dealer = {name = '', type = ''}, target = {name = '', type = ''}}
- damage_info.damage, damage_info.dealer.name = message:match('You lose (%w+) .+ due to an attack by (.+)%.')
- if (damage_info.damage) then
- damage_info.damage = tonumber(damage_info.damage)
- damage_info.dealer.name = damage_info.dealer.name:gsub('^a ', ''):gsub('^an ', '')
- damage_info.dealer.type = (Unit:isPlayer(damage_info.dealer.name) and ('player')) or ('monster')
- damage_info.target = {name = $name, type = 'player'}
- return damage_info
- else
- damage_info.target.name, damage_info.damage = message:match('(.+) loses (%w+) .+ due to your attack%.')
- if (damage_info.damage) then
- damage_info.damage = tonumber(damage_info.damage)
- damage_info.dealer = {name = $name, type = 'player'}
- damage_info.target.name = damage_info.target.name:gsub('^A ', ''):gsub('^An ', '')
- damage_info.target.type = (Unit:isPlayer(damage_info.target.name) and ('player')) or ('monster')
- return damage_info
- else
- damage_info.target.name, damage_info.damage, damage_info.dealer.name = message:match('(.+) loses (%w+) .+ due to an attack by (.+)%.')
- if (damage_info.damage) then
- damage_info.damage = tonumber(damage_info.damage)
- damage_info.dealer.name = damage_info.dealer.name:gsub('^a ', ''):gsub('^an ', '')
- damage_info.dealer.type = (Unit:isPlayer(damage_info.dealer.name) and ('player')) or ('monster')
- damage_info.target.name = damage_info.target.name:gsub('^A ', ''):gsub('^An ', '')
- damage_info.target.type = (Unit:isPlayer(damage_info.target.name) and ('player')) or ('monster')
- return damage_info
- end
- end
- end
- return {damage = 0, dealer = {name = '', type = ''}, target = {name = '', type = ''}}
- end
- function Untils:parseHealMessage(message) -- Working
- if (type(message) == 'userdata') then message = message.content end
- if (not string.find(message, 'heal')) then return end
- arguments('Untils:parseHealMessage', {'string', message})
- local heal_info = {damage = 0, healer = '', target = ''}
- heal_info.damage = message:match('You healed yourself for (%w+) hitpoint[s]*%.')
- if (heal_info.damage) then
- heal_info.damage, heal_info.healer, heal_info.target = tonumber(heal_info.damage), $name, $name
- return heal_info
- else
- heal_info.healer, heal_info.damage = message:match('(.+) healed himself for (%w+) hitpoint[s]*%.')
- if (heal_info.damage) then
- heal_info.damage, heal_info.target = tonumber(heal_info.damage), heal_info.healer
- return heal_info
- else
- heal_info.target, heal_info.damage = message:match('You heal (.+) for (%w+) hitpoint[s]*%.')
- if (heal_info.damage) then
- heal_info.damage, heal_info.healer = tonumber(heal_info.damage), $name
- return heal_info
- else
- heal_info.healer, heal_info.damage= message:match('You were healed by (.+) for (%w+) hitpoint[s]*%.')
- if (heal_info.damage) then
- heal_info.damage, heal_info.target = tonumber(heal_info.damage), $name
- return heal_info
- else
- heal_info.target, heal_info.healer, heal_info.damage = message:match('(.+) was healed by (.+) for (%w+) hitpoint[s]*%.')
- if (heal_info.damage) then
- heal_info.damage = tonumber(heal_info.damage)
- return heal_info
- end
- end
- end
- end
- end
- return {damage = 0, healer = '', target = ''}
- end
- function Untils:string2Pixels(text) -- Working
- if (type(text) ~= 'string') then text = tostring(text) end
- local pixels = 0
- local characters = {[" "] = 3, ["!"] = 3, ['"'] = 6, ["#"] = 9, ["$"] = 7, ["%"] = 12, ["&"] = 9, ["'"] = 3, ["("] = 5, [")"] = 5, ["*"] = 6, [","] = 4, ["-"] = 5, ["."] = 3, ["/"] = 6, ["0"] = 7, ["1"] = 7, ["2"] = 7, ["3"] = 7, ["4"] = 7, ["5"] = 7, ["6"] = 7, ["7"] = 7, ["8"] = 7, ["9"] = 7, [":"] = 3, [";"] = 3, ["<"] = 9, ["="] = 9, [">"] = 9, ["?"] = 6, ["@"] = 10, ["A"] = 9, ["B"] = 7, ["C"] = 7, ["D"] = 8, ["E"] = 6, ["F"] = 6, ["G"] = 8, ["H"] = 8, ["I"] = 5, ["J"] = 6, ["K"] = 7, ["L"] = 6, ["M"] = 10, ["N"] = 7, ["O"] = 8, ["P"] = 7, ["Q"] = 8, ["R"] = 8, ["S"] = 7, ["T"] = 7, ["U"] = 8, ["V"] = 7, ["X"] = 7, ["W"] = 11, ["Y"] = 7, ["Z"] = 7, ["["] = 5, ["\\"] = 6, ["]"] = 5, ["^"] = 9, ["_"] = 7, ["`"] = 6, ["a"] = 7, ["b"] = 7, ["c"] = 6, ["d"] = 7, ["e"] = 7, ["f"] = 4, ["g"] = 7, ["h"] = 7, ["i"] = 3, ["j"] = 4, ["k"] = 7, ["l"] = 3, ["m"] = 11, ["n"] = 7, ["o"] = 7, ["p"] = 7, ["q"] = 7, ["r"] = 5, ["s"] = 6, ["t"] = 5, ["u"] = 7, ["v"] = 7, ["x"] = 7, ["w"] = 9, ["y"] = 7, ["z"] = 6, ["{"] = 7, ["|"] = 7, ["}"] = 7, ["~"] = 9}
- if (#text ~= 0) then
- for i = 1, #text do
- pixels = pixels + (characters[string.sub(text, i, i)] or 0)
- end
- end
- return pixels
- end
- local STATS_DATA_RUN_LAST = $timems
- local STATS_DATA_RUN_DELAY = 100
- Stats = {
- monsters_seen = {},
- players_seen = {},
- monsters_killed = {},
- items_looted = {},
- supplies_used = {},
- damage_dealt = 0,
- damage_received = 0,
- damage_stats = {},
- heal_stats = {}
- }
- function Stats:getGamePlayData() -- Working
- if (STATS_DATA_RUN_LAST + STATS_DATA_RUN_DELAY >= $timems) then return end
- if (#self.supplies_used == 0) then
- for _, section in ipairs({'POTIONS_AND_RUNES', 'AMMUNITION', 'DISTANCE_WEAPONS'}) do
- for _, section_item in ipairs(exec('return ' .. section)) do
- table.binaryinsert(self.supplies_used, {name = section_item, id = itemid(section_item), type = section, current_amount = (section == 'POTIONS_AND_RUNES' and servercount(section_item)) or (section == 'AMMUNITION' and itemcount(section_item, 'belt')) or (section == 'DISTANCE_WEAPONS' and itemcount(section_item, 'rhand')) or 0, amount = 0, price = math.positive(itemcost(section_item))}, 'name')
- end
- end
- end
- for _, supply in ipairs(self.supplies_used) do
- if (supply.type == 'POTIONS_AND_RUNES') then
- if (servercount(supply.name) ~= supply.current_amount) then
- supply.current_amount, supply.amount = servercount(supply.name), supply.amount + 1
- end
- elseif (supply.type == 'AMMUNITION') then
- if ($belt.id == supply.id) then
- local supply_count = $belt.count
- if (supply_count < supply.current_amount) then
- supply.current_amount, supply.amount = supply_count, supply.amount + 1
- elseif (supply.current_amount ~= supply_count) then
- supply.current_amount = supply_count
- end
- end
- elseif (supply.type == 'DISTANCE_WEAPONS') then
- if ($rhand.id == supply.id) then
- local supply_count = $rhand.count
- if (supply_count < supply.current_amount) then
- supply.current_amount, supply.amount = supply_count, supply.amount + 1
- elseif (supply.current_amount ~= supply_count) then
- supply.current_amount = supply_count
- end
- end
- end
- end
- foreach newmessage m do
- if (m.type == MSG_INFO and m.content:match('^Loot of')) then
- local loot_info = Untils:parseLootMessage(m.content, true)
- if (#loot_info.name ~= 0) then
- local monster_found = table.binaryfind(self.monsters_killed, loot_info.name:lower(), 'name')
- if (monster_found) then
- self.monsters_killed[monster_found].amount = self.monsters_killed[monster_found].amount + 1
- else
- table.binaryinsert(self.monsters_killed, {name = loot_info.name:lower(), amount = 1}, 'name')
- end
- if (#loot_info.items ~= 0) then
- for _, item in ipairs(loot_info.items) do
- local item_found = table.binaryfind(self.items_looted, item.name, 'name')
- if (item_found) then
- self.items_looted[item_found].amount = self.items_looted[item_found].amount + item.amount
- else
- table.binaryinsert(self.items_looted, {name = item.name:lower(), amount = item.amount, price = math.positive(itemvalue(item.name))}, 'name')
- end
- end
- end
- end
- elseif (m.type == MSG_STATUSLOG) then
- if (string.find(m.content, 'lose')) then
- local damage_info = Untils:parseAttackMessage(m.content)
- if (#damage_info.dealer.name ~= 0 and #damage_info.target.name ~= 0) then
- if (damage_info.dealer.name:lower() == $name:lower()) then
- self.damage_dealt = damage_info.damage
- end
- if (damage_info.target.name:lower() == $name:lower()) then
- self.damage_received = damage_info.damage
- end
- local dealer_found = table.binaryfind(self.damage_stats, damage_info.dealer.name:lower(), 'name')
- if (dealer_found) then
- self.damage_stats[dealer_found].dealt = self.damage_stats[dealer_found].dealt + damage_info.damage
- else
- table.binaryinsert(self.damage_stats, {name = damage_info.dealer.name:lower(), dealt = damage_info.damage, received = 0}, 'name')
- end
- local target_found = table.binaryfind(self.damage_stats, damage_info.target.name:lower(), 'name')
- if (target_found) then
- self.damage_stats[target_found].received = self.damage_stats[target_found].received + damage_info.damage
- else
- table.binaryinsert(self.damage_stats, {name = damage_info.target.name:lower(), dealt = 0, received = damage_info.damage}, 'name')
- end
- end
- elseif (string.find(m.content, 'heal')) then
- local heal_info = Untils:parseHealMessage(m.content)
- if (#heal_info.healer ~= 0 and #heal_info.target ~= 0) then
- local healer_found = table.binaryfind(self.heal_stats, heal_info.healer:lower(), 'name')
- if (healer_found) then
- self.heal_stats[healer_found].given = self.heal_stats[healer_found].given + heal_info.damage
- else
- table.binaryinsert(self.heal_stats, {name = heal_info.healer:lower(), given = heal_info.damage, received = 0}, 'name')
- end
- local target_found = table.binaryfind(self.heal_stats, heal_info.target:lower(), 'name')
- if (target_found) then
- self.heal_stats[target_found].received = self.heal_stats[target_found].received + heal_info.damage
- else
- table.binaryinsert(self.heal_stats, {name = heal_info.target:lower(), given = 0, received = heal_info.damage}, 'name')
- end
- end
- end
- end
- end
- foreach creature c 's' do
- if (Unit:isPlayer(c) and not table.binaryfind(self.players_seen, c.name) and c ~= $self) then
- table.binaryinsert(self.players_seen, c.name)
- elseif (not Unit:isNPC(c) and not table.binaryfind(self.monsters_seen, c.id)) then
- table.binaryinsert(self.monsters_seen, c.id)
- end
- end
- STATS_DATA_RUN_LAST = $timems
- end
- function Stats:clearStatsData(section_name) -- Working
- if (table.find({SC_ALL_SECTIONS, SC_MONSTERS_SEEN, SC_PLAYERS_SEEN, SC_MONSTERS_KILLED, SC_ITEMS_LOOTED, SC_SUPPLIES_USED, SC_DAMAGE_DEALT, SC_DAMAGE_RECEIVED, SC_DAMAGE_STATS, SC_HEAL_STATS}, section_name)) then
- for _, section in ipairs({'monsters_seen', 'players_seen', 'monsters_killed', 'items_looted', 'supplies_used', 'damage_dealt', 'damage_received', 'damage_stats', 'heal_stats'}) do
- if (section_name == SC_ALL_SECTIONS or section_name == exec('return SC_' .. section:upper())) then
- if (section == 'damage_dealt' or section == 'damage_received') then
- exec('Stats.' .. section .. ' = 0')
- else
- exec('Stats.' .. section .. ' = {}')
- end
- end
- end
- return true
- end
- return false
- end
- function Stats:getMonstersSeen() -- Working
- return #self.monsters_seen
- end
- function Stats:getPlayersSeen(return_names) -- Working
- if (type(return_names) == 'boolean' and return_names) then
- return self.players_seen
- end
- return #self.players_seen
- end
- function Stats:getMonstersKilled(monster_name) -- Working
- if (type(monster_name) == 'string') then
- local monster_found = table.binaryfind(self.monsters_killed, monster_name:lower(), 'name')
- if (monster_found) then
- return self.monsters_killed[monster_found].amount
- end
- return 0
- end
- return self.monsters_killed
- end
- function Stats:addItemsLooted(item_name, item_amount, item_price) -- Working
- arguments('Stats:addItemsLooted', {'string', item_name, 'number', item_amount})
- if (#itemname(itemid(item_name)) == 0) then return end
- local item_found = table.binaryfind(self.items_looted, item_name:lower(), 'name')
- if (item_found) then
- self.items_looted[item_found].amount = self.items_looted[item_found].amount + math.positive(item_amount)
- if (type(item_price) == 'number') then self.items_looted[item_found].price = math.positive(item_price) end
- else
- if (type(item_price) ~= 'number') then item_price = itemvalue(item_name) end
- table.binaryinsert(self.items_looted, {name = item_name:lower(), amount = math.positive(item_amount), price = math.positive(item_price)}, 'name')
- end
- return true
- end
- function Stats:getItemsLooted(item_name) -- Working
- if (type(item_name) == 'string') then
- local item_found = table.binaryfind(self.items_looted, item_name:lower(), 'name')
- if (item_found) then
- return self.items_looted[item_found].amount
- end
- return 0
- end
- return self.items_looted
- end
- function Stats:addSuppliesUsed(supply_name, supply_amount, supply_price) -- Working
- arguments('Stats:addSuppliesUsed', {'string', supply_name, 'number', supply_amount})
- if (#itemname(itemid(supply_name)) == 0) then return end
- local supply_found = table.binaryfind(self.supplies_used, supply_name:lower(), 'name')
- if (supply_found) then
- self.supplies_used[supply_found].amount = self.supplies_used[supply_found].amount + math.positive(supply_amount)
- if (type(supply_price) == 'number') then self.supplies_used[supply_found].price = math.positive(supply_price) end
- else
- if (type(supply_price) ~= 'number') then supply_price = itemcost(supply_name) end
- table.binaryinsert(self.supplies_used, {name = supply_name:lower(), id = itemid(supply_name), type = 'OTHER', current_amount = 0, amount = math.positive(supply_amount), price = math.positive(supply_price)}, 'name')
- end
- return true
- end
- function Stats:getSuppliesUsed(supply_name) -- Working
- if (type(supply_name) == 'string') then
- local supply_found = table.binaryfind(self.supplies_used, supply_name:lower(), 'name')
- if (supply_found) then
- return self.supplies_used[supply_found].amount
- end
- return 0
- end
- return self.supplies_used
- end
- function Stats:lastDamageDealt() -- Working
- return self.damage_dealt
- end
- function Stats:lastDamageReceived() -- Working
- return self.damage_received
- end
- function Stats:getDamageDealt(creature_name) -- Working
- arguments('Stats:getDamageDealt', {'string', creature_name})
- local creature_found = table.binaryfind(self.damage_stats, creature_name:lower(), 'name')
- if (creature_found) then
- return self.damage_stats[creature_found].dealt
- end
- return 0
- end
- function Stats:getDamageReceived(creature_name) -- Working
- arguments('Stats:getDamageReceived', {'string', creature_name})
- local creature_found = table.binaryfind(self.damage_stats, creature_name:lower(), 'name')
- if (creature_found) then
- return self.damage_stats[creature_found].received
- end
- return 0
- end
- function Stats:getHealGiven(creature_name) -- Working
- arguments('Stats:getHealGiven', {'string', creature_name})
- local creature_found = table.binaryfind(self.heal_stats, creature_name:lower(), 'name')
- if (creature_found) then
- return self.heal_stats[creature_found].given
- end
- return 0
- end
- function Stats:getHealReceived(creature_name) -- Working
- arguments('Stats:getHealReceived', {'string', creature_name})
- local creature_found = table.binaryfind(self.heal_stats, creature_name:lower(), 'name')
- if (creature_found) then
- return self.heal_stats[creature_found].received
- end
- return 0
- end
- local skin_temp = _G['skin']
- _G['skin'] = function(...) -- Working
- local skin_items, skin_items_before, skin_items_after = {'minotaur leather', 'lizard leather', 'green dragon leather', 'red dragon leather', 'hardened bone', 'perfect behemoth fang'}, {['minotaur leather'] = 0, ['lizard leather'] = 0, ['green dragon leather'] = 0, ['red dragon leather'] = 0, ['hardened bone'] = 0, ['perfect behemoth fang'] = 0}, {['minotaur leather'] = 0, ['lizard leather'] = 0, ['green dragon leather'] = 0, ['red dragon leather'] = 0, ['hardened bone'] = 0, ['perfect behemoth fang'] = 0}
- for item_name, _ in pairs(skin_items_before) do
- skin_items_before[item_name] = itemcount(item_name, 'backpack')
- end
- wait(200) skin_temp(...) wait(200)
- for item_name, _ in pairs(skin_items_after) do
- skin_items_after[item_name] = itemcount(item_name, 'backpack')
- end
- for _, item_name in ipairs(skin_items) do
- if (skin_items_before[item_name] ~= skin_items_after[item_name]) then
- Stats:addItemsLooted(item_name, 1)
- end
- end
- end
- local stake_temp = _G['stake']
- _G['stake'] = function(...) -- Working
- local stake_items, stake_items_before, stake_items_after = {'vampire dust', 'demon dust'}, {['vampire dust'] = 0, ['demon dust'] = 0}, {['vampire dust'] = 0, ['demon dust'] = 0}
- for item_name, _ in pairs(stake_items_before) do
- stake_items_before[item_name] = itemcount(item_name, 'backpack')
- end
- wait(200) stake_temp(...) wait(200)
- for item_name, _ in pairs(stake_items_after) do
- stake_items_after[item_name] = itemcount(item_name, 'backpack')
- end
- for _, item_name in ipairs(stake_items) do
- if (stake_items_before[item_name] ~= stake_items_after[item_name]) then
- Stats:addItemsLooted(item_name, 1)
- end
- end
- end
- local fish_temp = _G['fish']
- _G['fish'] = function(...) -- Working
- local fish_items, fish_items_before, fish_items_after = {'giant shimmering pearl (gold)', 'giant shimmering pearl (blue)', 'white pearl', 'small sapphire', "leviathan's amulet"}, {['giant shimmering pearl (gold)'] = 0, ['giant shimmering pearl (blue)'] = 0, ['white pearl'] = 0, ['small sapphire'] = 0, ["leviathan's amulet"] = 0}, {['giant shimmering pearl (gold)'] = 0, ['giant shimmering pearl (blue)'] = 0, ['white pearl'] = 0, ['small sapphire'] = 0, ["leviathan's amulet"] = 0}
- for item_name, _ in pairs(fish_items_before) do
- fish_items_before[item_name] = itemcount(item_name, 'backpack')
- end
- wait(200) fish_temp(...) wait(200)
- for item_name, _ in pairs(fish_items_after) do
- fish_items_after[item_name] = itemcount(item_name, 'backpack')
- end
- for _, item_name in ipairs(fish_items) do
- if (fish_items_before[item_name] ~= fish_items_after[item_name]) then
- Stats:addItemsLooted(item_name, 1)
- end
- end
- end
- function unrust(ignore_common, drop_items) -- Working
- local rusty_items, unrusted_items, unrusted_items_before, unrusted_items_after = (not ignore_common and {8894, 8895, 8896, 8897, 8898, 8899}) or {8895, 8896, 8898, 8899}, {'brass armor', 'chain armor', 'crown armor', 'golden armor', 'knight armor', 'paladin armor', 'plate armor', 'scale armor', 'brass legs', 'chain legs', 'crown legs', 'golden legs', 'knight legs', 'plate legs', 'studded legs'}, {['brass armor'] = 0, ['chain armor'] = 0, ['crown armor'] = 0, ['golden armor'] = 0, ['knight armor'] = 0, ['paladin armor'] = 0, ['plate armor'] = 0, ['scale armor'] = 0, ['brass legs'] = 0, ['chain legs'] = 0, ['crown legs'] = 0, ['golden legs'] = 0, ['knight legs'] = 0, ['plate legs'] = 0, ['studded legs'] = 0}, {['brass armor'] = 0, ['chain armor'] = 0, ['crown armor'] = 0, ['golden armor'] = 0, ['knight armor'] = 0, ['paladin armor'] = 0, ['plate armor'] = 0, ['scale armor'] = 0, ['brass legs'] = 0, ['chain legs'] = 0, ['crown legs'] = 0, ['golden legs'] = 0, ['knight legs'] = 0, ['plate legs'] = 0, ['studded legs'] = 0}
- for item_name, _ in pairs(unrusted_items_before) do
- unrusted_items_before[item_name] = itemcount(item_name, 'backpack')
- end
- wait(200)
- for _, rusty_item in ipairs(rusty_items) do
- if (itemcount(rusty_item, 'backpack') ~= 0 and itemcount(9016, 'backpack') ~= 0) then
- useitemon(9016, rusty_item, 'backpack')
- Stats:addSuppliesUsed('rust remover', 1, 50)
- break
- end
- end
- wait(200)
- for item_name, _ in pairs(unrusted_items_after) do
- unrusted_items_after[item_name] = itemcount(item_name, 'backpack')
- end
- if (drop_items) then
- for _, item_name in ipairs({'brass armor', 'chain armor', 'plate armor', 'scale armor', 'brass legs', 'chain legs', 'plate legs', 'studded legs'}) do
- if (itemcount(item_name, 'backpack') ~= 0) then
- moveitems(item_name, 'ground', 'backpack') waitping()
- end
- end
- end
- for _, item_name in ipairs(unrusted_items) do
- if (unrusted_items_before[item_name] ~= unrusted_items_after[item_name]) then
- Stats:addItemsLooted(item_name, 1)
- end
- end
- end
- Targeting = {
- monster_counts = {['Any'] = '0', ['1'] = '1', ['2+'] = '2', ['2'] = '3', ['3+'] = '4', ['3'] = '5', ['4+'] = '6', ['4'] = '7', ['5+'] = '8', ['5'] = '9', ['6+'] = '10', ['6'] = '11', ['7+'] = '12', ['7'] = '13', ['8+'] = '14', ['8'] = '15', ['9+'] = '16', ['9'] = '17'},
- monster_attacks = {['no avoidance'] = 'No Avoidance', ['avoid wave'] = 'Avoid Wave', ['avoid beam'] = 'Avoid Beam'},
- desired_stances = {['no movement'] = 'No Movement', ['strike'] = 'Strike', ['parry'] = 'Parry', ['approach'] = 'Approach', ['circle'] = 'Circle', ['reach'] = 'Reach', ['reach & strike'] = 'Reach & Strike', ['reach & parry'] = 'Reach & Parry', ['reach & circle'] = 'Reach & Circle', ['lure & stand'] = 'Lure & Stand', ['lure & circle'] = 'Lure & Circle', ['keep away'] = 'Keep Away', ['wait & keep away'] = 'Wait & Keep Away', ['away in line'] = 'Away in Line', ['wait & away in line'] = 'Wait & Away in Line', ['lure & keep away'] = 'Lure & Keep Away', ['wait & lure & keep away'] = 'Wait & Lure & Keep Away', ['lose target'] = 'Lose Target'},
- custom_distances = {['default'] = 'Default', ['2'] = '2', ['3'] = '3', ['4'] = '4', ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9'},
- desired_attacks = {['no action'] = 'No Action', ['attack'] = 'Attack', ['follow'] = 'Follow'},
- attack_modes = {['no change'] = 'No Change', ['stand/offensive'] = 'Stand/Offensive', ['stand/balanced'] = 'Stand/Balanced', ['stand/defensive'] = 'Stand/Defensive', ['chase/offensive'] = 'Chase/Offensive', ['chase/balanced'] = 'Chase/Balanced', ['chase/defensive'] = 'Chase/Defensive'},
- event_types = {['normal event'] = 'Normal Event', ['urgent event'] = 'Urgent Event'}
- }
- Targeting.settings = {
- ['Monsters'] = {['Name'] = function(value) return value end, ['Categories'] = function(value) return value end, ['Count'] = function(value) return (Targeting.monster_counts[tostring(value)] and value) or ('Any') end, ['Setting1'] = {['HpRange'] = function(value) return value or ('0 to 100') end, ['Danger'] = function(value) return math.max(tonumber(value), 0) end, ['MonsterAttacks'] = function(value) return Targeting.monster_attacks[tostring(value):lower()] or ('No Avoidance') end, ['DesiredStance'] = function(value) return Targeting.desired_stances[tostring(value):lower()] or ('No Movement') end, ['CustomDistance'] = function(value) return Targeting.custom_distances[tostring(value):lower()] or ('Default') end, ['DesiredAttack'] = function(value) return Targeting.desired_attacks[tostring(value):lower()] or ('No Action') end, ['FirstSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SecondSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['ThirdSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['FourthSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SpellRate'] = function(value) return value or ('2000 to 3000') end, ['SyncSpell'] = function(value) return toyesno(value) end, ['AttackMode'] = function(value) return Targeting.attack_modes[tostring(value):lower()] or ('No Change') end}, ['Setting2'] = {['HpRange'] = function(value) return value or ('0 to 100') end, ['Danger'] = function(value) return math.max(tonumber(value), 0) end, ['MonsterAttacks'] = function(value) return Targeting.monster_attacks[tostring(value):lower()] or ('No Avoidance') end, ['DesiredStance'] = function(value) return Targeting.desired_stances[tostring(value):lower()] or ('No Movement') end, ['CustomDistance'] = function(value) return Targeting.custom_distances[tostring(value):lower()] or ('Default') end, ['DesiredAttack'] = function(value) return Targeting.desired_attacks[tostring(value):lower()] or ('No Action') end, ['FirstSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SecondSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['ThirdSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['FourthSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SpellRate'] = function(value) return value or ('2000 to 3000') end, ['SyncSpell'] = function(value) return toyesno(value) end, ['AttackMode'] = function(value) return Targeting.attack_modes[tostring(value):lower()] or ('No Change') end}, ['Setting3'] = {['HpRange'] = function(value) return value or ('0 to 100') end, ['Danger'] = function(value) return math.max(tonumber(value), 0) end, ['MonsterAttacks'] = function(value) return Targeting.monster_attacks[tostring(value):lower()] or ('No Avoidance') end, ['DesiredStance'] = function(value) return Targeting.desired_stances[tostring(value):lower()] or ('No Movement') end, ['CustomDistance'] = function(value) return Targeting.custom_distances[tostring(value):lower()] or ('Default') end, ['DesiredAttack'] = function(value) return Targeting.desired_attacks[tostring(value):lower()] or ('No Action') end, ['FirstSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SecondSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['ThirdSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['FourthSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SpellRate'] = function(value) return value or ('2000 to 3000') end, ['SyncSpell'] = function(value) return toyesno(value) end, ['AttackMode'] = function(value) return Targeting.attack_modes[tostring(value):lower()] or ('No Change') end}, ['Setting4'] = {['HpRange'] = function(value) return value or ('0 to 100') end, ['Danger'] = function(value) return math.max(tonumber(value), 0) end, ['MonsterAttacks'] = function(value) return Targeting.monster_attacks[tostring(value):lower()] or ('No Avoidance') end, ['DesiredStance'] = function(value) return Targeting.desired_stances[tostring(value):lower()] or ('No Movement') end, ['CustomDistance'] = function(value) return Targeting.custom_distances[tostring(value):lower()] or ('Default') end, ['DesiredAttack'] = function(value) return Targeting.desired_attacks[tostring(value):lower()] or ('No Action') end, ['FirstSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SecondSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['ThirdSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['FourthSpell'] = function(value) return string.capitalizeall((Spell:getInfo(tostring(value)) ~= nil and Spell:getInfo(tostring(value)).name) or ('No Action')) end, ['SpellRate'] = function(value) return value or ('2000 to 3000') end, ['SyncSpell'] = function(value) return toyesno(value) end, ['AttackMode'] = function(value) return Targeting.attack_modes[tostring(value):lower()] or ('No Change') end}, ['LootMonster'] = function(value) return toyesno(value) end, ['MustAttackMe'] = function(value) return toyesno(value) end, ['OnlyIfTrapped'] = function(value) return toyesno(value) end, ['PlayAlarm'] = function(value) return toyesno(value) end},
- ['StanceOptions'] = {['DiagonalMovement'] = function(value) return toyesno(value) or ('no') end, ['RangeDistance'] = function(value) return ((tonumber(value) >= 2 and tonumber(value) <= 9) and value) or ('2') end, ['LureIntensity'] = function(value) return ((tonumber(value) >= 0 and tonumber(value) <= 100) and value) or ('30') end},
- ['TargetSelection'] = {['ListOrder'] = function(value) return (tonumber(value) > 0 and value) or ('0') end, ['Health'] = function(value) return (tonumber(value) > 0 and value) or ('30') end, ['Proximity'] = function(value) return (tonumber(value) > 0 and value) or ('30') end, ['Danger'] = function(value) return (tonumber(value) > 0 and value) or ('10') end, ['Random'] = function(value) return (tonumber(value) > 0 and value) or ('0') end, ['Stick'] = function(value) return (tonumber(value) > 0 and value) or ('2') end, ['MustBeReachable'] = function(value) return toyesno(value) or ('yes') end, ['MustBeShootable'] = function(value) return toyesno(value) or ('no') end},
- ['TargetingPriority'] = {['Priority'] = function(value) return (tonumber(value) > 0 and value) or ('60') end, ['OverridePriority'] = function(value) return (tonumber(value) > 0 and value) or ('0') end, ['ExpireTime'] = function(value) return (tonumber(value) > 0 and value) or ('2000') end, ['LifeTime'] = function(value) return (tonumber(value) > 0 and value) or ('5000') end, ['EventType'] = function(value) return Targeting.event_types[tostring(value):lower()] or ('Normal Event') end},
- ['TargetingEnabled'] = function(value) return toyesno(value) end
- }
- function Targeting:monsters(monster_name, monster_count)
- local monster = {
- name = monster_name,
- count = monster_count
- }
- function monster:set(setting_path, value, update_gui)
- arguments('Targeting:monsters():set', {'string', setting_path})
- if (type(update_gui) ~= 'boolean') then update_gui = true end
- local setting_path = Targeting:getPath(self.name .. '_' .. Targeting.monster_counts[self.count] .. '/' .. setting_path)
- if (setting_path) then
- local setting_path_parts = setting_path:token(nil, '/')
- if (setting_path_parts[2] == 'Monsters') then
- if (not string.find(setting_path_parts[4], 'Setting')) then
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]][setting_path_parts[4]](value)), update_gui)
- if (setting_path_parts[4] == 'Name') then self.name = value elseif (setting_path_parts[4] == 'Count') then self.count = value end
- else
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]][setting_path_parts[4]][setting_path_parts[5]](value)), update_gui)
- end
- end
- end
- return self
- end
- function monster:get(setting_path)
- arguments('Targeting:monsters():get', {'string', setting_path})
- return getsetting(Targeting:getPath(self.name .. '_' .. Targeting.monster_counts[self.count] .. '/' .. setting_path))
- end
- return monster
- end
- function Targeting:set(setting_path, value, update_gui) -- Working
- arguments('Targeting:set', {'string', setting_path})
- if (type(update_gui) ~= 'boolean') then update_gui = true end
- local setting_path = Targeting:getPath(setting_path)
- if (setting_path) then
- local setting_path_parts = setting_path:token(nil, '/')
- if (setting_path_parts[2] == 'TargetingEnabled') then
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]](value)), update_gui)
- elseif (setting_path_parts[2] ~= 'Monsters') then
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]][setting_path_parts[3]](value)), update_gui)
- else
- if (not string.find(setting_path_parts[4], 'Setting')) then
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]][setting_path_parts[4]](value)), update_gui)
- else
- setsetting(setting_path, tostring(Targeting.settings[setting_path_parts[2]][setting_path_parts[4]][setting_path_parts[5]](value)), update_gui)
- end
- end
- end
- return self
- end
- function Targeting:getPath(setting_path) -- Working
- arguments('Targeting:getPatch', {'string', setting_path})
- local setting_path = setting_path:gsub('^Targeting/', '')
- local setting_path_extended = 'Targeting/' .. setting_path
- if (getsetting(setting_path_extended) ~= nil) then
- return setting_path_extended
- else
- for _, section in ipairs({'Monsters', 'StanceOptions', 'TargetSelection', 'TargetingPriority', 'TargetingEnabled'}) do
- setting_path_extended = 'Targeting/' .. section .. '/' .. setting_path
- if (getsetting(setting_path_extended) ~= nil) then
- return setting_path_extended
- end
- end
- end
- return nil
- end
- function Targeting:get(setting_path) -- Working
- arguments('Targeting:get', {'string', setting_path})
- return getsetting(Targeting:getPath(setting_path))
- end
- function Targeting:setState(value, stop_attack, update_gui) -- Working
- if (type(stop_attack) ~= 'boolean') then stop_attack = false end
- if (type(update_gui) ~= 'boolean') then update_gui = true end
- setsetting('Targeting/TargetingEnabled', toyesno(value), update_gui)
- if (toyesno(value) and stop_attack) then stopattack() end
- return self
- end
- function Targeting:getState() -- Working
- return getsetting('Targeting/TargetingEnabled')
- end
- ------------------------------LucasTerraDefaultSettings.lua---------------------------------
- LUCASSETTINGS_LIB = '1.2'
- print('Lucas Terra Default Settings Version: '..LUCASSETTINGS_LIB)
- local changesettings = true
- if changesettings then
- --setsetting('Cavebot/Looting/MoveItemsQuickly', 'yes') -- Enable it if you like, just remove the '--' in the beginning
- setsetting('Cavebot/Pathfinding/WalkableIds', '140\n404\n831-834\n883\n2131-2135\n2314-2316\n2319\n2346-2385\n2418-2426\n2431-2434\n2441-2444\n2469\n2471-2473\n2478\n2480-2486\n2519\n2523\n2775-2812\n2981-2985\n2987-2988\n3503-3504\n3514\n3807\n5086-5088\n6114-6115\n6355-6362\n6371-6372\n7864\n8455\n8763\n9061-9062\n10207\n10209\n10216\n10286\n10287-10288\n11009')
- setsetting('Hud/DisplaysList/ActiveHotkeys/Enabled', 'yes')
- setsetting('Hud/HudPolicy', 'Show if focused')
- setsetting('Input/Keyboard/KeyboardMode', 'Simulate keyboard')
- setsetting('Input/Keyboard/StuckCtrlShiftPolicy', 'If cavebot on, release after 1 sec')
- setsetting('Input/Keyboard/TypeWaitTime', '20 to 45')
- setsetting('Input/Keyboard/PressWaitTime', '45 to 65')
- setsetting('Input/Mouse/MouseMode', 'Simulate mouse') --'Control mouse /permit'
- setsetting('Input/Mouse/ScrollMode', 'Use mouse wheel')
- setsetting('Input/Mouse/StuckCursorPolicy', 'If cavebot on, release instantly')
- setsetting('Input/Mouse/MoveSpeed', 'Instantaneous') --Instantaneous
- setsetting('Input/Mouse/ClickWaitTime', '20 to 35')
- setsetting('Input/OpenMenuPolicy', 'Confirm if cavebotting')
- setsetting('Hotkeys/HotkeyCondition', 'Client focus required')
- if not getsetting('Hotkeys/HotkeyList/HideUnhideBot/Script') then
- addhotkey("HideUnhideBot", "listas('dontlist')\nshowbot()\nwait(300)", "u", "ctrl")
- else
- setsetting('Hotkeys/HotkeyList/HideUnhideBot/Script', "listas('dontlist')\nshowbot()\nwait(300)")
- end
- if not getsetting('Hotkeys/HotkeyList/HideUnhideSettings/Script') then
- addhotkey("HideUnhideSettings", "listas('dontlist')\nshowsettings()\nwait(300)", "j", "ctrl")
- else
- setsetting('Hotkeys/HotkeyList/HideUnhideSettings/Script', "listas('dontlist')\nshowsettings()\nwait(300)")
- end
- if not getsetting('Hotkeys/HotkeyList/PauseHotkey/Script') then
- addhotkey("PauseHotkey", "if not $targeting or not $cavebot then\n settargeting('on')\n setcavebot('on')\n setlooting('on')\n listas('Cavebot Resumed')\nelse\n settargeting('off')\n setcavebot('off')\n setlooting('off')\n listas('Cavebot Paused.')\nend\nwait(300)", "pause")
- end
- end
- ------------------------------LucasTerra.lua---------------------------------
- --12.4, Report bug on Lucas Terra's Library Thread: http://forums.tibianeobot.com/showthread.php?1013
- LUCAS_LIB = '12.4'
- print('Lucas Terra Library Version: '..LUCAS_LIB)
- -- Item Properties
- ITEM_NOTROOFEDGE = 0
- ITEM_TOPORDER1 = 1 --always on top
- ITEM_TOPORDER2 = 2 --walktrough (doors)
- ITEM_TOPORDER3 = 3 --walktrough (arcs)
- ITEM_CONTAINER = 4
- ITEM_STACKABLE = 5
- ITEM_CORPSE = 6
- ITEM_USEABLE = 7
- ITEM_WRITEABLE = 8
- ITEM_READABLE = 9
- ITEM_FLUIDCONTAINER = 10
- ITEM_SPLASH = 11
- ITEM_BLOCKWALK = 12
- ITEM_NOTMOVEABLE = 13
- ITEM_BLOCKSHOTS = 14
- ITEM_BLOCKPATHS = 15
- ITEM_PICKUPABLE = 16
- ITEM_HANGABLE = 17
- ITEM_HORIZONTAL = 18
- ITEM_VERTICAL = 19
- ITEM_ROTATEABLE = 20
- ITEM_LIGHTFONT = 21
- ITEM_UNKNOWN = 22
- ITEM_FLOORCHANGE = 23
- ITEM_OFFSET = 24
- ITEM_HEIGHTED = 25
- ITEM_BIGSPRITE = 26
- ITEM_UNEXIST = 27
- ITEM_MINIMAP = 28
- ITEM_ACTION = 29
- ITEM_GROUND = 30
- ITEM_DIAGONALBORDER,ITEM_BORDER = 31,31
- -- Credits to Anonymickey, for testing the msg types
- MSG_STATUS = 0 -- Status messages (In the screen).
- MSG_DEFAULT = 1 -- Any player/npc message in Default channel.
- MSG_WHISPER = 2 -- Any player whispering.
- MSG_YELL = 3 -- Any player yelling.
- MSG_NPC = 5 -- Any NPC answers in NPC channel.
- MSG_PVT = 6 -- Private messages from other players.
- MSG_CHANNEL = 7 -- Any player message in Game/Help/Real/Tutor/Trade channel.
- MSG_RED = 15 -- Red alert messages.
- MSG_RAID,MSG_ADVANCE = 16,16 -- Any white alert message.
- MSG_WELCOME = 17 -- Game/Channel welcome messages.
- MSG_STATUSLOG = 18 -- Status messages in Server Log.
- MSG_INFO = 19 -- Green messages (like loot message) in Server Log.
- MSG_SENT = 21 -- Private messages sent by you.
- -- Skull Types
- SKULL_NOSKULL = 0
- SKULL_YELLOW = 1
- SKULL_GREEN = 2
- SKULL_WHITE = 3
- SKULL_RED = 4
- SKULL_BLACK = 5
- SKULL_ORANGE = 6
- -- WarBanner Types
- WAR_NOWAR = 0
- WAR_GREEN = 1 --Friend
- WAR_RED = 2 --Enemy
- WAR_BLUE = 3 --In a War that you're not fighting
- -- Party Types
- PARTY_NOPARTY = 0
- PARTY_INVITED_LEADER = 1 -- Leader inviting you to party
- PARTY_INVITED_MEMBER = 2 -- Member invited to party
- PARTY_ONPARTY_MEMBER = 3 -- Member of a party
- PARTY_ONPARTY_LEADER = 4 -- Leader of the party
- PARTY_EXPSHARE_OK_MEMBER = 5 -- Exp Share Working Fine, member of a party
- PARTY_EXPSHARE_OK_LEADER = 6 -- Exp Share Working Fine, leader of the party
- PARTY_EXPSHARE_WAIT_MEMBER = 7 -- Exp Share on standby, member of a party
- PARTY_EXPSHARE_WAIT_LEADER = 8 -- Exp Share on standby, leader of the party
- PARTY_EXPSHARE_OFF_MEMBER = 9 -- Exp Disabled because of a low level char or player in different floor, member of a party
- PARTY_EXPSHARE_OFF_LEADER = 10 -- Exp Disabled because of a low level char or player in different floor, leader of the party
- ASCII = {'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'}
- -- Rune IDs
- RUNE_SD = 3155
- RUNE_UH = 3160
- RUNE_IH = 3152
- RUNE_HMM = 3198
- RUNE_ICICLE = 3158
- RUNE_STALAGMITE = 3179
- RUNE_FIREBALL = 3189
- RUNE_LMM = 3174
- RUNE_HOLY = 3182
- RUNE_MWALL = 3180
- RUNE_GROWTH = 3156
- RUNE_PARALYZE = 3165
- RUNE_GFB = 3191
- RUNE_AVALANCHE = 3161
- RUNE_STONESHOWER = 3175
- RUNE_THUNDERSTORM = 3202
- RUNE_EXPLO = 3200
- RUNE_SOULFIRE = 3195
- SCREEN_LEFT = -8
- SCREEN_TOP = -6
- SCREEN_BOTTOM = 7
- SCREEN_RIGHT = 9
- GLOBAL_BALANCE = 0
- GLOBAL_HUNGRY = 0
- _CREATUREPROPERTIES = {'name', 'id', 'posx', 'posy', 'posz', 'dir', 'outfit', 'color1', 'color2', 'color3', 'color4', 'addons', 'mount', 'lightintensity', 'lightcolor', 'hppc', 'speed', 'updated', 'skull', 'party', 'warbanner', 'dist', 'ignored', 'ismonster', 'isplayer', 'isshootable', 'lastattacked'}
- local shields = {3409, 3410, 3411, 3412, 3413, 3414, 3415, 3416, 3417, 3418, 3419, 3420, 3421, 3422, 3423, 3424, 3425, 3426, 3427, 3428, 3429, 3430, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 6131, 6390, 6432, 7460, 8077, 8078, 8079, 8080, 8081, 9372, 9372, 9377, 9380, 9401, 11688}
- local spellbooks = {3059, 8072, 8073, 8074, 8075, 8076, 8090, 11691}
- local axes = {665, 666, 667, 668, 669, 684, 685, 686, 687, 688, 783, 785, 786, 787, 788, 801, 802, 803, 804, 805, 3266, 3268, 3269, 3274, 3275, 3276, 3293, 3302, 3303, 3306, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3323, 3328, 3329, 3331, 3335, 3342, 3344, 3346, 6553, 7380, 7388, 7389, 7411, 7412, 7413, 7419, 7420, 7433, 7434, 7435, 7436, 7453, 7454, 7455, 7456, 7773, 8096, 8097, 8098, 9384, 10388, 10406, 11657}
- local clubs = {670, 671, 672, 673, 674, 689, 690, 691, 692, 693, 789, 790, 791, 792, 793, 806, 807, 808, 809, 810, 3208, 3270, 3279, 3282, 3286, 3289, 3304, 3305, 3309, 3310, 3311, 3312, 3321, 3322, 3324, 3325, 3327, 3332, 3333, 3336, 3337, 3340, 3341, 3343, 3348, 3453, 7379, 7381, 7387, 7392, 7409, 7410, 7414, 7415, 7421, 7422, 7423, 7424, 7425, 7426, 7427, 7428, 7429, 7430, 7431, 7432, 7437, 7450, 7451, 7452, 8099, 8100, 8101, 9373, 9385, 10391}
- local swords = {660, 661, 662, 663, 664, 679, 680, 681, 682, 683, 779, 780, 781, 782, 783, 794, 795, 796, 797, 798, 3264, 3265, 3267, 3271, 3272, 3273, 3278, 3280, 3281, 3283, 3284, 3285, 3288, 3290, 3291, 3292, 3294, 3295, 3296, 3297, 3299, 3300, 3301, 3307, 3308, 3326, 3330, 3334, 3338, 3339, 3345, 6101, 6527, 7382, 7383, 7384, 7385, 7386, 7390, 7391, 7402, 7403, 7404, 7405, 7406, 7407, 7408, 7416, 7417, 7418, 7449, 7774, 8102, 8103, 8104, 9375, 9386, 9387, 9396, 10389, 10390, 10392, 11693}
- local distone = {1781, 2992, 3277, 3287, 3298, 3347, 7366, 7367, 7368, 7378}
- local bows = {3349, 3350, 5803, 5907, 7438, 8021, 8022, 8023, 8024, 8025, 8026, 8027, 8028, 8029, 8030, 9378}
- local wands = {3071, 3072, 3073, 3074, 3075, 8092, 8093, 8094}
- local rods = {3065, 3066, 3067, 3069, 3070, 8082, 8083, 8084}
- local ammos = {761, 762, 763, 774, 3446, 3447, 3448, 3449, 3450, 6528, 7363, 7364, 7365}
- local ropes = {646, 3003, 9594, 9596, 9598}
- local shovels = {3457, 5710, 9594, 9596, 9598}
- local machetes = {3308, 3330, 9594, 9596, 9598}
- local picks = {3456, 9594, 9596, 9598}
- local eatfoodids = {3577, 3578, 3579, 3580, 3581, 3582, 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 3593, 3594, 3595, 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3606, 3607, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3910, 3911, 3912, 3913, 3914, 3915, 3916, 3917, 3918, 3919, 3920, 5678, 8010}
- local foods = {{169, 108}, {836, 48}, {841, 48}, {901, 720}, {904, 180}, {3577, 180}, {3578, 144}, {3579, 120}, {3580, 204}, {3581, 48}, {3582, 360}, {3583, 720}, {3584, 60}, {3585, 72}, {3586, 156}, {3587, 96}, {3588, 12}, {3589, 216}, {3590, 12}, {3591, 24}, {3592, 108}, {3593, 240}, {3594, 204}, {3595, 60}, {3596, 72}, {3597, 108}, {3598, 24}, {3599, 24}, {3600, 120}, {3601, 36}, {3602, 96}, {3606, 72}, {3607, 108}, {3723, 108}, {3724, 48}, {3725, 264}, {3726, 360}, {3727, 108}, {3728, 72}, {3729, 144}, {3730, 36}, {3731, 432}, {3732, 60}, {5096, 48}, {5678, 96}, {6125, 96}, {6277, 120}, {6278, 180}, {6392, 144}, {6393, 180}, {6500, 240}, {6541, 72}, {6542, 72}, {6543, 72}, {6544, 72}, {6545, 72}, {6569, 12}, {6574, 60}, {7158, 300}, {7159, 180}, {7372, 24}, {7373, 24}, {7375, 24}, {7377, 24}, {8010, 120}, {8011, 60}, {8012, 12}, {8013, 12}, {8014, 84}, {8015, 60}, {8016, 12}, {8017, 60}, {8019, 132}, {8177, 88}, {8197, 60}, {10219, 120}, {10329, 180}, {10453, 36}, {11459, 240}, {11460, 120}, {11461, 96}, {11462, 108}, {11681, 660}, {11682, 216}, {11683, 24}, {12310, 240}}
- local healthpots = {236, 239, 266, 7642, 7643, 7876}
- local manapots = {237, 238, 268, 7642}
- local rustyequips = {8891, 8892, 8893, 8894, 8895, 8896, 8897, 8898, 8899, 8900, 8901, 8902, 8903, 8904, 8905, 8906, 8907, 8908}
- local closeddoorsids = {1628, 1629, 1631, 1632, 1638, 1640, 1642, 1644, 1646, 1648, 1650, 1651, 1653, 1654, 1656, 1658, 1660, 1662, 1664, 1666, 1668, 1669, 1671, 1672, 1674, 1676, 1678, 1680, 1682, 1683, 1685, 1687, 1689, 1691, 1692, 1694, 1696, 1698, 4912, 4913, 5006, 5007, 5082, 5084, 5097, 5098, 5100, 5102, 5104, 5106, 5107, 5109, 5111, 5113, 5115, 5116, 5118, 5120, 5122, 5124, 5125, 5127, 5129, 5131, 5133, 5134, 5136, 5137, 5139, 5140, 5142, 5143, 5277, 5278, 5280, 5281, 5282, 5285, 5287, 5289, 5291, 5293, 5302, 5303, 5514, 5516, 5745, 5749, 6191, 6192, 6194, 6195, 6197, 6199, 6201, 6203, 6205, 6207, 6248, 6249, 6251, 6252, 6254, 6258, 6260, 6262, 6264, 6435, 6436, 6439, 6440, 6443, 6444, 6449, 6450, 6453, 6454, 6457, 6458, 6461, 6462, 6465, 6466, 6469, 6470, 6788, 6789, 6891, 6892, 6894, 6896, 6898, 6900, 6901, 6903, 6905, 6907, 7027, 7028, 7033, 7034, 7036, 7038, 7040, 7042, 7043, 7045, 7047, 7049, 7051, 7052, 7711, 7712, 7714, 7715, 7717, 7719, 7721, 7723, 7725, 7727, 7868, 7941, 8249, 8250, 8252, 8253, 8255, 8257, 8258, 8261, 8263, 8265, 8351, 8352, 8354, 8355, 8357, 8359, 8361, 8363, 8365, 8367, 9347, 9348, 9351, 9352, 9354, 9355, 9357, 9359, 9361, 9363, 9365, 9367, 9551, 9552, 9554, 9556, 9558, 9560, 9561, 9563, 9565, 9567, 9571, 9572, 9858, 9859, 9863, 9865, 9867, 9868, 9872, 9874, 10147, 10149, 10151, 10153, 10155, 10157, 10520, 10521, 11232, 11233, 11237, 11239, 11241, 11242, 11246, 11248, 11705}
- -- {1628, 1629, 1631, 1632, 1638, 1640, 1650, 1651, 1653, 1654, 1656, 1658, 1668, 1669, 1671, 1672, 1682, 1683, 1685, 1691, 1692, 1694, 4912, 4913, 5006, 5007, 5082, 5084, 5097, 5098, 5100, 5106, 5107, 5109, 5115, 5116, 5118, 5124, 5125, 5127, 5133, 5134, 5136, 5137, 5139, 5140, 5142, 5143, 5277, 5278, 5280, 5281, 5283, 5285, 5514, 5516, 5732, 5733, 5735, 5736, 6191, 6192, 6194, 6195, 6197, 6199, 6248, 6249, 6251, 6252, 6254, 6256, 6891, 6892, 6894, 6900, 6901, 6903, 7033, 7034, 7036, 7042, 7043, 7045, 7054, 7056, 7711, 7712, 7714, 7715, 7717, 7719, 8249, 8250, 8252, 8253, 8255, 8257, 8351, 8352, 8354, 8355, 8357, 8359, 9351, 9352, 9354, 9355, 9357, 9359, 9551, 9552, 9554, 9560, 9561, 9563, 9858, 9859, 9867, 9868, 11136, 11137, 11143, 11144, 11232, 11233, 11241, 11242, 11705, 11714, 12033, 12035, 12249, 12250}
- local openeddoorsids = {1630, 1633, 1639, 1641, 1643, 1645, 1647, 1649, 1652, 1655, 1657, 1659, 1661, 1663, 1665, 1667, 1670, 1673, 1675, 1677, 1679, 1681, 1684, 1686, 1688, 1690, 1693, 1695, 1697, 1699, 2178, 2180, 4911, 4914, 5083, 5085, 5099, 5101, 5103, 5105, 5108, 5110, 5112, 5114, 5117, 5119, 5121, 5123, 5126, 5128, 5130, 5132, 5135, 5138, 5141, 5144, 5279, 5282, 5284, 5286, 5288, 5290, 5292, 5294, 5515, 5117, 5746, 5748, 6193, 6196, 6198, 6200, 6202, 6204, 6206, 6208, 6250, 6253, 6255, 6257, 6259, 6261, 6263, 6265, 6893, 6895, 6897, 6899, 6902, 6904, 6906, 6908, 7035, 7037, 7039, 7041, 7044, 7046, 7048, 7050, 7713, 7716, 7718, 7720, 7722, 7724, 7726, 7728, 7869, 8251, 8254, 8256, 8258, 8260, 8262, 8264, 8266, 8353, 8356, 8358, 8360, 8362, 8364, 8366, 8368, 9353, 9356, 9358, 9360, 9362, 9364, 9366, 9368, 9553, 9555, 9557, 9559, 9562, 9564, 9566, 9568, 9860, 9864, 9866, 9869, 9873, 9875, 11234, 11238, 11240, 11243, 11247, 11249, 11708}
- -- {1630, 1633, 1639, 1641, 1652, 1655, 1657, 1659, 1670, 1673, 1684, 1686, 1693, 1695, 4911, 4914, 5083, 5085, 5099, 5101, 5108, 5110, 5117, 5119, 5126, 5128, 5135, 5138, 5141, 5144, 5279, 5282, 5284, 5286, 5515, 5517, 5734, 5737, 6193, 6196, 6198, 6200, 6250, 6253, 6255, 6257, 6893, 6895, 6902, 6904, 7035, 7037, 7044, 7046, 7055, 7057, 7713, 7716, 7718, 7720, 8251, 8254, 8256, 8258, 8353, 8356, 8358, 8360, 9353, 9356, 9358, 9360, 9553, 9555, 9562, 9564, 9860, 9869, 11138, 11145, 11234, 11243, 11708, 11716, 12034, 12036}
- local rashid = {662, 664, 667, 669, 672, 680, 681, 683, 686, 688, 691, 780, 781, 783, 786, 788, 791, 795, 796, 798, 803, 805, 808, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 2991, 3002, 3006, 3007, 3008, 3010, 3016, 3017, 3018, 3019, 3025, 3055, 3063, 3290, 3314, 3315, 3326, 3327, 3328, 3330, 3332, 3333, 3334, 3339, 3340, 3342, 3344, 3356, 3360, 3364, 3366, 3386, 3397, 3404, 3408, 3414, 3420, 3421, 3435, 3436, 3440, 3441, 3442, 3550, 3554, 3556, 5461, 5710, 5741, 5810, 5917, 5918, 6095, 6096, 6131, 6299, 6553, 7379, 7381, 7382, 7383, 7384, 7386, 7387, 7388, 7389, 7402, 7403, 7404, 7408, 7414, 7415, 7418, 7419, 7422, 7424, 7425, 7426, 7427, 7430, 7432, 7437, 7449, 7452, 7456, 7457, 7460, 7461, 7462, 7463, 7464, 8022, 8027, 8045, 8049, 8050, 8052, 8061, 8063, 9013, 9014, 9017, 9302, 9304, 11674}
- local greendjinn = {3048, 3051, 3052, 3053, 3054, 3065, 3066, 3067, 3069, 3070, 3078, 3084, 3085, 3097, 3098, 3214, 3281, 3297, 3299, 3307, 3318, 3322, 3324, 3369, 3370, 3371, 3373, 3383, 3384, 3428, 3429, 3432, 3434, 3574, 7407, 7411, 7413, 7419, 7421, 7428, 8082, 8083, 8084}
- local bluedjinn = {674, 679, 693, 779, 793, 794, 810, 3046, 3049, 3050, 3056, 3060, 3061, 3062, 3071, 3072, 3073, 3074, 3075, 3079, 3081, 3082, 3083, 3091, 3092, 3093, 3271, 3279, 3280, 3284, 3301, 3302, 3313, 3320, 3380, 3381, 3382, 3385, 3391, 3392, 3415, 3416, 3418, 3419, 3439, 3567, 7391, 7410, 7412, 7436, 7451, 7454, 8092, 8093, 8094}
- local creatureproducts = {3044, 4839, 5808, 5876, 5877, 5878, 5879, 5881, 5882, 5883, 5890, 5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900, 5901, 5902, 5905, 5906, 5919, 5920, 5925, 5930, 5943, 5948, 5954, 6535, 6540, 6546, 7290, 7786, 7882, 8031, 8143, 9053, 9054, 9055, 9393, 9606, 9631, 9632, 9633, 9634, 9635, 9636, 9637, 9638, 9639, 9640, 9641, 9642, 9643, 9644, 9645, 9646, 9647, 9648, 9649, 9650, 9651, 9652, 9654, 9655, 9656, 9657, 9658, 9659, 9660, 9661, 9662, 9663, 9664, 9665, 9666, 9667, 9668, 9683, 9684, 9685, 9686, 9688, 9689, 9690, 9691, 9692, 9693, 9694, 10196, 10272, 10273, 10274, 10275, 10276, 10277, 10278, 10279, 10280, 10281, 10282, 10283, 10289, 10291, 10292, 10293, 10295, 10296, 10297, 10298, 10299, 10300, 10301, 10302, 10303, 10304, 10305, 10306, 10307, 10308, 10309, 10310, 10311, 10312, 10313, 10314, 10315, 10316, 10317, 10318, 10319, 10320, 10321, 10397, 10404, 10405, 10407, 10408, 10409, 10410, 10411, 10413, 10414, 10415, 10416, 10417, 10418, 10420, 10444, 10449, 10450, 10452, 10454, 10455, 10456, 11443, 11444, 11445, 11446, 11447, 11448, 11449, 11450, 11451, 11452, 11453, 11454, 11455, 11456, 11457, 11458, 11463, 11464, 11465, 11466, 11467, 11469, 11470, 11471, 11472, 11473, 11474, 11475, 11476, 11477, 11478, 11479, 11480, 11481, 11482, 11483, 11484, 11485, 11486, 11487, 11488, 11489, 11490, 11491, 11492, 11493, 11510, 11511, 11512, 11513, 11514, 11515, 11539, 11658, 11659, 11660, 11661, 11666, 11671, 11672, 11673, 11680, 11684, 11702, 11703, 12172, 12312, 12313, 12314, 12601, 12742, 12805}
- --left: cavebear skull, draptor scales, giant crab pincer, maxilla, panther head, panther paw, coal (nuggets), demonic finger, eye of a deepling, flintstone, white deer skin
- local backpackstring = {'brown backpack', 'beach backpack', 'blue backpack', 'brocade backpack', 'camouflage backpack', 'crown backpack', 'demon backpack', 'dragon backpack', 'expedition backpack', 'fur backpack', 'golden backpack', 'green backpack', 'grey backpack', 'heart backpack', 'minotaur backpack', 'moon backpack', 'orange backpack', 'pirate backpack', 'purple backpack', 'red backpack', 'santa backpack', 'yellow backpack', 'backpack of holding', 'jewelled backpack'}
- local backpacks = {2854, 5949, 2869, 8860, 2872, 9605, 9601, 10326, 10324, 7342, 2871, 2865, 2870, 10202, 10327, 9604, 9602, 5926, 2868, 2867, 10346, 2866, 3253, 5801}
- function swap(a,b,c)
- local t
- if type(a) == 'table' then
- t = a[b]
- a[b]=a[c]
- a[c]=t
- else
- t=a
- a=b
- b=t
- end
- end
- function qs1(tablename, left, right)
- if type(tablename) == 'table' then
- left = left or 1
- right = right or #tablename
- local i,j,x
- if right-left+1 <= 25 then
- for i=left+1, right do
- x=tablename[i]
- j=i-1
- while j>=left and x<tablename[j] do
- tablename[j+1]=tablename[j]
- j=j-1
- end
- tablename[j+1]=x
- end
- else
- i,j,x = left, right, tablename[math.floor((left+right)/2)]
- local temp
- repeat
- while tablename[i]<x and i < right do
- i = i+1
- end
- while tablename[j]>x and j > left do
- j = j-1
- end
- if (i <= j) then
- temp = tablename[i]
- tablename[i] = tablename[j]
- tablename[j] = temp
- i = i+1
- j = j-1
- end
- until i > j
- if (left < j) then
- qs1(tablename, left, j)
- end
- if (right > i) then
- qs1(tablename, i, right)
- end
- end
- end
- end
- function qs2(tablename, left, right, argument)
- if type(tablename) == 'table' then
- left = left or 1
- right = right or #tablename
- local i,j,x
- if right-left+1 <= 25 then
- for i=left+1, right do
- x=tablename[i]
- j=i-1
- while j>=left and x[argument] < tablename[j][argument] do
- tablename[j+1]=tablename[j]
- j=j-1
- end
- tablename[j+1]=x
- end
- else
- i,j,x = left, right, tablename[math.floor((left+right)/2)][argument]
- local temp
- repeat
- while tablename[i][argument]<x and i < right do
- i = i+1
- end
- while tablename[j][argument]>x and j > left do
- j = j-1
- end
- if (i <= j) then
- temp = tablename[i]
- tablename[i] = tablename[j]
- tablename[j] = temp
- i = i+1
- j = j-1
- end
- until i > j
- if (left < j) then
- qs2(tablename, left, j, argument)
- end
- if (right > i) then
- qs2(tablename, i, right, argument)
- end
- end
- end
- end
- function qs3(tablename, left, right)
- if type(tablename) == 'table' then
- left = left or 1
- right = right or #tablename
- local i,j,x
- if right-left+1 <= 25 then
- for i=left+1, right do
- x=tablename[i]
- j=i-1
- while j>=left and x>tablename[j] do
- tablename[j+1]=tablename[j]
- j=j-1
- end
- tablename[j+1]=x
- end
- else
- i,j,x = left, right, tablename[math.floor((left+right)/2)]
- local temp
- repeat
- while tablename[i]>x and i < right do
- i = i+1
- end
- while tablename[j]<x and j > left do
- j = j-1
- end
- if (i <= j) then
- temp = tablename[i]
- tablename[i] = tablename[j]
- tablename[j] = temp
- i = i+1
- j = j-1
- end
- until i > j
- if (left < j) then
- qs3(tablename, left, j)
- end
- if (right > i) then
- qs3(tablename, i, right)
- end
- end
- end
- end
- function qs4(tablename, left, right, argument)
- if type(tablename) == 'table' then
- left = left or 1
- right = right or #tablename
- local i,j,x
- if right-left+1 <= 25 then
- for i=left+1, right do
- x=tablename[i]
- j=i-1
- while j>=left and x[argument]>tablename[j][argument] do
- tablename[j+1]=tablename[j]
- j=j-1
- end
- tablename[j+1]=x
- end
- else
- i,j,x = left, right, tablename[math.floor((left+right)/2)][argument]
- local temp
- repeat
- while tablename[i][argument]>x and i < right do
- i = i+1
- end
- while tablename[j][argument]<x and j > left do
- j = j-1
- end
- if (i <= j) then
- temp = tablename[i]
- tablename[i] = tablename[j]
- tablename[j] = temp
- i = i+1
- j = j-1
- end
- until i > j
- if (left < j) then
- qs4(tablename, left, j, argument)
- end
- if (right > i) then
- qs4(tablename, i, right, argument)
- end
- end
- end
- end
- function bin1(tablename,value)
- if type(tablename) == 'table' then
- local left,right = 1, #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid] == value then
- return mid
- end
- if tablename[mid] > value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return
- end
- function bin2(tablename,value,argument)
- if type(tablename) == 'table' then
- local left,right = 1, #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid][argument] == value then
- return mid
- end
- if tablename[mid][argument] > value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return
- end
- function seq1(tablename,value)
- if type(tablename) == 'table' then
- for i,j in ipairs(tablename) do
- if j == value then
- return i
- end
- end
- end
- return
- end
- function seq2(tablename,value,argument)
- if type(tablename) == 'table' then
- for i,j in ipairs(tablename) do
- if j[argument] == value then
- return i
- end
- end
- end
- return
- end
- function table:newsort(argument, order) --Working
- if argument == 'asc' or argument == 'desc' then
- order = argument
- argument = false
- end
- order = order or 'asc'
- if order == 'asc' then
- if argument then
- qs2(self,1,#self,argument)
- else
- qs1(self,1,#self)
- end
- else
- if argument then
- qs4(self,1,#self,argument)
- else
- qs3(self,1,#self)
- end
- end
- end
- function table:find(value,argument) --Working
- if argument then
- return seq2(self,value,argument)
- end
- return seq1(self,value)
- end
- function table:findcreature(m,arg)
- if type(m) == 'userdata' then
- local name = m.name:lower()
- if not arg then
- for i,j in ipairs(self) do
- if name == j or m.id == j or m == j then
- return i
- end
- end
- else
- for i,j in ipairs(self) do
- if name == j[arg] or m.id == j[arg] or m == j[arg] then
- return i
- end
- end
- end
- end
- end
- function table:binaryfind(value,argument) --Working
- if argument then
- return bin2(self,value,argument)
- end
- return bin1(self,value)
- end
- function usedoor(x,y,z,a)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- if not (x and y and z and tilereachable(x,y,z)) then
- return false
- end
- reachlocation(x,y,z)
- local doorid, tileinfo = 0
- local topid = topitem(x,y,z).id
- local pos
- if not a then
- pos = table.binaryfind(closeddoorsids,topid)
- if pos then
- a = 'open'
- doorid = closeddoorsids[pos]
- else
- pos = table.binaryfind(openeddoorsids,topid)
- if pos then
- a = 'close'
- doorid = openeddoorsids[pos]
- else
- return false
- end
- end
- else
- if a == 'open' then
- pos = table.binaryfind(closeddoorsids,topid)
- if not pos then return false end
- doorid = closeddoorsids[pos]
- elseif a == 'close' then
- pos = table.binaryfind(openeddoorsids,topid)
- if not pos then return false end
- doorid = openeddoorsids[pos]
- end
- end
- if a == 'open' then
- while true do
- useitem(topid,ground(x,y,z)) waitping()
- topid = topitem(x,y,z).id
- if not (topid == 2179 or topid == 2177 or topid == doorid) then
- return true
- end
- end
- elseif a == 'close' then
- local doorpos
- tileinfo = gettile(x,y,z)
- for i=1, tileinfo.itemcount do
- if tileinfo.item[i].id == doorid then
- doorpos = i
- break
- end
- end
- while true do
- for i=tileinfo.itemcount,1,-1 do
- local infoid = tileinfo.item[i].id
- if infoid ~= 99 and not itemproperty(infoid, ITEM_NOTMOVEABLE) then
- printerror('There is an item above this door, Neobot is unable to move items above a door.')
- return false
- --elseif infoid == 99 then
- -- printerror('There is a player above this door, Neobot is unable to move players above a door.')
- -- return false
- end
- end
- useitem(topid,ground(x,y,z)) waitping()
- tileinfo = gettile(x,y,z)
- topid = tileinfo.item[doorpos].id
- if topid ~= doorid then
- return true
- end
- end
- end
- end
- function findweapon()
- for i,j in ipairs(axes) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(swords) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(clubs) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(distone) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(wands) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(rods) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(bows) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- if (0 == $rhand.id) then
- return 'rhand', $rhand
- end
- if (0 == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- function findweapontouse()
- local where,id = nil,0
- if id == 0 then
- for i,j in ipairs(axes) do if itemcount(j) > 0 then id = j end end
- end
- if id == 0 then
- for i,j in ipairs(swords) do if itemcount(j) > 0 then id = j end end
- end
- if id == 0 then
- for i,j in ipairs(clubs) do if itemcount(j) > 0 then id = j end end
- end
- if clientitemhotkey(id) == 'not found' then
- if $rhand.id == id then
- where = 'rhand'
- elseif $lhand.id == id then
- where = 'lhand'
- else
- where = ''
- end
- end
- return where, id
- end
- function findweapontype()
- for i,j in ipairs(axes) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'axe' end
- end
- for i,j in ipairs(swords) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'sword' end
- end
- for i,j in ipairs(clubs) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'club' end
- end
- for i,j in ipairs(wands) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'wand' end
- end
- for i,j in ipairs(rods) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'rod' end
- end
- for i,j in ipairs(bows) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'bow' end
- end
- for i,j in ipairs(distone) do
- if (j == $rhand.id) or (j == $lhand.id) then return 'distance weapon' end
- end
- return 'no weapon'
- end
- function findshield()
- local hand = ''
- for i,j in ipairs(spellbooks) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- for i,j in ipairs(shields) do
- if (j == $rhand.id) then
- return 'rhand', $rhand
- end
- if (j == $lhand.id) then
- return 'lhand', $lhand
- end
- end
- if $rhand.id == 0 then
- return 'rhand', $rhand
- end
- if $lhand.id == 0 then
- return 'lhand', $lhand
- end
- end
- function getbestspell(name, type)
- if type == 'strong strike' then
- return beststrongstrike(name)
- else
- return beststrike(name)
- end
- end
- function bestruneelement(creaturename, disconsiderdamage) --credits to Hardek.
- if creaturename == '' then return nil end
- local cre = creatureinfo(creaturename)
- voc = voc or vocation()
- strongonly = strongonly or false
- local best = ''
- local max = 0
- local elements = {ice = ($level*0.2)+($mlevel*2.4)+14, fire = ($level*0.2)+($mlevel*2.4)+14, earth = ($level*0.2)+($mlevel*1.2)+7, energy = ($level*0.2)+($mlevel*1.2)+7}
- if disconsiderdamage then
- elements = {ice = 0, fire = 0, earth = 0, energy = 0}
- end
- for i,j in pairs(elements) do
- if cre[i..'mod']*j >= max then
- max = cre[i..'mod']*j
- best = i
- end
- end
- return best
- end
- function caststrike(a,b)
- if $attacked.id > 0 then
- local belement
- if $attacked.isplayer then
- belement = 'fire'
- else
- belement = bestelement($attacked.name, false)
- end
- a,b = a or 900, b or 1100
- if belement then
- local bspell = 'exori '..getelementword(belement)
- if cooleddown(bspell) and $mp >= 20 and $attacked.hppc > 0 and $attacked.dist <= 3 and $attacked.isshootable then
- cast(bspell)
- wait(a,b)
- return true
- end
- end
- end
- return false
- end
- function caststrongstrike(a,b,c)
- if $attacked.id > 0 then
- a,b,c = a or 900, b or 1100, c or 75
- local voc = vocation()
- local spell
- if voc == 'druid' then
- if $attacked.ismonster then
- local temp = creatureinfo($attacked.name)
- if cooleddown('strong ice strike') and (temp.icemod >= temp.earthmod or not cooleddown('strong terra strike')) and (temp.icemod >= c) then
- spell = 'exori gran frigo'
- elseif cooleddown('strong terra strike') and (temp.earthmod >= temp.icemod or not cooleddown('strong ice strike')) and (temp.earthmod >= c) then
- spell = 'exori gran tera'
- end
- else
- if cooleddown('strong ice strike') then
- spell = 'exori gran frigo'
- elseif cooleddown('strong terra strike') then
- spell = 'exori gran tera'
- end
- end
- elseif voc == 'sorcerer' then
- if $attacked.ismonster then
- local temp = creatureinfo($attacked.name)
- if cooleddown('strong energy strike') and (temp.energymod >= temp.firemod or not cooleddown('strong flame strike')) and (temp.energymod >= c) then
- spell = 'exori gran vis'
- elseif cooleddown('strong flame strike') and (temp.firemod >= temp.energymod or not cooleddown('strong energy strike')) and (temp.firemod >= c) then
- spell = 'exori gran flam'
- end
- else
- if cooleddown('strong energy strike') then
- spell = 'exori gran vis'
- elseif cooleddown('strong flame strike') then
- spell = 'exori gran flam'
- end
- end
- end
- if spell and cooleddown(spell) and $mp >= 60 and $attacked.hppc > 0 and $attacked.dist <= 3 and $attacked.isshootable then
- cast(spell)
- wait(a,b)
- return true
- end
- end
- return false
- end
- --[[function caststrongstrike(a,b,c)
- if $attacked.name ~= '' then
- local belement, belementmod
- if $attacked.isplayer then
- local voc = vocation()
- if voc == 'druid' then
- if cooleddown('strong ice strike') then
- belement, belementmod = 'ice', 1000
- elseif cooleddown('strong terra strike') then
- belement, belementmod = 'earth', 1000
- end
- elseif voc == 'sorcerer' then
- if cooleddown('strong flame strike') then
- belement, belementmod = 'fire', 1000
- elseif cooleddown('strong energy strike') then
- belement, belementmod = 'energy', 1000
- end
- end
- else
- belement, belementmod = bestelement($attacked.name, true)
- end
- a,b = a or 900, b or 1100
- if belement and (not c or belementmod >= c) then
- local bspell = 'exori gran '..getelementword(belement)
- if cooleddown(bspell) and $mp >= 60 and $attacked.hppc > 0 and $attacked.dist <= 3 and $attacked.isshootable then
- cast(bspell)
- wait(a,b)
- return true
- end
- end
- end
- return false
- end--]]
- function shootbestrune(a,b,cre,disconsider)
- local runes = {energy = 3174, earth = 3179, fire = 3189, ice = 3158}
- if type(cre) == 'boolean' then
- disconsider = cre
- cre = nil
- end
- cre = cre or $attacked
- a,b = a or 900, b or 1100
- if cre.id ~= 0 then
- useoncreature(runes[bestruneelement(cre.name,disconsider)],cre)
- wait(a,b)
- return true
- end
- return false
- end
- function findcreature(...)
- local tofind,found = {...},{}
- table.lower(tofind)
- local i=1
- while i <= #tofind do
- local j = tofind[i]
- if type(j) == 'userdata' and j.name and j.name ~= '' then
- table.insert(found,j)
- table.remove(tofind,i)
- else
- i = i+1
- end
- end
- if #tofind > 0 then
- foreach creature p do
- if table.find(tofind,p.name:lower()) or table.find(tofind,p.id) then
- table.insert(found,p)
- end
- end
- end
- return table.unpack(found)
- end
- function findcreaturesonspellrange(spelltype,direction,iteratetype)
- if not iteratetype then
- iteratetype = 'f'
- end
- local found = {}
- foreach creature p iteratetype do
- if isonspellarea(p,spelltype,direction) then
- table.insert(found,p)
- end
- end
- return table.unpack(found)
- end
- function findplayersonspellrange(spelltype,direction)
- findcreaturesonspellrange(spelltype,direction,'pf')
- end
- function findmonstersonspellrange(spelltype,direction)
- findcreaturesonspellrange(spelltype,direction,'mf')
- end
- function findcreatureontile(x,y,z)
- if x == nil or y == nil or z == nil or math.abs($posx-x) > 8 or math.abs($posy-y) > 6 or math.abs($posz-z) > 0 then
- return
- end
- foreach creature fcre 'f' do
- if fcre.posx == x and fcre.posy == y and fcre.posz == z then
- return fcre
- end
- end
- return
- end
- function iscreatureontile(x,y,z,ctype)
- local creatureontileinfo = gettile(x,y,z)
- if creatureontileinfo then
- for i=2, creatureontileinfo.itemcount do
- if creatureontileinfo.item[i].id == 99 and ((not ctype or ctype == 'any') or (ctype == 'player' and creatureontileinfo.item[i].count <= 0x40000000) or (ctype == 'monster' and creatureontileinfo.item[i].count > 0x40000000)) then
- return true
- end
- end
- end
- return false
- end
- function iscreatureshootable(n)
- if type(n) ~= 'userdata' then
- n = findcreature(n)
- end
- if n ~= nil then
- if tileshootable(n.posx,n.posy,n.posz) then
- return true
- else
- return false
- end
- end
- end
- function iscreaturereachable(n)
- if type(n) ~= 'userdata' then
- n = findcreature(n)
- end
- if n ~= nil then
- if tilereachable(n.posx,n.posy,n.posz) then
- return true
- else
- return false
- end
- end
- end
- function refillammo()
- local ammo = {761, 762, 763, 774, 1781, 2992, 3277, 3287, 3298, 3347, 3446, 3447, 3448, 3449, 3450, 6528, 7363, 7364, 7365, 7366, 7367, 7368, 7378}
- local i = 1
- while ammo[i] do
- if $rhand.id == ammo[i] and $rhand.count < 100 then
- equipitem(ammo[i],"rhand",'0-15',100)
- waitping()
- return
- elseif $lhand.id == ammo[i] and $lhand.count < 100 then
- equipitem(ammo[i],"lhand",'0-15',100)
- waitping()
- return
- elseif $belt.id == ammo[i] and $belt.count < 100 then
- equipitem(ammo[i],"belt",'0-15',100)
- waitping()
- return
- end
- i = i+1
- end
- end
- function color(r,g,b,transparency)
- if type(r) ~= 'string' then
- transparency = transparency or 0
- return (math.floor(transparency*2.55)*16777216) + (r*65536) + (g*256) + b
- else
- r = r:gsub(' ','_')
- r = r:gsub('-','_')
- g = g or 0
- local colors = {amaranth = 0xE52B50, amber = 0xFFBF00, aquamarine = 0x7FFFD4, azure = 0x007FFF, baby_blue = 0x89CFF0, beige = 0xF5F5DC, black = 0x000000, blue = 0x0000FF, blue_green = 0x0095B6, blue_violet = 0x8A2BE2, bronze = 0xCD7F32, brown = 0xA52A2A, byzantium = 0x702963, barmine = 0x960018, cerise = 0xDE3163, cerulean = 0x007BA7, champagne = 0xF7E7CE, chartreuse_green = 0x7FFF00, copper = 0xB87333, coral = 0xF88379, crimson = 0xDC143C, cyan = 0x00FFFF, electric_blue = 0x7DF9FF, erin = 0x00FF3F, gold = 0xFFD700, gray = 0x808080, green = 0x00CC00, harlequin = 0x3FFF00, indigo = 0x4B0082, ivory = 0xFFFFF0, jade = 0x00A86B, lavender = 0xB57EDC, lilac = 0xC8A2C8, lime = 0xBFFF00, magenta = 0xFF00FF, magenta_rose = 0xFF00AF, maroon = 0x800000, mauve = 0xE0B0FF, navy_blue = 0x000080, olive = 0x808000, orange = 0xFFA500, orange_red = 0xFF4500, op = 0x6FFFFFF, peach = 0xFFE5B4, persian_blue = 0x1C39BB, pink = 0xFFC0CB, plum = 0x8E4585, prussian_blue = 0x003153, pen = 0x5410987, pumpkin = 0xFF7518, purple = 0x800080, raspberry = 0xE30B5C, red = 0xFF0000, red_violet = 0xC71585, rose = 0xFF007F, salmon = 0xFA8072, scarlet = 0xFF2400, silver = 0xC0C0C0, slate_gray = 0x708090, spring_green = 0x00FF7F, taupe = 0x483C32, teal = 0x008080, turquoise = 0x40E0D0, violet = 0xEE82EE, viridian = 0x40826D, white = 0xFFFFFF, yellow = 0xFFFF00}
- if colors[r] then
- return colors[r] + (math.floor(2.55*g)*16777216)
- else
- return colors.white + (math.floor(2.55*g)*16777216)
- end
- end
- end
- function moveitemsupto(itemname, amount, to, from)
- itemname = itemid(itemname)
- if not to or (type(to) ~= 'number' and type(to) ~= 'string') then
- to = 'backpack'
- end
- if not from or (type(from) ~= 'number' and type(from) ~= 'string') then
- from = ''
- end
- if (type(to) == 'string' and to:find('ground')) or (type(from) == 'string' and from:find('ground')) then
- return false
- end
- while itemcount(itemname, to) < amount and itemcount(itemname, from) > 0 do
- moveitems(itemname, to, from, amount-itemcount(itemname,to))
- waitping()
- end
- end
- function moveitemsdownto(itemname, amount, from, to)
- itemname = itemid(itemname)
- if not to or (type(to) ~= 'number' and type(to) ~= 'string') then
- to = ''
- end
- if not from or (type(from) ~= 'number' and type(from) ~= 'string') then
- from = 'backpack'
- end
- while itemcount(itemname, from) > amount do
- moveitems(itemname, to, from, amount-itemcount(itemname,from))
- waitping()
- end
- end
- function buyitemsupto(itemname, amount, currentamount)
- currentamount = currentamount or itemcount(itemname)
- if not $tradeopen then opentrade() end
- amount = amount-currentamount
- --[[if tradecount('buy',itemname) == 0 then itemname = itemid(itemname) end--]]
- while amount > 0 --[[and (tradecount('buy',itemname) >= amount or tradecount('buy',itemname) == 100)--]] do
- buyitems(itemname, amount)
- waitping(3,4)
- amount = amount-100
- end
- end
- function sellitemsdownto(itemname, amount, currentamount)
- currentamount = currentamount or itemcount(itemname)
- if not $tradeopen then opentrade() end
- currentamount = currentamount-amount
- --[[if tradecount('sell',itemname) == 0 then itemname = itemid(itemname) end--]]
- while currentamount > 0 --[[and (tradecount('sell',itemname) >= currentamount or tradecount('sell',itemname) == 100)--]] do
- sellitems(itemname, currentamount)
- waitping(3,4)
- currentamount = currentamount-100
- end
- end
- function buyitemstocap(itemname, captosave)
- local amount = math.floor(($cap-captosave)/itemweight(itemname))
- opentrade()
- while amount > 0 do
- buyitems(itemname,amount)
- waitping(3,4)
- amount = amount-100
- end
- end
- function sellflasks()
- if not $tradeopen then opentrade() end
- for i=283,285 do
- local count = tradecount('sell',i)
- while count > 0 do
- sellitems(i,count) waitping()
- count = tradecount('sell',i)
- end
- end
- end
- function levitate(direction,updown)
- local dir = {x = {n = 0, s = 0, w = -1, e = 1},
- y = {n = -1, s = 1, w = 0, e = 0}}
- if direction == 'w' or direction == 'e' or direction == 'n' or direction == 's' then
- local startposz,tries,maxtries = $posz,0,math.random(4,6)
- if not updown or (updown ~= 'up' and updown ~= 'down') then
- local tile = gettile($posx+dir.x[direction],$posy+dir.y[direction],$posz)
- updown = 'up'
- if tile.itemcount == 0 or (tile.itemcount == 1 and not itemproperty(tile.item[1].id,ITEM_NOTROOFEDGE)) then
- updown = 'down'
- end
- end
- while $mp >= 50 and $level >= 12 and $posz == startposz and tries < maxtries and cooleddown('levitate') do
- while (direction ~= $self.dir) do turn(direction) waitping(1.2,1.4) end
- cast('exani hur '..updown)
- waitping()
- tries=tries+1
- end
- if $posz ~= startz then
- return true
- end
- end
- return false
- end
- --351~355
- function pick(x,y,z,holes)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- holes = holes or {394}
- local pickid = 3456
- local k = ''
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local tile = gettile(x,y,z)
- local id = topitem(x,y,z).id
- if tile.item[1].id >= 351 and tile.item[1].id <= 355 then
- for i=2, tile.itemcount do
- if itemproperty(tile.item[i].id, ITEM_NOTMOVEABLE) then
- return false
- end
- end
- while id ~= 394 do
- while id > 355 or id < 351 do
- if not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3) id = topitem(x,y,z).id
- else
- return false
- end
- end
- while id ~= 394 and itemproperty(id, ITEM_GROUND) do
- if iscreatureontile(x,y,z) then
- local dir, dirx, diry = wheretomoveitem(x,y,z,99)
- moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
- elseif clientitemhotkey(pickid,'crosshair') == 'not found' and itemcount(pickid) == 0 then
- printerror('Pick not found.')
- return false
- end
- useitemon(pickid,id,ground(x,y,z),k) wait(900,1100)
- id = topitem(x,y,z).id
- end
- end
- wait(100)
- id = topitem(x,y,z).id
- end
- end
- return false
- end
- function openhole(x,y,z,holes)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- holes = holes or {{593,594}, {606, 607}, {608, 609}, {867, 868}}
- local shovelid = false
- for i,j in ipairs(shovels) do
- if itemcount(j) > 0 then
- shovelid = j
- break
- end
- end
- if not shovelid then
- for i,j in ipairs(shovels) do
- if clientitemhotkey(j) ~= 'not found' then
- shovelid = j
- break
- end
- end
- end
- local k = ''
- if not shovelid then return false end
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #holes and not isitemontile(holes[v][1],x,y,z) do
- v = v+1
- end
- if v <= #holes then
- local id = topitem(x,y,z).id
- while id ~= holes[v][2] do
- if id == holes[v][1] then
- if iscreatureontile(x,y,z) then
- local dir, dirx, diry = wheretomoveitem(x,y,z,99)
- moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
- elseif clientitemhotkey(shovelid,'crosshair') == 'not found' and itemcount(shovelid) == 0 then
- printerror(shoveltype.. ' not found.')
- return false
- end
- useitemon(shovelid,id,ground(x,y,z),k) wait(900,1100)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function opensand(x,y,z)
- return openhole(x,y,z, {{231,615}})
- end
- function usesewer(x,y,z,sewers)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- sewers = sewers or {435}
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #sewers and not isitemontile(sewers[v],x,y,z) do
- v = v+1
- end
- if v <= #sewers then
- local id = topitem(x,y,z).id
- while $posz == z do
- if id == sewers[v] then
- useitem(sewers[v],ground(x,y,z)) wait(300,500)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function uselever(x,y,z,id)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- local levers = {2771, 2772}
- if id then
- levers = {id}
- end
- reachlocation(x,y,z)
- local cur = {$posx,$posy,$posz}
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #levers and not isitemontile(levers[v],x,y,z) do
- v = v+1
- end
- if v <= #levers then
- local id = topitem(x,y,z).id
- while isitemontile(levers[v],x,y,z) and (cur[1] == $posx and cur[2] == $posy and cur[3] == $posz) do
- if id == levers[v] then
- useitem(levers[v],ground(x,y,z)) wait(300,500)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function breakdworcwall(x,y,z, walls)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- walls = walls or {{2295, 3146}, {2296, 3145}}
- local sneakies = {9594, 9596, 9598}
- local weaponlocation,weaponid = findweapontouse()
- if clientitemhotkey(weaponid,'crosshair') ~= 'not found' then
- weaponlocation = ''
- end
- if weaponid == 0 then
- return false
- end
- print(weaponid)
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #walls and not isitemontile(walls[v][1],x,y,z) do
- v = v+1
- end
- if v <= #walls then
- local id = topitem(x,y,z).id
- while id ~= walls[v][2] do
- if id == walls[v][1] then
- if iscreatureontile(x,y,z) then
- local dir, dirx, diry = wheretomoveitem(x,y,z,99)
- moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
- elseif clientitemhotkey(weaponid,'crosshair') == 'not found' and itemcount(weaponid) == 0 then
- printerror('Weapon not found.')
- return false
- end
- useitemon(weaponid,id,ground(x,y,z),weaponlocation) wait(900,1100)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function breakspidersilk(x,y,z, walls)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- walls = walls or {{182, 188}, {183, 189}}
- local weaponid,weaponlocation = 5467
- if itemcount(5467) > 0 then
- if clientitemhotkey(weaponid,'crosshair') == 'not found' then
- if $rhand.id == weaponid then
- weaponlocation = 'rhand'
- elseif $lhand.id == weaponid then
- weaponlocation = 'lhand'
- else
- weaponlocation = ''
- end
- end
- else
- weaponlocation,weaponid = findweapontouse()
- if clientitemhotkey(weaponid,'crosshair') ~= 'not found' then
- weaponlocation = ''
- end
- end
- if weaponid == 0 then
- return false
- end
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #walls and not isitemontile(walls[v][1],x,y,z) do
- v = v+1
- end
- if v <= #walls then
- local id = topitem(x,y,z).id
- while id ~= walls[v][2] do
- if id == walls[v][1] then
- if iscreatureontile(x,y,z) then
- local dir, dirx, diry = wheretomoveitem(x,y,z,99)
- moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
- elseif clientitemhotkey(weaponid,'crosshair') == 'not found' and itemcount(weaponid) == 0 then
- printerror('Weapon not found.')
- return false
- end
- useitemon(weaponid,id,ground(x,y,z),weaponlocation) wait(900,1100)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function cutgrass(x,y,z)
- x,y,z = x or $wptx, y or $wpty, z or $wptz
- local grasses = {{3702, 3701},{3696, 3695}}
- local weaponid,weaponlocation = false
- for i,j in ipairs(machetes) do
- if itemcount(j) > 0 then
- weaponid = j
- break
- end
- end
- if not macheteid then
- for i,j in ipairs(machetes) do
- if clientitemhotkey(j) ~= 'not found' then
- weaponid = j
- break
- end
- end
- end
- if not weaponlocation then
- if $rhand.id == weaponid then
- weaponlocation = 'rhand'
- elseif $lhand.id == weaponid then
- weaponlocation = 'lhand'
- else
- weaponlocation = ''
- end
- end
- if not weaponid then
- return false
- end
- reachlocation(x,y,z)
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z and ($posx ~= x or $posy ~= y) then
- local v = 1
- while v <= #grasses and not isitemontile(grasses[v][1],x,y,z) do
- v = v+1
- end
- if v <= #grasses then
- local id = topitem(x,y,z).id
- while id ~= grasses[v][2] do
- if id == grasses[v][1] then
- if iscreatureontile(x,y,z) then
- local dir, dirx, diry = wheretomoveitem(x,y,z,99)
- moveitems(99,ground(x+dirx,y+diry,z),ground(x,y,z),100) wait(1400,1600)
- elseif clientitemhotkey(weaponid,'crosshair') == 'not found' and itemcount(weaponid) == 0 then
- printerror('Machete not found.')
- return false
- end
- useitemon(weaponid,id,ground(x,y,z),weaponlocation) wait(900,1100)
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100) waitping(1,1.3)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- function pickupitems(dir,n,amount)
- local dire = {dirs = {'c', 'n', 's', 'w', 'e', 'nw', 'ne', 'sw', 'se'},
- x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
- y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
- if not dir or not table.find(dire.dirs,dir) then
- if type(n) == 'number' then
- amount = n
- end
- if not n then
- n = dir
- end
- dir = 'c'
- end
- if not n then
- n = ''
- end
- if not amount then
- amount = 100
- end
- local pos = {x = $posx+dire.x[dir], y = $posy+dire.y[dir], z = $posz}
- local topid = topitem(pos.x,pos.y,pos.z).id
- if topid ~= 0 and itemproperty(topid,ITEM_PICKUPABLE) then
- moveitems(topid,n,ground(pos.x,pos.y,pos.z),amount)
- end
- end
- --local ropeholesids = {386, 421, 7762, 12202}
- local stairsids = {386, 421, 1948, 1968, 5542, 7762, 7771, 9116, 12202}
- local bodies = {stakeable = {{4097, 5995, 'demon'}, {4137, 6006, 'vampire'}}, skinnable = {{4173, 6017, 'rabbit'}, {4011, 5969, 'minotaur'}, {4025, 5973, 'dragon'}, {4047, 5981, 'minotaur mage'}, {4052, 5982, 'minotaur archer'}, {4057, 5983, 'minotaur guard'}, {4062, 5984, 'dragon lord'}, {4112, 5999, 'behemoth'}, {4212, 6030, 'bonebeast'}, {4321, 4239, 'lizard templar'}, {4324, 6040, 'lizard sentinel'}, {4327, 6041, 'lizard snakecharmer'}, {10352, 10355, 'lizard high guard'}, {10356, 10359, 'lizard legionnaire'}, {10360, 10363, 'lizard dragon priest'}, {10364, 10367, 'lizard zaogun'}, {10368, 10371, 'lizard chosen'}}}
- BODYLIST = {}
- function BODYLIST:new(n)
- n = n or {}
- setmetatable(n, self)
- self.__index = self
- return n
- end
- function itemproperties(iid, ...)
- iid = itemid(iid)
- local properties = {...}
- for i,j in ipairs(properties) do
- if not itemproperty(iid, j) then
- return false
- end
- end
- return true
- end
- function BODYLIST:clear(n)
- self = {}
- end
- function BODYLIST:remove(...)
- local args = {...}
- for i,j in ipairs(args) do
- local temp = table.find(self, j, 3)
- if temp then
- table.remove(self, temp)
- end
- end
- end
- function BODYLIST:addid(...)
- local args = {...}
- for i,j in ipairs(args) do
- table.insert(self, {j[1], j[2], j[3]})
- end
- end
- function BODYLIST:__tostring()
- toprint = ''
- for i,j in ipairs(self) do
- toprint = toprint..j[3]..', '
- end
- return toprint:sub(1,#toprint-2)
- end
- function resetbodylists()
- SKINLIST, STAKELIST = nil, nil
- SKINLIST = BODYLIST:new({{4011, 5969, 'minotaur'}, {4025, 5973, 'dragon'}, {4047, 5981, 'minotaur mage'}, {4052, 5982, 'minotaur archer'}, {4057, 5983, 'minotaur guard'}, {4062, 5984, 'dragon lord'}, {4112, 5999, 'behemoth'}, {4212, 6030, 'bonebeast'}, {4321, 4239, 'lizard templar'}, {4324, 6040, 'lizard sentinel'}, {4327, 6041, 'lizard snakecharmer'}, {10352, 10355, 'lizard high guard'}, {10356, 10359, 'lizard legionnaire'}, {10360, 10363, 'lizard dragon priest'}, {10364, 10367, 'lizard zaogun'}, {10368, 10371, 'lizard chosen'}})
- STAKELIST = BODYLIST:new(bodies.stakeable)
- end
- SKINLIST = BODYLIST:new({{4011, 5969, 'minotaur'}, {4025, 5973, 'dragon'}, {4047, 5981, 'minotaur mage'}, {4052, 5982, 'minotaur archer'}, {4057, 5983, 'minotaur guard'}, {4062, 5984, 'dragon lord'}, {4112, 5999, 'behemoth'}, {4212, 6030, 'bonebeast'}, {4321, 4239, 'lizard templar'}, {4324, 6040, 'lizard sentinel'}, {4327, 6041, 'lizard snakecharmer'}, {10352, 10355, 'lizard high guard'}, {10356, 10359, 'lizard legionnaire'}, {10360, 10363, 'lizard dragon priest'}, {10364, 10367, 'lizard zaogun'}, {10368, 10371, 'lizard chosen'}})
- STAKELIST = BODYLIST:new(bodies.stakeable)
- function STAKELIST:add(...)
- local args = {...}
- for i,j in ipairs(args) do
- local temp = table.find(bodies.stakeable, j, 3)
- if temp and not table.find(self, j, 3) then
- table.insert(self, bodies.stakeable[temp])
- end
- end
- end
- function SKINLIST:add(...)
- local args = {...}
- for i,j in ipairs(args) do
- local temp = table.find(bodies.skinnable, j, 3)
- if temp and not table.find(self, j, 3) then
- table.insert(self, {table.unpack(bodies.skinnable[temp])})
- end
- end
- end
- function skinspotssample(dist, movebody, waitfresh, bodytable)
- movebody = movebody or false
- waitfresh = waitfresh or false
- if not dist or dist > 7 or dist < 1 then
- dist = 7
- end
- local counter = 0
- for j=-dist, dist do
- for i=-dist, dist do
- local pos = {x = $posx+i, y = $posy+j, z = $posz}
- if tilehasinfo(pos.x,pos.y,pos.z) and tilereachable(pos.x,pos.y,pos.z) then
- local tile, topid, gonextsqm = gettile(pos.x,pos.y,pos.z), topitem(pos.x,pos.y,pos.z).id, false
- local tablepos, notmoveablepos = table.find(bodytable, topid, 1)
- if waitfresh then
- tablepos = tablepos or table.find(bodytable, topid, 2)
- end
- for k=1, tile.itemcount do
- topid = tile.item[k].id
- if topid == 99 or table.find(stairsids, topid) then
- gonextsqm = true
- break
- end
- if itemproperty(topid, ITEM_NOTMOVEABLE) and not itemproperty(topid, ITEM_GROUND) then
- notmoveablepos = k
- end
- if movebody then
- for p,q in ipairs(bodytable) do
- if (q[1] == topid or (waitfresh and q[2] == topid)) and (not notmoveablepos or k < notmoveablepos) then
- counter = counter+1
- end
- end
- end
- end
- if not gonextsqm and not movebody and tablepos then
- counter = counter+1
- end
- end
- end
- end
- return counter
- end
- function skinspots(dist, movebody, waitfresh, bodytable)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinspotssample(dist, movebody, waitfresh, SKINLIST)
- end
- function stakespots(dist, movebody, waitfresh, bodytable)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinspotssample(dist, movebody, waitfresh, STAKELIST)
- end
- function skinkitchenknifespots(dist, movebody, waitfresh, bodytable)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinspotssample(dist, movebody, waitfresh, {{4173, 6017, 'rabbit'}})
- end
- function skinsample(dist,movebody,waitfresh,touseid,bodytable)
- movebody = movebody or false
- waitfresh = waitfresh or false
- if not dist or dist < 1 or dist > 7 then
- dist = 7
- end
- touseid = itemid(touseid)
- local itempos = ''
- if clientitemhotkey(touseid,'crosshair') == 'not found' then
- if itemcount(touseid) == 0 then
- return false
- end
- end
- local pos = {x=nil,y=nil,z=$posz,body=nil,fresh=nil}
- local cur = {x=nil,y=nil,z=$posz,id=nil}
- local t = {}
- local i,j
- for a=1,dist do
- j = -a
- while j <= a do
- i = -a
- while i <= a do
- cur.x,cur.y = $posx+i,$posy+j
- if tilehasinfo(cur.x,cur.y,cur.z) and tilereachable(cur.x,cur.y,cur.z) then
- local gonextsqm, tile, tempid = false, gettile(cur.x,cur.y,cur.z), topitem(cur.x,cur.y,cur.z).id
- local tablepos, notmoveablepos = table.find(bodytable, tempid, 1)
- if waitfresh then
- tablepos = tablepos or table.find(bodytable, tempid, 2)
- end
- for k=1, tile.itemcount do
- tempid = tile.item[k].id
- if tempid == 99 or table.find(stairsids, tempid) then
- gonextsqm = true
- break
- end
- if itemproperty(tempid, ITEM_NOTMOVEABLE) and not itemproperty(tempid, ITEM_GROUND) then
- notmoveablepos = k
- end
- if movebody and not tablepos then
- for p,q in ipairs(bodytable) do
- if (q[1] == tempid or (waitfresh and q[2] == tempid)) and (not notmoveablepos or k < notmoveablepos) then
- tablepos = p
- end
- end
- end
- end
- if not gonextsqm and tablepos then
- pos.x,pos.y,pos.body,pos.fresh = cur.x,cur.y,bodytable[tablepos][1],bodytable[tablepos][2]
- end
- end
- if pos.x then break end
- if j ~= a and j ~= -a then
- i = i+a*2
- else
- i = i+1
- end
- end
- if pos.x then break end
- j = j+1
- end
- if pos.x then break end
- end
- if pos.x then
- pausewalking(20000)
- reachlocation(pos.x,pos.y,pos.z)
- local topid = topitem(pos.x,pos.y,pos.z).id
- while topid ~= pos.fresh and topid ~= pos.body and not iscreatureontile(pos.x, pos.y, pos.z) and not itemproperty(topid, ITEM_NOTMOVEABLE) do
- local dir, dirx, diry = wheretomoveitem(pos.x,pos.y,pos.z,topid)
- moveitems(topid, ground(pos.x+dirx,pos.y+diry,pos.z), ground(pos.x,pos.y,pos.z), 100) waitping()
- topid = topitem(pos.x,pos.y,pos.z).id
- end
- while topid == pos.fresh do wait(500) topid = topitem(pos.x,pos.y,pos.z).id end
- useitemon(touseid, pos.body, ground(pos.x,pos.y,pos.z), itempos) waitping(1.4, 1.7)
- pausewalking(0)
- return true
- end
- return false
- end
- function skin(dist, movebody, waitfresh)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinsample(dist, movebody, waitfresh, 5908, SKINLIST)
- end
- function stake(dist, movebody, waitfresh)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinsample(dist, movebody, waitfresh, 5942, STAKELIST)
- end
- function skinkitchenknife(dist, movebody, waitfresh)
- if type(movebody) ~= 'boolean' then
- movebody = false
- end
- if type(waitfresh) ~= 'boolean' then
- waitfresh = false
- end
- return skinsample(dist, movebody, waitfresh, 3469, {{4173, 6017, 'rabbit'}})
- end
- FISHSPOTS = {time = 0, id = 0, nonfish = {}, fish = {}}
- function FISHSPOTS:update(id)
- self.time = $timems
- self.id = id
- self.nonfish = {}
- self.fish = {}
- for j=-5,5 do
- for i=-7,7 do
- local cur = {x=$posx+i,y=$posy+j,z=$posz,id=0}
- cur.id = topitem(cur.x,cur.y,cur.z).id
- if tileshootable(cur.x,cur.y,cur.z) then
- if self.id <= 100 and self.id >= 0 then
- if cur.id >= 4597 and cur.id <= 4602 then
- table.insert(self.fish, {x=cur.x,y=cur.y,z=cur.z})
- elseif cur.id >= 4609 and cur.id <= 4614 then
- table.insert(self.nonfish, {x=cur.x,y=cur.y,z=cur.z})
- end
- elseif (type(self.id) == 'number' and self.id == cur.id) or table.find(self.id,cur.id) then
- local tile = gettile(cur.x,cur.y,cur.z)
- local insert = true
- for k=1, tile.itemcount do
- local tempid = tile.item[k].id
- if tempid == 99 or table.find(stairsids,tempid) then
- insert = false
- break
- end
- end
- if insert then
- table.insert(self.fish, {x=cur.x,y=cur.y,z=cur.z})
- end
- end
- end
- end
- end
- end
- function FISHSPOTS:clear()
- self.time = 0
- self.id = 0
- self.nonfish = {}
- self.fish = {}
- end
- function comparetables(a,b)
- if #a ~= #b then
- return false
- end
- for i,j in ipairs(a) do
- if j ~= b[i] then
- return false
- end
- end
- for i,j in pairs(a) do
- if j ~= b[i] then
- return false
- end
- end
- return true
- end
- function fish(n)
- n = n or 0
- local rodid,rodpos = 3483
- if clientitemhotkey(rodid,'crosshair') == 'not found' then
- rodpos = ''
- end
- if $timems-FISHSPOTS.time > 100 or (type(n) == 'number' and n ~= FISHSPOTS.id) or (type(n) == 'table' and not comparetables(n, FISHSPOTS.id)) then
- FISHSPOTS:update(n)
- end
- local j = math.random(1,100)
- local tofish
- if (#FISHSPOTS.nonfish > 0 and n <= 100) and (j <= n or #FISHSPOTS.fish == 0) then
- j = math.random(1,#FISHSPOTS.nonfish)
- tofish = FISHSPOTS.nonfish[j]
- elseif #FISHSPOTS.fish > 0 and (#FISHSPOTS.nonfish == 0 or n == 0 or n > 100 or j > n) then
- j = math.random(1,#FISHSPOTS.fish)
- tofish = FISHSPOTS.fish[j]
- end
- if tofish then
- pausewalking(10000)
- useitemon(rodid,topitem(tofish.x,tofish.y,tofish.z).id,ground(tofish.x,tofish.y,tofish.z),rodpos) waitping(1.1,1.4)
- pausewalking(0)
- end
- end
- function fishspots(n)
- n = n or 0
- if $timems-FISHSPOTS.time > 100 or (type(n) == 'number' and n ~= FISHSPOTS.id) or (type(n) == 'table' and not comparetables(n, FISHSPOTS.id)) then
- FISHSPOTS:update(n)
- end
- return #FISHSPOTS.fish
- end
- function settargeting(onoff, stopattacking, t)
- if (onoff == nil) then
- return
- else
- onoff = onoff:lower()
- if (onoff == 'on') or (onoff == 'yes') then
- onoff = 'yes'
- elseif (onoff == 'off') or (onoff == 'no') then
- onoff = 'no'
- end
- end
- setsetting('Targeting/TargetingEnabled', onoff, t)
- if onoff == 'no' and stopattacking ~= false then
- stopattack()
- end
- end
- function setcavebot(onoff, t)
- if (onoff == nil) then
- return
- else
- onoff = onoff:lower()
- if (onoff == 'on') or (onoff == 'yes') then
- onoff = 'yes'
- elseif (onoff == 'off') or (onoff == 'no') then
- onoff = 'no'
- end
- end
- setsetting('Cavebot/CavebotEnabled', onoff, t)
- end
- function setlooting(onoff, t)
- if (onoff == nil) then
- return
- else
- onoff = onoff:lower()
- if (onoff == 'on') or (onoff == 'yes') then
- onoff = 'yes'
- elseif (onoff == 'off') or (onoff == 'no') then
- onoff = 'no'
- end
- end
- setsetting('Cavebot/Looting/LootingEnabled', onoff, t)
- end
- function sethealing(onoff, t)
- if (onoff == nil) then
- return
- else
- onoff = onoff:lower()
- if (onoff == 'on') or (onoff == 'yes') then
- onoff = 'yes'
- elseif (onoff == 'off') or (onoff == 'no') then
- onoff = 'no'
- end
- end
- setsetting('Healer/HealerEnabled', onoff, t)
- end
- function setmanatraining(onoff, t)
- if (onoff == nil) then
- return
- else
- onoff = onoff:lower()
- if (onoff == 'on') or (onoff == 'yes') then
- onoff = 'yes'
- elseif (onoff == 'off') or (onoff == 'no') then
- onoff = 'no'
- end
- end
- setsetting('Healer/ManaTraining/Enabled', onoff, t)
- end
- function setalarm(alarmtype, playsound, pausebot, logout, t)
- local alarmtypes = {'PlayerOnScreen','PlayerAttacking','DefaultMessage','PrivateMessage','GmDetected','Disconnected','CrashedFroze'}
- local alarmtypes2 = {'playeronscreen','playerattacking','defaultmessage','privatemessage','gmdetected','disconnected','crashedfroze'}
- local pos = table.find(alarmtypes2,alarmtype:lower())
- if not pos then
- return
- end
- if not playsound or playsound == 'off' or playsound == 'no' or playsound == 0 then
- playsound = 'no'
- elseif playsound == 'on' or playsound == 'yes' or playsound == 1 then
- playsound = 'yes'
- end
- if not pausebot or pausebot == 'off' or pausebot == 'no' or pausebot == 0 then
- pausebot = 'no'
- elseif pausebot == 'on' or pausebot == 'yes' or pausebot == 1 then
- pausebot = 'yes'
- end
- if not logout or logout == 'off' or logout == 'no' or logout == 0 then
- logout = 'no'
- elseif logout == 'on' or logout == 'yes' or logout == 1 then
- logout = 'yes'
- end
- setsetting('Alerts/'..alarmtypes[pos]..'/PlaySound', playsound, t)
- setsetting('Alerts/'..alarmtypes[pos]..'/FlashClient', playsound, t)
- setsetting('Alerts/'..alarmtypes[pos]..'/PauseBot', pausebot, t)
- setsetting('Alerts/'..alarmtypes[pos]..'/Disconnect', logout, t)
- end
- function addtosafelist(safetype, ...)
- local alarmtypes = {'PlayerOnScreen','PlayerAttacking','DefaultMessage','PrivateMessage','GmDetected','Disconnected','CrashedFroze'}
- local alarmtypes2 = {'playeronscreen','playerattacking','defaultmessage','privatemessage','gmdetected','disconnected','crashedfroze'}
- local pos = table.find(alarmtypes2,alarmtype:lower())
- if not pos then return end
- local cursafe = getsetting('Alerts/'..alarmtypes[pos]..'/SafeList'):token(nil,'\n')
- table.lower(cursafe)
- for i,j in ipairs({...}) do
- if not table.find(cursafe,j:lower()) then
- table.insert(cursafe,j)
- end
- end
- local p = ''
- for i,j in ipairs(cursafe) do
- p = p..j..'\n'
- end
- setsetting('Alerts/'..alarmtypes[pos]..'/SafeList',p)
- end
- function removefromsafelist(safetype, ...)
- local alarmtypes = {'PlayerOnScreen','PlayerAttacking','DefaultMessage','PrivateMessage','GmDetected','Disconnected','CrashedFroze'}
- local alarmtypes2 = {'playeronscreen','playerattacking','defaultmessage','privatemessage','gmdetected','disconnected','crashedfroze'}
- local pos = table.find(alarmtypes2,alarmtype:lower())
- if not pos then return end
- local cursafe = getsetting('Alerts/'..alarmtypes[pos]..'/SafeList'):token(nil,'\n')
- table.lower(cursafe)
- for i,j in ipairs({...}) do
- local m = table.find(cursafe,j:lower())
- if m then
- table.remove(cursafe,m)
- end
- end
- local p = ''
- for i,j in ipairs(cursafe) do
- p = p..j..'\n'
- end
- setsetting('Alerts/'..alarmtypes[pos]..'/SafeList',p)
- end
- function stopattack()
- keyevent(0x1B)
- end
- function string:token(n,delimiter)
- delimiter = delimiter or ' +'
- local result = {}
- local from = 1
- local delim_from, delim_to = self:find(delimiter,from)
- while delim_from do
- table.insert(result, self:sub(from,delim_from-1))
- from = delim_to + 1
- delim_from, delim_to = self:find(delimiter,from)
- end
- table.insert(result,self:sub(from))
- if n then
- return result[n]
- end
- return result
- end
- function string:fitcontent(size,margin,fontsize)
- local maxletters = math.floor((size-2*(margin+3))/(fontsize-1.5))
- if self:len() > maxletters then
- return self:sub(1,maxletters)..'...'
- end
- return self
- end
- local spellsareas = {
- sstrike = {centerx = 2, centery = 2, area = {
- {0,2,0},
- {3,0,4},
- {0,5,0}}},
- ssmallwave = {centerx = 5, centery = 5, area = {
- {0,0,2,2,2,2,2,0,0},
- {0,0,0,2,2,2,0,0,0},
- {3,0,0,2,2,2,0,0,4},
- {3,3,3,0,2,0,4,4,4},
- {3,3,3,3,0,4,4,4,4},
- {3,3,3,0,5,0,4,4,4},
- {3,0,0,5,5,5,0,0,4},
- {0,0,0,5,5,5,0,0,0},
- {0,0,5,5,5,5,5,0,0}}},
- sbigwave = {centerx = 6, centery = 6, area = {
- {0,0,0,0,2,2,2,0,0,0,0},
- {0,0,0,0,2,2,2,0,0,0,0},
- {0,0,0,0,2,2,2,0,0,0,0},
- {0,0,0,0,0,2,0,0,0,0,0},
- {3,3,3,0,0,2,0,0,4,4,4},
- {3,3,3,3,3,0,4,4,4,4,4},
- {3,3,3,0,0,5,0,0,4,4,4},
- {0,0,0,0,0,5,0,0,0,0,0},
- {0,0,0,0,5,5,5,0,0,0,0},
- {0,0,0,0,5,5,5,0,0,0,0},
- {0,0,0,0,5,5,5,0,0,0,0}}},
- ssmallbeam = {centerx = 6, centery = 6, area = {
- {0,0,0,0,0,2,0,0,0,0,0},
- {0,0,0,0,0,2,0,0,0,0,0},
- {0,0,0,0,0,2,0,0,0,0,0},
- {0,0,0,0,0,2,0,0,0,0,0},
- {0,0,0,0,0,2,0,0,0,0,0},
- {3,3,3,3,3,0,4,4,4,4,4},
- {0,0,0,0,0,5,0,0,0,0,0},
- {0,0,0,0,0,5,0,0,0,0,0},
- {0,0,0,0,0,5,0,0,0,0,0},
- {0,0,0,0,0,5,0,0,0,0,0},
- {0,0,0,0,0,5,0,0,0,0,0}}},
- sbigbeam = {centerx = 9, centery = 9, area = {
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0},
- {3,3,3,3,3,3,3,3,0,4,4,4,4,4,4,4,4},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0}}},
- sfront = {centerx = 2, centery = 2, area = {
- {9,2,6},
- {3,0,4},
- {8,5,7}}},
- sexplo = {centerx = 2, centery = 2, area = {
- {0,1,0},
- {1,1,1},
- {0,1,0}}},
- s1x1 = {centerx = 2, centery = 2, area = {
- {1,1,1},
- {1,1,1},
- {1,1,1}}},
- s2x2 = {centerx = 3, centery = 3, area = {
- {0,1,1,1,0},
- {1,1,1,1,1},
- {1,1,1,1,1},
- {1,1,1,1,1},
- {0,1,1,1,0}}},
- s3x3 = {centerx = 4, centery = 4, area = {
- {0,0,1,1,1,0,0},
- {0,1,1,1,1,1,0},
- {1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1},
- {1,1,1,1,1,1,1},
- {0,1,1,1,1,1,0},
- {0,0,1,1,1,0,0}}},
- s5x5 = {centerx = 6, centery = 6, area = {
- {0,0,0,0,0,1,0,0,0,0,0},
- {0,0,0,1,1,1,1,1,0,0,0},
- {0,0,1,1,1,1,1,1,1,0,0},
- {0,1,1,1,1,1,1,1,1,1,0},
- {0,1,1,1,1,1,1,1,1,1,0},
- {1,1,1,1,1,1,1,1,1,1,1},
- {0,1,1,1,1,1,1,1,1,1,0},
- {0,1,1,1,1,1,1,1,1,1,0},
- {0,0,1,1,1,1,1,1,1,0,0},
- {0,0,0,1,1,1,1,1,0,0,0},
- {0,0,0,0,0,1,0,0,0,0,0}}},
- s6x6 = {centerx = 7, centery = 7, area = {
- {0,0,0,0,0,0,1,0,0,0,0,0,0},
- {0,0,0,0,1,1,1,1,1,0,0,0,0},
- {0,0,0,1,1,1,1,1,1,1,0,0,0},
- {0,0,1,1,1,1,1,1,1,1,1,0,0},
- {0,1,1,1,1,1,1,1,1,1,1,1,0},
- {0,1,1,1,1,1,1,1,1,1,1,1,0},
- {1,1,1,1,1,1,1,1,1,1,1,1,1},
- {0,1,1,1,1,1,1,1,1,1,1,1,0},
- {0,1,1,1,1,1,1,1,1,1,1,1,0},
- {0,0,1,1,1,1,1,1,1,1,1,0,0},
- {0,0,0,1,1,1,1,1,1,1,0,0,0},
- {0,0,0,0,1,1,1,1,1,0,0,0,0},
- {0,0,0,0,0,0,1,0,0,0,0,0,0}}}}
- function isonspellarea(mid,spelltype,spelldir,x,y)
- if not spelldir then
- spelldir = $self.dir
- end
- local directionconversion = {nil, $self.dir, 'n', 'w', 'e', 's', 'ne', 'se', 'sw', 'nw'}
- mid = findcreature(mid)
- if mid.id == 0 then
- return false
- end
- local numberspelltype = tonumber(spelltype)
- if type(spelltype) == 'string' then
- spelltype = 's'..(spelltype:gsub(' ','')):lower()
- else
- return false
- end
- if not (x and y) then
- x,y = $posx,$posy
- elseif math.abs(x) <= 7 and math.abs(y) <= 5 then
- x,y = $posx+x,$posy+y
- else
- x,y = nil,nil
- end
- if mid and (spellsareas[spelltype] or numberspelltype) and mid.posz == $posz and x and y and mid.isshootable then
- if numberspelltype then
- if mid == $attacked and mid.dist <= numberspelltype then
- return true
- else
- return false
- end
- end
- local centerx,centery = spellsareas[spelltype].centerx,spellsareas[spelltype].centery
- local posx,posy = centerx-(x-mid.posx),centery-(y-mid.posy)
- local value
- if posx >= 1 and posx <= centerx*2-1 and posy >= 1 and posy <= centery*2-1 then
- value = directionconversion[spellsareas[spelltype].area[posy][posx]+1]
- end
- if value and (value:find(spelldir) or spelldir == 'any') then
- return true
- end
- end
- return false
- end
- function wheretoturn(mid,spelltype)
- local directionconversion = {nil, $self.dir, 'n', 'w', 'e', 's', 'ne', 'se', 'sw', 'nw'}
- if type(mid) == 'number' or type(mid) == 'string' then
- mid = findcreature(mid)
- end
- local numberspelltype = tonumber(spelltype)
- if numberspelltype then
- spelltype = numberspelltype
- elseif type(spelltype) == 'string' then
- spelltype = 's'..(spelltype:gsub(' ','')):lower()
- else
- return $self.dir
- end
- local x,y = $posx,$posy
- if mid and mid.id ~= 0 and mid.posz == $posz and x and y and mid.isshootable then
- local centerx,centery = spellsareas[spelltype].centerx,spellsareas[spelltype].centery
- local posx,posy = centerx-(x-mid.posx),centery-(y-mid.posy)
- local value = $self.dir
- if posx >= 1 and posx <= centerx*2-1 and posy >= 1 and posy <= centery*2-1 then
- value = directionconversion[spellsareas[spelltype].area[posy][posx] +1]
- end
- if value:find($self.dir) then
- return $self.dir
- end
- local rand = math.random(1,#value)
- return value:sub(rand,rand)
- end
- return $self.dir
- end
- function getarearunetile(ignoreplayers,...)
- monsters = {...}
- table.lower(monsters)
- local sqm = {tile,x,y,z,amount=0}
- for a=0,7 do
- local i,j = -a, -a
- while j <= a do
- i = -a
- while i <= a do
- if (math.abs(j) == a or math.abs(i) == a) and (tilehasinfo($posx+i, $posy+j, $posz)) then
- local posx,posy = $posx+i,$posy+j
- if tileshootable(posx,posy,$posz) then
- local tempm,tempp = 0,0
- foreach creature c 'f' do
- if c ~= $self then
- if isonspellarea(c, '3x3', false, i, j) then
- if (#monsters == 0 and (c.ismonster or ignoreplayers)) or table.find(monsters,c.name:lower()) or table.find(monsters,c.id) or table.find(monsters,c) then
- tempm = tempm+1
- elseif c.isplayer then
- tempp = tempp+1
- end
- end
- end
- if tempm > sqm.amount and (ignoreplayers or tempp == 0) then
- sqm.tile,sqm.x,sqm.y,sqm.z,sqm.amount = ground(posx,posy,$posz),posx,posy,$posz,tempm
- end
- end
- end
- end
- if math.abs(j) ~= a then
- i = i+2*a
- else
- i = i+1
- end
- end
- j = j+1
- end
- end
- return sqm
- end
- function shootarearune(id, amount, ignoreplayers, ...)
- id = itemid(id)
- local monsters = {...}
- if ignoreplayers then
- if type(ignoreplayers) == 'string' or (type(ignoreplayers) == 'number' and ignoreplayers > 100) then
- table.insert(monsters,ignoreplayers)
- end
- ignoreplayers = ignoreplayers == true or false
- end
- if amount then
- if type(amount) == 'string' or (type(amount) == 'number' and amount > 100) then
- table.insert(monsters,amount)
- amount = 1
- end
- end
- amount = amount or 1
- local temp = getarearunetile(ignoreplayers, table.unpack(monsters))
- if temp.amount >= amount then
- useitemon(id, topitem(temp.x,temp.y,temp.z), temp.tile)
- return true
- end
- return false
- end
- function cursorinfo() -- Credits to Anonymickey, for doing the calculations.
- local temp = {x,y,z,id,msg}
- if $cursor.x >= $worldwin.left and $cursor.x <= $worldwin.right and $cursor.y <= $worldwin.bottom and $cursor.y >= $worldwin.top then
- local sqmWidth = ($worldwin.bottom - $worldwin.top)/11
- temp.x, temp.y, temp.z = $posx - 8 + math.ceil(($cursor.x - $worldwin.left)/sqmWidth), $posy - 6 + math.ceil(($cursor.y - $worldwin.top)/sqmWidth), $posz
- temp.id = topitem(temp.x, temp.y, temp.z).id
- temp.msg = temp.x..', '..temp.y..', '..temp.z..' / '..temp.id
- else
- temp.x, temp.y, temp.z, temp.id, temp.msg = 0,0,0,0,'dontlist'
- end
- return temp
- end
- function tobin(x, reverse)
- local bin = ''
- while x ~= 0 do
- local mod = x % 2
- if reverse then
- bin = bin .. mod
- else
- bin = mod .. bin
- end
- x = math.floor(x/2)
- end
- return bin
- end
- function bintonum(x)
- if type(x) == 'number' then
- x = tostring(x)
- elseif type(x) ~= 'string' then
- return
- end
- local num = 0
- for i=1,x:len() do
- num = num*2 + tonumber(x:sub(i,i))
- end
- return num
- end
- function table:lower(inpairs)
- if not inpairs then
- for i,j in ipairs(self) do
- if type(j) == 'string' then
- self[i] = j:lower()
- end
- end
- else
- for i,j in pairs(self) do
- if type(j) == 'string' then
- self[i] = j:lower()
- end
- end
- end
- end
- function table:id(inpairs)
- if not inpairs then
- local i = 1
- while i <= #self do
- if type(self[i]) == 'string' then
- local iid = itemid(self[i])
- if iid ~= 0 then
- self[i] = iid
- i = i+1
- else
- table.remove(self,i)
- end
- elseif type(self[i]) == 'number' then
- i = i+1
- else
- table.remove(self,i)
- end
- end
- else
- for i,j in pairs(self) do
- if type(j) == 'string' then
- self[i] = itemid(j)
- end
- end
- end
- end
- function table:spell(inpairs)
- if not inpairs then
- local i = 1
- while i <= #self do
- if type(self[i]) == 'string' then
- local iid = spellinfo(self[i])
- if iid then
- self[i] = iid
- i = i+1
- else
- table.remove(self,i)
- end
- elseif type(self[i]) == 'table' then
- i = i+1
- else
- table.remove(self,i)
- end
- end
- else
- for i,j in pairs(self) do
- if type(j) == 'string' then
- local tsinfo = spellinfo(j)
- if tsinfo then
- self[i] = tsinfo
- else
- table.remove(self,i)
- end
- end
- end
- end
- end
- function table:upper(inpairs)
- if not inpairs then
- for i,j in ipairs(self) do
- if type(j) == 'string' then
- self[i] = j:upper()
- end
- end
- else
- for i,j in pairs(self) do
- if type(j) == 'string' then
- self[i] = j:upper()
- end
- end
- end
- end
- function foodcount()
- temp = 0
- for i,j in ipairs(eatfoodids) do
- temp = temp+itemcount(j)
- end
- return temp
- end
- function isfood(id)
- id = itemid(id)
- return table.binaryfind(eatfoodids,id) ~= nil
- end
- local travelnpcs = {{'Anderson', {folda = {32046,31580,7}, vega = {32022,31692,7}, tibia = {32234,31675,7}}},
- {'Carlson', {folda = {32046,31580,7}, senja = {32126,31665,7}, tibia = {32234,31675,7}}},
- {'Svenson', {vega = {32022,31692,7}, senja = {32126,31665,7}, tibia = {32234,31675,7}}},
- {'Nielson', {folda = {32046,31580,7}, senja = {32126,31665,7}, vega = {32022,31692,7}}},
- {'Chemar', {edron = {33193,31784,3}, farmine = {32983,31539,1}, hills = {32535,31837,4}, svargrond = {32254,31097,4}}},
- {'Iyad', {edron = {33193,31784,3}, hills = {32535,31837,4}, darashia = {33269,32441,6}, farmine = {32983,31539,1}}},
- {'Pino', {darashia = {33269,32441,6}, svargrond = {32254,31097,4}, farmine = {32983,31539,1}, hills = {32535,31837,4}}},
- {'Uzon', {darashia = {33269,32441,6}, farmine = {32983,31539,1}, svargrond = {32254,31097,4}, edron = {33193,31784,3}--[[, eclipse = nil--]]}},
- {'Melian', {darashia = {33269,32441,6}, edron = {33193,31784,3}, hills = {32535,31837,4}, svargrond = {32254,31097,4}}},
- {'Brodrosch', {cormaya = {33309,31989,15}, farmine = {33024,31552,10}}},
- {'Thorgrin', {cormaya = {33309,31989,15}, kazordoon = {33309,31989,15}}},
- {'Captain Bluebear', {abdendriel = {32733,31668,6}, carlin = {32387,31821,6}, edron = {33193,31784,3}, libertybay = {32283,32893,6}, porthope = {32530,32784,6}, svargrond = {32341,31108,6}, venore = {32954,32023,6}, yalahar = {32816,31272,6}}},
- {'Captain Breezelda', {venore = {32954,32023,6}, thais = {32312,32211,6}, carlin = {32387,31821,6}}},
- {'Captain Cookie', {libertybay = {32298,32896,6}}},
- {'Captain Fearless', {abdendriel = {32733,31668,6}, carlin = {32387,31821,6}, edron = {33175,31764,6}, darashia = {33289,32480,6}, thais = {32312,32211,6}, porthope = {32530,32784,6}, ankrahmun = {33091,32883,6}, libertybay = {32283,32893,6}, svargrond = {32341,31108,6}, yalahar = {32816,31272,6}}},
- {'Captain Greyhound', {abdendriel = {32733,31668,6}, edron = {33175,31764,6}, svargrond = {32341,31108,6}, thais = {32312,32211,6}, venore = {32954,32023,6}, yalahar = {32816,31272,6}}},
- {'Captain Seagull', {carlin = {32387,31821,6}, edron = {33175,31764,6}, thais = {32312,32211,6}, venore = {32954,32023,6}, yalahar = {32816,31272,6}}},
- {'Captain Seahorse', {abdendriel = {32733,31668,6}, ankrahmun = {33091,32883,6}, carlin = {32387,31821,6}, cormaya = {33288,31956,6}, libertybay = {32283,32893,6}, porthope = {32530,32784,6}, thais = {32312,32211,6}, venore = {32954,32023,6}}},
- {'Captain Sinbeard', {darashia = {33289,32480,6}, venore = {32954,32023,6}, libertybay = {32283,32893,6}, porthope = {32530,32784,6}, edron = {33175,31764,6}, yalahar = {32816,31272,6}}},
- {'Charles', {ankrahmun = {33091,32883,6}, darashia = {33289,32480,6}, edron = {33175,31764,6}, thais = {32312,32211,6}, venore = {32954,32023,6}, libertybay = {32283,32893,6}, yalahar = {32816,31272,6}}},
- {'Jack Fate', {ankrahmun = {33091,32883,6}, darashia = {33289,32480,6}, edron = {33175,31764,6}, porthope = {32530,32784,6}, thais = {32312,32211,6}, venore = {32954,32023,6}, yalahar = {32816,31272,6}, goroma = {32161,32558,6}, libertybay = {32283,32893,6}}},
- {'Karith', {abdendriel = {32733,31668,6}, darashia = {33289,32480,6}, venore = {32954,32023,6}, ankrahmun = {33091,32883,6}, porthope = {32530,32784,6}, thais = {32312,32211,6}, libertybay = {32283,32893,6}, carlin = {32387,31821,6}}},
- {'Petros', {ankrahmun = {33091,32883,6}, venore = {32954,32023,6}, porthope = {32530,32784,6}, libertybay = {32283,32893,6}, yalahar = {32816,31272,6}}},
- {'Captain Haba', {hunt = {31942,31047,6}, svargrond = {32339,31117,7}}},
- {'Captain Jack', {tibia = {32205,31756,6}}},
- {'Captain Max', {calassa = {31920,32710,7}, libertybay = {32298,32896,6}, yalahar = {32804,31270,6}}},
- {'Captain Waverider', {pegleg = {32346,32625,7}, libertybay = {32350,32856,7}, passage = {32132,32912,7}}},
- {'Dalbrect', {passage = {32190,31957,6}}},
- {'Gurbasch', {kazordoon = {33309,31989,15}, farmine = {33024,31552,10}}},
- {'Harlow', {vengoth = {32857,31549,7}, yalahar = {32837,31364,7}}},
- {'Maris', {mistrock = {32640,31439,7}, fenrock = {32564,31313,7}, yalahar = {32649,31292,6}}},
- {'Pemaret', {edron = {33175,31764,6}, eremo = {33315,31882,7}}},
- {'Eremo', {cormaya = {33288,31956,6}}},
- {'Sebastian', {nargor = {32025,32812,7}, libertybay = {32316,32702,7}, meriana = {32346,32625,7}}},
- {'Buddel', {okolnir = {32224,31381,7}, camp = {32153,31376,7}, tyrsung = {32333,31227,7}, helheim = {32462,31174,7}, svargrond = {32256,31197,7}}},
- {'Rapanaio', {kazordoon = {32700,31989,15}, isleofevil = {32667,31452,7}}},
- {'Imbul', {east = {32679,32777,7}, center = {32628,32771,7}--[[, mountain = --]], chor = {32968,32799,7}--[[, banuta--]]}},
- {'Old Adall', {east = {32679,32777,7}, west = {32558,32780,7}--[[, mountain = --]], chor = {32968,32799,7}--[[, banuta--]]}},
- {'Lorek', {center = {32628,32771,7}, west = {32558,32780,7}--[[, mountain = --]], chor = {32968,32799,7}--[[, banuta--]]}},
- {'Tarak', {monument = {32941,31182,7}, yalahar = {32916,31199,7}}},
- {'Barry', {magician = {32884,31156,7}, sunken = {32884,31164,7}}, 'yalaharguard'},
- {'Bruce', {alchemist = {32737,31113,7}, cemetery = {32745,31113,7}}, 'yalaharguard'},
- {'Hal', {arena = {32688,31195,7}, alchemist = {32688,31187,7}}, 'yalaharguard'},
- {'Oliver', {factory = {32895,31233,7}, sunken = {32895,31225,7}}, 'yalaharguard'},
- {'Peter', {factory = {32860,31302,7}, trade = {32853,31302,7}}, 'yalaharguard'},
- {'Reed', {cemetery = {32798,31103,7}, magician = {32806,31103,7}}, 'yalaharguard'},
- {'Tony', {arena = {32695,31253,7}, foreigner = {32695,31260,7}}, 'yalaharguard'}}
- function findtravelnpc()
- for i,j in ipairs(travelnpcs) do
- npcname = j[1]
- foreach creature m 'mf' do
- if m.name == npcname then
- return m, i
- end
- end
- end
- return nil
- end
- function travel(destin, havering) -- Credits to botterxxx for finding all the destination positions.
- destin = destin:lower()
- if havering == nil and itemcount('dwarven ring') > 0 then
- havering = true
- end
- local destination
- local locationsconvert = {{{"ab'dendriel", "ab dendriel", "abdendriel"}, {"ab'dendriel", "abdendriel"}},
- {{"libertybay", "liberty bay"}, {"liberty bay", "libertybay"}},
- {{"port hope", "porthope"}, {"port hope", "porthope"}},
- {{"pegleg", "peg leg", "meriana"}, {"peg leg", "pegleg"}},
- {{"treasureisland", "treasure island"}, {"passage", "passage"}},
- {{"isle of the kings", "isleofthekings"}, {"passage", "passage"}},
- {{"sea serpent", "seaserpent", "seaserpents","sea serpents"}, {"hunt", "hunt"}},
- {{"barbarian", "barbarian camp", "krimhorn"}, {"camp", "camp"}},
- {{"femor", "femur", "femur hills", "femor hills", "femurhils", "femorhills"}, {"hills", "hills"}},
- {{"darama"}, {"darashia", "darashia"}},
- {{"monument tower", "monument", "trip"}, {"passage", "monument"}},
- {{"isle of evil", "isleofevil"}, {"isle of evil", "isleofevil"}}}
- for i,j in ipairs(locationsconvert) do
- if table.find(j[1],destin) then
- destin = j[2][1]
- destination = j[2][2]
- break
- end
- end
- if not destination then
- destination = destin
- end
- local tries,maxtries = 0,math.random(1,4)
- local destinreached = false
- while not destinreached do
- local npcinfo,npcpos = findtravelnpc()
- if not npcinfo then
- printerror('There is no travel NPC on your screen.')
- return
- end
- if not travelnpcs[npcpos][2][destination] then
- printerror("The NPC '" ..npcinfo.name.. "' cant take you to '" ..destin.. "'.")
- return
- end
- local phrases = {destin, 'yes'}
- if travelnpcs[npcpos][3] then
- if travelnpcs[npcpos][3] == 'yalaharguard' then
- phrases = {'pass', destin}
- end
- elseif npcinfo.name == 'Captain Fearless' and destin == 'darashia' then
- phrases = {destin, 'yes', 'yes'}
- elseif npcinfo.name == 'Buddel' then
- if havering then
- phrases = {'go', destin, 'no', 'yes'}
- else
- phrases = {'go', destin, 'yes'}
- end
- end
- if not travelnpcs[npcpos][3] then
- while npcinfo.dist > 2 do
- reachcreature(npcinfo.name) waitping()
- end
- else
- while npcinfo.dist > 3 do
- reachgrounditem(8617)
- reachgrounditem(8569)
- wait(1500)
- end
- end
- if ischannel('NPCs') then
- npcsay('hi') waitping()
- else
- say('hi') wait(2000,3000)
- end
- for i,j in ipairs(phrases) do
- npcsay(j) waitping()
- end
- waitping(5,8)
- tries = tries+1
- local desttable = (travelnpcs[npcpos][2][destination])
- destinreached = (math.abs($posx-desttable[1]) <= 2 and math.abs($posy-desttable[2]) <= 2 and $posz == desttable[3])
- if not destinreached and npcinfo.name ~= 'Buddel' and tries >= maxtries then
- printerror("Unable to travel to '" ..destin.."' trought NPC '"..npcinfo.name.."'. DestinationPos: "..desttable[1]..','..desttable[2]..','..desttable[3])
- return
- end
- end
- end
- function collectitems(bpname,...)
- local itemids = {...}
- table.id(itemids)
- if not bpname then
- bpname = ''
- elseif type(bpname) == 'number' then
- table.insert(itemids,bpname)
- bpname = ''
- end
- for j=-1,1 do
- for i=-1,1 do
- local t = topitem($posx+i,$posy+j,$posz).id
- if itemproperty(t,ITEM_PICKUPABLE) and (#itemids == 0 or table.find(itemids,t)) then
- pausewalking(10000)
- moveitems(t,bpname,ground($posx+i,$posy+j,$posz),100)
- pausewalking(0)
- break
- end
- end
- end
- end
- function usegrounditem(x,y,z)
- if not x then
- return
- elseif type(x) == 'string' then
- x = itemid(x)
- end
- if not y or not z then
- useitem(x,'ground')
- else
- useitem(topitem(x,y,z).id,ground(x,y,z))
- end
- return
- end
- function paroundignore(dist,...)
- return paround(dist)-paround(dist,...)
- end
- function maroundignore(dist,...)
- return maround(dist)-maround(dist,...)
- end
- function enchantspear(hand)
- local locationto,weaponid,handpos
- local mana = 350
- local spell = 'exeta con'
- if (itemcount(3277) == 0) or ($mp < mana) or (spell == nil) or not cooleddown('exeta con') then
- return false
- end
- if $belt.id == 0 then
- locationto = 'belt'
- else
- locationto = 'backpack'
- end
- if (hand == nil) or (hand == 'left') or (hand == 'lhand') then
- hand = $lhand
- handpos = 'lhand'
- elseif (hand == 'right') or (hand == 'rhand') then
- hand = $rhand
- handpos = 'rhand'
- end
- weaponid = hand.id
- while (hand.id ~= 0) do
- listas('Unequipping Weapon')
- moveitems(weaponid,locationto,handpos,100)
- waitping()
- end
- while (hand.id == 0) do
- listas('Equipping Spear')
- moveitems(3277,handpos,'0-15',1)
- waitping()
- end
- while (hand.id ~= 7367) and (hand.id == 3277) do
- listas('Enchanting Spear')
- cast(spell)
- waitping()
- end
- while (hand.id ~= 0) do
- listas('Unequipping Enchanted Spear')
- moveitems(7367,locationto,handpos,100)
- waitping()
- end
- while (hand.id == 0) do
- listas('Equipping Weapon')
- moveitems(weaponid,handpos,'0-15',100)
- waitping()
- end
- end
- function dropitems(pos,...)
- setlifetime(180000)
- local items = {...}
- table.id(items)
- if type(pos) == 'string' and pos:token(1) ~= 'ground' then
- table.insert(items,itemid(pos))
- pos = 'ground'
- elseif type(pos) == 'number' then
- table.insert(items,pos)
- pos = 'ground'
- end
- for i,j in ipairs(items) do
- while itemcount(j,'0-15') > 0 do
- moveitems(j,pos,'0-15',100)
- end
- end
- end
- function itemsaround(dist,...) -- by golfinhu
- local itemlist = {...}
- table.id(itemlist)
- if not dist or dist == 0 then
- dist = 7
- elseif dist > 7 or type(dist) == 'string' then
- table.insert(itemlist,itemid(dist))
- dist = 7
- end
- local total = 0
- for a=-dist,dist do
- for b=-dist,dist do
- local itemontop = topitem($posx+a,$posy+b,$posz)
- if tilehasinfo($posx+a, $posy+b, $posz) and not itemproperty(itemontop.id,ITEM_GROUND) and (table.find(itemlist,itemontop.id) or #itemlist == 0) then
- total = total+itemontop.count
- end
- end
- end
- return total
- end
- function totalitems(location,...)
- local itemlist = {...}
- if type(location) == 'number' then
- if location > 15 then
- table.insert(itemlist,location)
- location = ''
- else
- location = tostring(location)
- end
- end
- local total = 0
- for i,j in ipairs(itemlist) do
- total = total+itemcount(j,location)
- end
- return total
- end
- function fishinice(x, y, z, pickid) -- by botterxxx
- if pickid == nil then
- pickid = 3456
- end
- if x and y and z and math.abs($posx-x) <= 7 and math.abs($posy-y) <= 5 and $posz == z then
- reachlocation(x,y,z)
- if (isitemontile(7200,x,y,z) or isitemontile(7236,x,y,z)) and not ($posx == x and $posy == y and $posz == z) then
- local id = topitem(x,y,z).id
- while id ~= 7237 do
- if id == 7200 then
- useitemon(pickid,id,ground(x,y,z))
- elseif id == 7236 then
- useitemon(3483,id,ground(x,y,z))
- elseif not itemproperty(id,ITEM_NOTMOVEABLE) then
- moveitems(id,ground($posx,$posy,$posz),ground(x,y,z),100)
- else
- return false
- end
- id = topitem(x,y,z).id
- end
- return true
- end
- end
- return false
- end
- --[[function movelevitate(direction,updown,times)
- local dir = {x = {n = 0, s = 0, w = -1, e = 1},
- y = {n = -1, s = 1, w = 0, e = 0}}
- if type(times) ~= 'number' then
- times = math.random(3,5)
- end
- if direction == 'w' or direction == 'e' or direction == 'n' or direction == 's' then
- local startz = $posz
- for i=1,times do
- move(direction) waitping()
- if $posz ~= startz then
- return true
- end
- end
- return levitate(direction, updown)
- end
- return false
- end--]]
- function getdirpos(direction,z)
- z = z or $posz
- local dir = {x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
- y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
- if dir.x[direction] then
- return {$posx+dir.x[direction],$posy+dir.y[direction],z}
- end
- end
- function movelevitate(direction)
- local dir = {x = {n = 0, s = 0, w = -1, e = 1},
- y = {n = -1, s = 1, w = 0, e = 0}}
- if not dir.x[direction] then return false end
- local x,y,z = $posx,$posy,$posz
- local p = gettile($posx+dir.x[direction],$posy+dir.y[direction],$posz)
- local updown = 'up'
- if (p.itemcount == 1 and not itemproperty(p.item[1].id, ITEM_NOTROOFEDGE)) or p.itemcount == 0 then
- x,y,z = $posx+dir.x[direction],$posy+dir.y[direction],$posz+1
- updown = 'down'
- end
- local t = gettile(x,y,z)
- local count = 0
- print($posx,$posy,$posz,x,y,z, t.itemcount)
- for i=2, t.itemcount do
- if itemproperty(t.item[i].id, ITEM_HEIGHTED) and not itemproperty(t.item[i].id, ITEM_BLOCKWALK) then
- count = count + 1
- if count >= 3 then break end
- end
- end
- if count >= 3 then
- local i = 1
- local z = $posz
- while i <= 3 and $posz == z do
- move(direction) waitping()
- i = i+1
- end
- if $posz ~= z then
- return true
- end
- else
- return levitate(direction, updown)
- end
- return false
- end
- sealv = movelevitate
- function sio(hppc,...)
- if not cancastspell('heal friend') then
- return false
- end
- local friends,toheal = {findcreature(...)}
- for i,j in ipairs(friends) do
- if j.hppc < hppc and j.isplayer then
- toheal = j
- hppc = j.hppc
- end
- end
- if toheal then
- local msg = 'exura sio "'..toheal.name
- if clientspellhotkey(msg) ~= 'not found' then
- cast(msg) return true
- end
- if not toheal.name:find(' +') then
- msg = 'exura sio '..toheal.name
- if clientspellhotkey(msg) ~= 'not found' then
- cast(msg) return true
- end
- else
- printerror('Unable to find a hotkey for player: '..toheal.name)
- end
- end
- return false
- end
- function massheal(hppc,amount,considerenemies,enemylist,...)
- if not cancastspell('mass healing') then
- return false
- end
- local friends = {...}
- if type(considerenemies) ~= 'boolean' and considerenemies then
- table.insert(friends,considerenemies)
- considerenemies = nil
- if enemylist and type(enemylist) ~= 'table' then
- table.insert(friends,enemylist)
- enemylist = nil
- end
- end
- local f,e=0,0
- local creatures = {findcreaturesonspellrange('3x3','any','s')}
- for i,j in ipairs(creatures) do
- if j.hppc <= hppc and ((j.isplayer and (#friends == 0 or table.find(friends,j.name:lower()))) or (j.ismonster and table.find(friends,j.id))) then
- f = f+1
- elseif considerenemies and table.find(enemylist,j.name:lower()) then
- e = e+1
- end
- end
- if f >= amount and e == 0 then
- cast('exura gran mas res')
- return true
- end
- return false
- end
- function uh(hppc,...)
- local friends,toheal = {findcreature(...)}
- for i,j in ipairs(friends) do
- if j.hppc < hppc then
- toheal = j
- hppc = j.hppc
- end
- end
- if toheal then
- useoncreature(3160,toheal)
- return true
- end
- return false
- end
- function ih(hppc,...)
- local friends,toheal = {findcreature(...)}
- for i,j in ipairs(friends) do
- if j.hppc < hppc then
- toheal = j
- hppc = j.hppc
- end
- end
- if toheal then
- useoncreature(3152,toheal)
- return true
- end
- return false
- end
- function balance()
- return $balance
- end
- function opentrade(n, sayhi)
- if type(n) == 'boolean' then
- sayhi = n
- n = nil
- end
- n = n or math.random(3,5)
- if not ischannel('NPCs') then
- local nhi = math.random(3,5)
- local trieshi = 0
- while (not ischannel('NPCs') or sayhi) and trieshi < nhi do
- say('hi')
- local waittime = $timems+2500
- while $timems < waittime and not ischannel('NPCs') do wait(100) end
- trieshi = trieshi+1
- end
- if not ischannel('NPCs') then
- return false
- end
- end
- local tries = 0
- while not $tradeopen and tries < n do
- npcsay('trade')
- local waittime = $timems+1400
- while $timems < waittime do
- wait(100)
- if $tradeopen then
- return true
- end
- end
- tries = tries + 1
- end
- return false
- end
- local weapons = {
- axe = {
- name = {"Angelic Axe", "Axe", "Barbarian Axe", "Battle Axe", "Beastslayer Axe", "Butcher's Axe", "Daramanian Axe", "Daramanian Waraxe", "Demonwing Axe", "Double Axe", "Dragon Lance", "Drakinata", "Dreaded Cleaver", "Dwarven Axe", "Earth Barbarian Axe", "Earth Headchopper", "Earth Heroic Axe", "Earth Knight Axe", "Earth War Axe", "Energy Barbarian Axe", "Energy Headchopper", "Energy Heroic Axe", "Energy Knight Axe", "Energy War Axe", "Executioner", "Fiery Barbarian Axe", "Fiery Headchopper", "Fiery Heroic Axe", "Fiery Knight Axe", "Fiery War Axe", "Fire Axe", "Glorious Axe", "Golden Sickle", "Great Axe", "Guardian Halberd", "Halberd", "Hand Axe", "Hatchet", "Headchopper", "Hellforged Axe", "Heroic Axe", "Icy Barbarian Axe", "Icy Headchopper", "Icy Heroic Axe", "Icy Knight Axe", "Icy War Axe", "Impaler", "Knight Axe", "Mythril Axe", "Naginata", "Noble Axe", "Obsidian Lance", "Orcish Axe", "Ornamented Axe", "Ravager's Axe", "Ravenwing", "Reaper's Axe", "Ripper Lance", "Royal Axe", "Ruthless Axe", "Scythe of the Reaper", "Sickle", "Solar Axe", "Steel Axe", "Stonecutter Axe", "Titan Axe", "Twin Axe", "Vile Axe", "War Axe", "Zaoan Halberd"},
- id = {7436, 3274, 3317, 3266, 3344, 7412, 3329, 3328, 8098, 3275, 3302, 10388, 7419, 3323, 783, 787, 786, 785, 788, 801, 804, 803, 802, 805, 7453, 665, 668, 667, 666, 669, 3320, 7454, 3306, 3303, 3315, 3269, 3268, 3276, 7380, 8096, 7389, 684, 687, 686, 685, 688, 7435, 3318, 7455, 3314, 7456, 3313, 3316, 7411, 3331, 7433, 7420, 3346, 7434, 6553, 9384, 3293, 8097, 7773, 3319, 7413, 3335, 7388, 3342, 10406},
- atk = {44, 12, 28, 25, 35, 41, 0, 39, 53, 35, 47, 47, 40, 31, 23, 34, 35, 27, 39, 23, 34, 35, 27, 39, 51, 23, 34, 35, 27, 39, 27, 40, 13, 52, 46, 35, 10, 15, 42, 51, 44, 23, 34, 35, 27, 39, 49, 33, 48, 39, 39, 34, 23, 42, 49, 45, 46, 28, 47, 50, 16, 5, 52, 21, 50, 43, 45, 43, 48, 37}
- },
- sword = {
- name = {"Assassin Dagger", "Berserker", "Blacksteel Sword", "Blade of Corruption", "Bloody Edge", "Bone Sword", "Bright Sword", "Broadsword", "Carlin Sword", "Combat Knife", "Crimson Sword", "Crystal Sword", "Dagger", "Demonrage Sword", "Djinn Blade", "Dragon Slayer", "Earth Blacksteel Sword", "Earth Dragon Slayer", "Earth Mystic Blade", "Earth Relic Sword", "Earth Spike Sword", "Emerald Sword", "Energy Blacksteel Sword", "Energy Dragon Slayer", "Energy Mystic Blade", "Energy Relic Sword", "Energy Spike Sword", "Epee", "Farmer's Avenger", "Fiery Blacksteel Sword", "Fiery Dragon Slayer", "Fiery Mystic Blade", "Fiery Relic Sword", "Fiery Spike Sword", "Fire Sword", "Giant Sword", "Haunted Blade", "Havoc Blade", "Heavy Machete", "Ice Rapier", "Icy Blacksteel Sword", "Icy Dragon Slayer", "Icy Mystic Blade", "Icy Relic Sword", "Icy Spike Sword", "Incredible Mumpiz Slayer", "Jagged Sword", "Katana", "Knife", "Longsword", "Machete", "Magic Longsword", "Magic Sword", "Mercenary Sword", "Mystic Blade", "Nightmare Blade", "Pharaoh Sword", "Poet's Fencing Quill", "Pointed Rabbitslayer", "Poison Dagger", "Rapier", "Relic Sword", "Ron the Ripper's Sabre", "Runed Sword", "Sabre", "Sais", "Scimitar", "Serpent Sword", "Short Sword", "Silver Dagger", "Spike Sword", "Sword", "Templar Scytheblade", "Thaian Sword", "The Avenger", "The Epiphany", "The Justice Seeker", "Twiceslicer", "Twin Hooks", "Two Handed Sword", "Warlord Sword", "Wyvern Fang", "Zaoan Sword"},
- id = {7404, 7403, 7406, 11693, 7416, 3338, 3295, 3301, 3283, 3292, 7385, 7449, 3267, 7382, 3339, 7402, 782, 783, 781, 780, 779, 8102, 797, 798, 796, 795, 794, 3326, 9386, 663, 664, 662, 661, 660, 3280, 3281, 7407, 7405, 3330, 3284, 682, 683, 681, 680, 679, 9396, 7774, 3300, 3291, 3285, 3308, 3278, 3288, 7386, 7384, 7418, 3334, 9387, 9375, 3299, 3272, 7383, 6101, 7417, 3273, 10389, 3307, 3297, 3294, 3290, 3271, 3264, 3345, 7391, 6527, 8103, 7390, 11657, 10392, 3265, 3296, 7408, 10390},
- atk = {40, 48, 42, 48, 43, 13, 36, 26, 15, 8, 28, 35, 8, 47, 38, 44, 35, 35, 36, 34, 20, 49, 35, 35, 36, 34, 20, 37, 17, 35, 35, 36, 34, 20, 24, 46, 40, 49, 16, 42, 35, 35, 36, 34, 20, 17, 21, 16, 5, 17, 12, 55, 48, 43, 44, 46, 41, 10, 16, 16, 10, 42, 12, 45, 12, 45, 19, 18, 11, 9, 24, 14, 23, 45, 50, 50, 47, 47, 32, 30, 53, 32, 43}
- },
- club = {
- name = {"Abyss Hammer", "Amber Staff", "Arcane Staff", "Banana Staff", "Battle Hammer", "Blessed Sceptre", "Bone Club", "Bonebreaker", "Brutetamer's Staff", "Chaos Mace", "Clerical Mace", "Club", "Club of the Fury", "Cranial Basher", "Crowbar", "Crystal Mace", "Daramanian Mace", "Dark Trinity Mace", "Demonbone", "Diamond Sceptre", "Drachaku", "Dragon Hammer", "Dragonbone Staff", "Earth Clerical Mace", "Earth Cranial Basher", "Earth Crystal Mace", "Earth Orcish Maul", "Earth War Hammer", "Enchanted Staff", "Energy Clerical Mace", "Energy Cranial Basher", "Energy Crystal Mace", "Energy Orcish Maul", "Energy War Hammer", "Fiery Clerical Mace", "Fiery Cranial Basher", "Fiery Crystal Mace", "Fiery Orcish Maul", "Fiery War Hammer", "Furry Club", "Giant Smithhammer", "Glutton's Mace", "Hammer of Prophecy", "Hammer of Wrath", "Heavy Mace", "Icy Clerical Mace", "Icy Cranial Basher", "Icy Crystal Mace", "Icy Orcish Maul", "Icy War Hammer", "Iron Hammer", "Jade Hammer", "Lich Staff", "Light Mace", "Lunar Staff", "Mace", "Mammoth Whopper", "Morning Star", "Northern Star", "Obsidian Truncheon", "Onyx Flail", "Orcish Maul", "Queen's Sceptre", "Sapphire Hammer", "Scythe", "Shadow Sceptre", "Silver Mace", "Skull Staff", "Skullcrusher", "Snake God's Sceptre", "Spiked Squelcher", "Staff", "Stale Bread of Ancientness", "Studded Club", "Taurus Mace", "The Stomper", "Thunder Hammer", "War Hammer"},
- id = {7414, 7426, 3341, 3348, 3305, 7429, 3337, 7428, 7379, 7427, 3311, 3270, 9385, 7415, 3304, 3333, 3327, 8099, 7431, 7387, 10391, 3322, 7430, 789, 791, 790, 792, 793, 3321, 806, 808, 807, 809, 810, 670, 672, 671, 673, 674, 7432, 3208, 9373, 7450, 3332, 3340, 689, 691, 690, 692, 693, 3310, 7422, 3343, 3325, 7424, 3286, 7381, 3282, 7409, 8100, 7421, 7392, 7410, 7437, 3453, 7451, 3312, 3324, 7423, 11692, 7452, 3289, 9376, 3336, 7425, 8101, 3309, 3279},
- atk = {47, 43, 50, 25, 24, 47, 12, 46, 35, 44, 28, 7, 16, 44, 5, 38, 21, 51, 48, 34, 46, 32, 35, 23, 36, 31, 35, 36, 39, 23, 36, 31, 35, 36, 23, 36, 31, 35, 36, 31, 24, 16, 0, 48, 49, 23, 36, 31, 35, 36, 18, 46, 40, 0, 40, 16, 30, 25, 0, 50, 45, 42, 43, 37, 8, 39, 41, 36, 51, 0, 41, 10, 18, 9, 30, 51, 49, 45}
- } }
- function weaponattack(id)
- local handn,hand
- if not id then
- handn, hand = findweapon()
- id = hand.id
- end
- for i,j in ipairs(weapons.axe.id) do
- if hand.id == j then
- return weapons.axe.atk[i]
- end
- end
- for i,j in ipairs(weapons.sword.id) do
- if hand.id == j then
- return weapons.sword.atk[i]
- end
- end
- for i,j in ipairs(weapons.club.id) do
- if hand.id == j then
- return weapons.club.atk[i]
- end
- end
- return 0
- end
- function strikespellinfo(creaturename, strong)
- if creaturename == '' then return nil end
- local swords
- local spells
- if strong then
- swords = 'exori gran '..getelementword(bestelement(creaturename, true))
- spells = {
- {name="strong ice strike", words="exori gran frigo", type="instant", level=80, mp=60, price=6000, premium=true, soul=0, mlevel=0, condition=3},
- {name="strong flame strike", words="exori gran flam", type="instant", level=70, mp=60, price=6000, premium=true, soul=0, mlevel=0, condition=3},
- {name="strong energy strike", words="exori gran vis", type="instant", level=80, mp=60, price=7500, premium=true, soul=0, mlevel=0, condition=3},
- {name="strong terra strike", words="exori gran tera", type="instant", level=70, mp=60, price=6000, premium=true, soul=0, mlevel=0, condition=3},
- }
- else
- swords = 'exori '..getelementword(bestelement(creaturename, false))
- spells = {
- {name="death strike", words="exori mort", type="instant", level=16, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- {name="physical strike", words="exori moe ico", type="instant", level=16, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- {name="ice strike", words="exori frigo", type="instant", level=15, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- {name="flame strike", words="exori flam", type="instant", level=14, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- {name="energy strike", words="exori vis", type="instant", level=12, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- {name="terra strike", words="exori tera", type="instant", level=13, mp=20, price=800, premium=true, soul=0, mlevel=0, condition=3},
- }
- end
- local pos = table.find(spells,swords,'words')
- if not pos then
- if not noalert then printerror("Spell: \'"..name.."\' not found") end
- return
- end
- return spells[pos]
- end
- function cancastspell(spellname, who)
- local needarea,castspellinfo = false
- if type(spellname) == 'string' then
- spellname = spellname:lower()
- if spellname == 'strike' then
- castspellinfo = strikespellinfo(who.name)
- elseif spellname == 'strong strike' then
- castspellinfo = strikespellinfo(who.name,true)
- else
- castspellinfo = spellinfo(spellname)
- end
- elseif type(spellname) == 'table' then
- castspellinfo = spellname
- end
- who = findcreature(who)
- if castspellinfo then
- if who and who.id > 0 and (castspellinfo.condition and castspellinfo.condition ~= 'word') then
- needarea = true
- if $attacked.id == 0 and (table.find({'holy flash', 'divine missile', 'lightning', 'ice strike', 'flame strike', 'terra strike', 'energy strike', 'strong ice strike', 'strong flame strike', 'strong terra strike', 'strong energy strike', 'ultimate ice strike', 'ultimate flame strike', 'ultimate terra strike', 'ultimate energy strike', 'physical strike'}, castspellinfo.name)) then
- castspellinfo.condition = 'strike'
- end
- end
- return ($mp >= castspellinfo.mp and $level >= castspellinfo.level and $mlevel >= castspellinfo.mlevel and $soul >= castspellinfo.soul and cooleddown(castspellinfo.name) and (not needarea or isonspellarea(who,castspellinfo.condition)))
- end
- return false
- end
- function moveitemonground(x,y,z,a,b,c)
- moveitems(topitem(x,y,z).id,ground(a,b,c),ground(x,y,z),100)
- end
- function wheretomoveitemtable(x,y,z,id)
- local dire = {x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
- y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
- local dirs = {'nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se'}
- z = z or $posz
- if not (x or y) or not (x > 0 or y > 0) then
- x,y = $posx,$posy
- end
- local randmove = {}
- for _,p in ipairs(dirs) do
- local i,j = dire.x[p], dire.y[p]
- local dest = {x = x+i, y = y+j}
- local tile = gettile(dest.x, dest.y, z)
- local canmove = true
- local k=1
- if tile.itemcount > 0 then
- while (k <= tile.itemcount) and canmove do
- local itid = tile.item[k].id
- if itid > 0 and ((itemproperty(itid, ITEM_BLOCKWALK) and (not itemproperty(itid, ITEM_TOPORDER2) or not itemproperty(itid, ITEM_HEIGHTED))) or (k == 1 and not itemproperty(itid, ITEM_NOTROOFEDGIron HammerE))) then
- canmove = false
- end
- k = k+1
- end
- else
- canmove = false
- end
- if canmove then
- table.insert(randmove, {p, i, j})
- end
- end
- return randmove
- end
- function wheretomoveitem(x,y,z,id)
- if id and id == 99 then
- return wheretomovecreature(x,y,z)
- end
- z = z or $posz
- local dir
- local randmove = wheretomoveitemtable(x,y,z,id)
- if #randmove > 0 then
- return table.unpack(randmove[math.random(1,#randmove)])
- end
- return '', 0, 0
- end
- function wheretomovecreaturetable(x,y,z,id)
- local dire = {x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
- y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
- local dirs = {'nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se'}
- z = z or $posz
- if not (x or y) or not (x > 0 or y > 0) then
- x,y = $posx,$posy
- end
- local randmove = {}
- for _,p in ipairs(dirs) do
- local i,j = dire.x[p], dire.y[p]
- local dest = {x = x+i, y = y+j}
- if (id ~= 99 or (dest.x ~= $posx or dest.y ~= $posy)) then
- local tile = gettile(dest.x, dest.y, z)
- local canmove = true
- local k=1
- if tile.itemcount > 0 then
- while (k <= tile.itemcount) and canmove do
- local itid = tile.item[k].id
- if itid > 0 and itemproperty(itid,ITEM_BLOCKWALK) or itemproperty(itid, ITEM_BLOCKPATHS) or itemproperty(itid, ITEM_FLOORCHANGE) or itid == 99 then
- canmove = false
- end
- k = k+1
- end
- else
- canmove = false
- end
- if canmove then
- table.insert(randmove, {p, i, j})
- end
- end
- end
- return randmove
- end
- function wheretomovecreature(x,y,z,dir)
- local dire = {dirs = {'c', 'n', 's', 'w', 'e', 'nw', 'ne', 'sw', 'se'},
- x = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1},
- y = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}}
- local dirs = {'nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se'}
- z = z or $posz
- local randmove = {}
- if not dir then
- randmove = wheretomovecreaturetable(x,y,z)
- else
- local i,j = dire.x[dir],dire.y[dir]
- local tile = gettile(x+i,y+j,z)
- local k=1
- local canmove = true
- if tile.itemcount > 0 then
- while (k <= tile.itemcount) and canmove do
- local itid = tile.item[k].id
- if itid > 0 and itemproperty(itid,ITEM_BLOCKWALK) or itemproperty(itid, ITEM_BLOCKPATHS) or itemproperty(itid, ITEM_FLOORCHANGE) or itid == 99 then
- canmove = false
- end
- k = k+1
- end
- else
- canmove = false
- end
- if canmove then
- return dir, i, j
- else
- return '', 0, 0
- end
- end
- if #randmove > 0 then
- return table.unpack(randmove[math.random(1,#randmove)])
- end
- return '', 0, 0
- end
- function movecreature(who, direction)
- if who then
- who = findcreature(who)
- end
- if who.dist > 1 then return false end
- local movecreatureto = {}
- local dir,dirx,diry = wheretomovecreature(who.posx,who.posy,who.posz,direction)
- if dir ~= '' then
- local topid = topitem(who.posx,who.posy,who.posz).id
- movecreatureto = {dirx+who.posx,diry+who.posy,$posz}
- if who.posz == $posz and not (movecreatureto[1] == who.posx and movecreatureto[2] == who.posy) and not (movecreatureto[1] == $posx and movecreatureto[2] == $posy) and (itemproperty(topid,ITEM_GROUND) or itemproperty(topid, ITEM_NOTMOVEABLE)) then
- moveitems(99,ground(table.unpack(movecreatureto)),ground(who.posx,who.posy,who.posz),100) wait(1200,1500)
- end
- end
- end
- function maroundspell(spelltype,direction,...)
- local monsters = {...}
- local dirs = {'w', 'e', 's', 'n', 'any'}
- table.lower(monsters)
- if type(direction) == 'string' then
- if not table.find(dirs,direction) then
- table.insert(monsters,direction:lower())
- direction = $self.dir
- end
- elseif not direction then
- direction = $self.dir
- end
- local count = 0
- foreach creature m 'mf' do
- if isonspellarea(m,spelltype,direction) and (#monsters == 0 or table.findcreature(monsters,m)) then
- count = count+1
- end
- end
- return count
- end
- function paroundspell(spelltype,direction,...)
- local players = {...}
- local dirs = {'w', 'e', 's', 'n', 'any'}
- table.lower(players)
- if type(direction) == 'string' then
- if not table.find(dirs,direction) then
- table.insert(players,direction:lower())
- direction = $self.dir
- end
- elseif not direction then
- direction = $self.dir
- end
- local count = 0
- foreach creature p 'pf' do
- if p ~= $self and isonspellarea(p,spelltype,direction) and (#players == 0 or table.findcreature(players,p)) then
- count = count+1
- end
- end
- return count
- end
- function maroundspellignore(spelltype,direction,...)
- local monsters = {...}
- local dirs = {'w', 'e', 's', 'n', 'any'}
- table.lower(monsters)
- if type(direction) == 'string' then
- if not table.find(dirs,direction) then
- table.insert(monsters,direction:lower())
- direction = $self.dir
- end
- elseif not direction then
- direction = $self.dir
- end
- local count = 0
- foreach creature m 'mf' do
- if isonspellarea(m,spelltype,direction) and (#monsters == 0 or not table.findcreature(monsters,m)) then
- count = count+1
- end
- end
- return count
- end
- function paroundspellignore(spelltype,direction,...)
- local players = {...}
- local dirs = {'w', 'e', 's', 'n', 'any'}
- table.lower(players)
- if type(direction) == 'string' then
- if not table.find(dirs,direction) then
- table.insert(players,direction:lower())
- direction = $self.dir
- end
- elseif not direction then
- direction = $self.dir
- end
- local count = 0
- foreach creature p 'pf' do
- if p ~= $self and isonspellarea(p,spelltype,direction) and (#players == 0 or not table.findcreature(players,p)) then
- count = count+1
- end
- end
- return count
- end
- function potionfriend(id,pc,dist,...)
- local friends,toheal = {findcreature(...)}
- if type(id) == 'string' then
- id = itemid(id)
- elseif type(id) == 'number' and id <= 100 and id > 0 then
- table.insert(friends,1,findcreature(dist))
- dist = pc
- pc = id
- id = nil
- end
- if not id then
- local potions = {
- {id = 7643, level = 130},
- {id = 239, level = 80},
- {id = 236, level = 50},
- {id = 266, level = 0}
- }
- for i,j in ipairs(potions) do
- if itemcount(j.id) > 0 and $level >= j.level then
- id = j.id
- break
- end
- end
- end
- if type(pc) ~= 'number' or pc < 0 or pc > 100 then
- pc = 95
- end
- if type(dist) ~= 'number' or dist > 7 then
- dist = 1
- end
- table.newsort(friends,'hppc','desc')
- for i,j in ipairs(friends) do
- if j.dist <= dist then
- if j.hppc < pc or (j.hppc == pc and (not toheal or j.dist < toheal.dist)) then
- toheal = j
- pc = j.hppc
- else
- break
- end
- end
- end
- if toheal then
- useoncreature(id,toheal)
- return true
- end
- return false
- end
- function currenttime()
- return os.date('%X')
- end
- function tosec(t)
- t = t or os.date('%X')
- if type(t) ~= 'string' then
- return 0
- end
- local temp = t:token(nil,':')
- local temp2 = tonumber(temp[1])*3600+tonumber(temp[2])*60
- if temp[3] then
- temp2 = temp2+tonumber(temp[3])
- end
- return temp2
- end
- function allowwalk(...)
- local t = {...}
- local walk = getsetting('Cavebot/Pathfinding/WalkableIds')
- for i,j in ipairs(t) do
- walk = walk..' '..j
- end
- setsetting('Cavebot/Pathfinding/WalkableIds',walk)
- end
- function waitping(a,b) --credits to Hardek
- a,b=a or 1.6,b or 1.9
- local p = $pingaverage
- if p == 0 then p = 150 end
- wait(p*a,p*b)
- end
- function playsoundflash(p)
- playsound(p)
- flashclient()
- end
- function finditem(a, contstart)
- a=itemid(a)
- contstart = contstart or 0
- local wheretosearch = {{'neck', $neck}, {'head', $head}, {'back', $back}, {'rhand', $rhand}, {'chest', $chest}, {'lhand', $lhand}, {'finger', $finger}, {'feet', $feet}, {'belt', $belt}}
- if itemcount(a) == 0 then
- return
- end
- for i,j in ipairs(wheretosearch) do
- if j[2].id == a then
- return j[1], j[2]
- end
- end
- for i=contstart, 15 do
- local cont = getcontainer(i)
- for j=1, cont.itemcount do
- if cont.item[j].id == a then
- return tostring(i)
- end
- end
- end
- end
- function isdistance(x,y,z)
- x = x or 7
- y = y or x
- z = z or 0
- return math.abs($posx-$wptx) <= x and math.abs($posy-$wpty) <= y and math.abs($posz-$wptz) <= z
- end
- function islocation(x)
- x = x or 0
- return math.abs($posx-$wptx) <= x and math.abs($posy-$wpty) <= x and $posz == $wptz
- end
- function isrange(x,y)
- x = x or 1
- y = y or 1
- return $posx <= $wptx+x and $posx >= $wptx and $posy <= $wpty+y and $posy >= $wpty and $posz == $posz
- end
- function isposition(x,y,z)
- if not (x and y) then
- return false
- end
- z = z or false
- return $posx == x and $posy == y and $posz == z
- end
- function waitcontainer(containername, newwindow)
- if newwindow or not containername then
- local i = $timems + 2000
- local curcount = windowcount(containername)
- while i >= $timems and windowcount(containername) == curcount do
- wait(100)
- end
- else
- local containernumber = tonumber(containername)
- if not containernumber then
- local i = $timems + 2000
- local curcount = windowcount(containername)
- while i >= $timems and windowcount(containername) == curcount do
- wait(100)
- end
- else
- local cont = {}
- copycontainer(getcontainer(containernumber),cont)
- local i = $timems+2000
- local compare = true
- while i >= $timems and compare do
- wait(200)
- compare = comparecontainers(cont, getcontainer(containernumber))
- end
- end
- end
- end
- function copycontainer(cont1, cont2)
- cont2 = cont2 or {}
- cont2.name = cont1.name
- cont2.itemid = cont1.itemid
- cont2.maxcount = cont1.maxcount
- cont2.itemcount = cont1.itemcount
- cont2.isopen = cont1.isopen
- cont2.hashigher = cont1.hashigher
- cont2.item = {}
- for i = 1, cont1.itemcount do
- cont2.item[i] = {id = cont1.item[i].id, count = cont1.item[i].count}
- end
- end
- function comparecontainers(cont1, cont2)
- if cont1.isopen and cont2.isopen then
- if cont2.itemcount ~= cont1.itemcount or cont2.itemid ~= cont1.itemid or cont2.maxcount ~= cont1.maxcount or cont2.hashigher ~= cont1.hashigher then
- return false
- end
- for i=1, cont1.itemcount do
- if cont1.item[i].id ~= cont2.item[i].id or cont1.item[i].count ~= cont2.item[i].count then
- return false
- end
- end
- else
- return 'Error'
- end
- return true
- end
- function num(a)
- if type(a) == 'number' then
- local sign = ''
- a=tostring(math.floor(a))
- if a:sub(1,1) == '-' then
- a = a:sub(2)
- sign = '-'
- end
- local size = a:len()
- local p = ''
- while size > 0 do
- if size-2 > 0 then
- p=a:sub(size-2,size)..','..p
- else
- p=a:sub(1,size)..','..p
- end
- size=size-3
- end
- return sign..p:sub(1,p:len()-1)
- else
- printerror('Bad argument #1 to \'num\' (number expected, got '..type(a)..')')
- return ''
- end
- end
- function string:attackername(returntype)
- dmg, name = self:match("You lose (%d-) .+ due to an attack by (.-)%.")
- if not name then return end
- local mtype = 'player'
- if name:sub(1,2) == 'a ' then
- name = name:sub(3)
- mtype = 'monster'
- elseif name:sub(1,3) == 'an ' then
- name = name:sub(4)
- mtype = 'monster'
- end
- if returntype then
- if returntype == 'name' then
- return name
- elseif returntype == 'type' then
- return mtype
- elseif returntype == 'dmg' then
- return tonumber(dmg)
- end
- end
- return name, mtype, tonumber(dmg)
- end
- function math:positive()
- if self < 0 then
- return 0
- end
- return self
- end
- function openbps(...)
- local bps = {...}
- for i,j in ipairs(bps) do
- openitem(j[1],j[2],j[3],j[4]) waitcontainer()
- resizewindows()
- end
- end
- function openbpslogin(...)
- local bps = {...}
- if not $connected then
- while not $connected do
- wait(300)
- end
- for i,j in ipairs(bps) do
- openitem(j[1],j[2],j[3],j[4]) waitcontainer()
- resizewindows()
- end
- end
- end
- function cooleddown(p)
- return cooldown(p) <= $pingaverage*tonumber(getsetting('Healer/Settings/PingCompensation'))/100
- end
- function mounting(p)
- p = p or $self
- return p.mount > 0
- end
- function vocation()
- local weapontype = ''
- local voc = 'unknown'
- local vocs = {mage = 5, paladin = 10, knight = 15}
- for i,j in pairs(vocs) do
- if ($maxhp-185)/($level-8) == j then
- voc = i
- break
- end
- end
- if voc == 'mage' then
- for i,j in ipairs(rods) do
- if j == $lhand.id or j == $rhand.id then
- return 'druid'
- end
- end
- for i,j in ipairs(wands) do
- if j == $lhand.id or j == $rhand.id then
- return 'sorcerer'
- end
- end
- end
- return voc
- end
- function bestelementweapon(creaturename) --based on Hardek's bestelement function
- local wands = {fire = {{3071, 65}, {8093, 30}, {3075, 19}}, energy = {{8092, 65}, {3073, 45}, {3074, 13}}, death = {{8094, 65}, {3072, 30}}}
- local rods = {ice = {{3067, 65}, {8083, 30}, {3070, 19}}, earth = {{8084, 65}, {3065, 45}, {3066, 13}}, death = {{8082, 65}, {3069, 30}}}
- if creaturename == '' then return 0, '' end
- local cre = creatureinfo(creaturename)
- local voc = vocation()
- if voc == 'sorcerer' then
- local best = ''
- local max = 0
- local wandsonbp = {fire = {0, 0}, energy = {0, 0}, death = {0, 0}}
- for i,j in pairs(wands) do
- for a,b in ipairs(j) do
- if itemcount(b[1]) > 0 then
- wandsonbp[i] = b
- break
- end
- end
- end
- for i,j in pairs(wandsonbp) do
- if j[1] > 0 and (cre[i..'mod']/100)*j[2] > max then
- max = cre[i..'mod']
- best = i
- end
- end
- return wandsonbp[best][1], best
- elseif voc == 'druid' then
- local best = ''
- local max = 0
- local wandsonbp = {ice = {0, 0}, earth = {0, 0}, death = {0, 0}}
- for i,j in pairs(rods) do
- for a,b in ipairs(j) do
- if itemcount(b[1]) > 0 then
- wandsonbp[i] = b
- break
- end
- end
- end
- for i,j in pairs(wandsonbp) do
- if j[1] > 0 and (cre[i..'mod']/100)*j[2] > max then
- max = cre[i..'mod']
- best = i
- end
- end
- return wandsonbp[best][1], best
- end
- return 0, ''
- end
- function string:concat(...)
- local words = {...}
- local ret = self
- for i=1,#words do
- ret = ret..' '..tostring(words[i])
- end
- return ret
- end
- function waitmessage(sender, msg, maxwaittime, exact, channel)
- sender = sender:lower()
- maxwaittime = maxwaittime or 10000
- if not exact then
- msg = msg:lower()
- end
- local time = 0
- local msgrecieved = false
- while time < maxwaittime do
- foreach newmessage m do
- if (m.sender:lower() == sender or sender == '') and (not channel or m.type == channel) then
- local mcontent = m.content
- if not exact then
- mcontent = mcontent:lower()
- if mcontent:find(msg) then
- return true
- end
- elseif msg == mcontent then
- return true
- end
- end
- end
- time = time+200
- wait(200)
- end
- return false
- end
- function searchcontainerincontainer(bpnumber)
- if not bpnumber then return false end
- local temp = getcontainer(bpnumber)
- for i=temp.itemcount, 1, -1 do
- if itemproperty(temp.item[i].id, ITEM_CONTAINER) then
- return temp.item[i].id
- end
- end
- return false
- end
- function iscontainerfull(bpnumber)
- if not bpnumber then return true end
- local temp = getcontainer(bpnumber)
- return temp.maxcount == temp.itemcount
- end
- function excludecontainerid(bpnumber)
- local ret = '0-15'
- if type(bpnumber) ~= 'number' then
- return ret
- end
- if bpnumber == 0 then
- ret = '1-15'
- elseif bpnumber == 1 then
- ret = '0 '..'2-15'
- elseif bpnumber == 14 then
- ret = '0-13 '..'15'
- elseif bpnumber >= 15 then
- ret = '0-14'
- else
- ret = '0-'..(bpnumber-1)..' '..(bpnumber+1)..'-15'
- end
- return ret
- end
- function itemcountignore(iid, bpnumber)
- local count = 0
- iid = itemid(iid)
- for i=0, 15 do
- if i ~= bpnumber then
- local cont = getcontainer(i)
- if cont.isopen then
- for j=1, cont.itemcount do
- if cont.item[j].id == iid then
- count = count+cont.item[j].count
- end
- end
- end
- end
- end
- return count
- end
- function totalitemsignore(location, ...)
- local itemlist = {...}
- if type(location) ~= 'string' then
- table.insert(itemlist,location)
- location = ''
- end
- local total = 0
- for i,j in ipairs(itemlist) do
- total = total+itemcountignore(j,location)
- end
- return total
- end
- function trueitemproperties(iid, upper)
- iid = itemid(iid)
- local properties = {ITEM_NOTROOFEDGE = 0, ITEM_TOPORDER1 = 1,ITEM_TOPORDER2 = 2,ITEM_TOPORDER3 = 3,ITEM_CONTAINER = 4,ITEM_STACKABLE = 5,ITEM_CORPSE = 6,ITEM_USEABLE = 7,ITEM_WRITEABLE = 8,ITEM_READABLE = 9,ITEM_FLUIDCONTAINER = 10,ITEM_SPLASH = 11,ITEM_BLOCKWALK = 12,ITEM_NOTMOVEABLE = 13,ITEM_BLOCKSHOTS = 14,ITEM_BLOCKPATHS = 15,ITEM_PICKUPABLE = 16,ITEM_HANGABLE = 17,ITEM_HORIZONTAL = 18,ITEM_VERTICAL = 19,ITEM_ROTATEABLE = 20,ITEM_LIGHTFONT = 21,ITEM_UNKNOWN = 22,ITEM_FLOORCHANGE = 23,ITEM_OFFSET = 24,ITEM_HEIGHTED = 25,ITEM_BIGSPRITE = 26,ITEM_UNEXIST = 27,ITEM_MINIMAP = 28,ITEM_ACTION = 29,ITEM_GROUND = 30,ITEM_BORDER = 31}
- local ret = {}
- for i,j in pairs(properties) do
- if itemproperty(iid,j) then
- if upper then
- table.insert(ret, i)
- else
- table.insert(ret, i:sub(6):lower())
- end
- end
- end
- local ret2 = ret[1]
- for i=2, #ret do
- ret2 = ret2..', '..ret[i]
- end
- return ret2
- end
- function sameproperties(prop,notprop)
- local properties = {}
- local p = {}
- local notproperties = notprop or {}
- if type(prop) ~= 'table' then
- prop = itemid(prop)
- for i=0, 31 do
- if itemproperty(prop, i) then
- table.insert(properties, i)
- end
- end
- else
- properties = prop
- end
- if type(notprop) == 'string' and notprop == 'all' then
- notproperties = {}
- for i=0, 31 do
- if not table.find(properties,i) then
- table.insert(notproperties, i)
- end
- end
- end
- for i=1, 15000 do
- local t = true
- for a,b in ipairs(properties) do
- if not itemproperty(i, b) then
- t = false
- break
- end
- end
- for a,b in ipairs(notproperties) do
- if itemproperty(i, b) then
- t = false
- break
- end
- end
- if t then
- table.insert(p, i)
- end
- end
- print(p)
- end
- function mwall(targetid, dist)
- dist = dist or 2
- local dir = {x = {n = 0, s = 0, w = -1*dist, e = 1*dist},
- y = {n = -1*dist, s = 1*dist, w = 0, e = 0}}
- targetid = findcreature(targetid)
- if targetid.id ~= 0 then
- local pos = {targetid.posx + dir.x[targetid.dir], targetid.posy + dir.y[targetid.dir], targetid.posz}
- useitemon(3180, topitem(table.unpack(pos)).id, ground(table.unpack(pos))) wait(300)
- end
- end
- _MOVEITEMS = _MOVEITEMS or moveitems
- function moveitems(iid, dest, from, amount)
- dest, from = dest or '', from or ''
- local temp = getsetting('Cavebot/Looting/MoveItemsQuickly')
- if amount and amount < 100 then
- setsetting('Cavebot/Looting/MoveItemsQuickly', 'no', false)
- end
- if dest == 'ground' and from:sub(1,6) == 'ground' then
- local temp = from:token()
- local pos
- if temp[2] then
- pos = {tonumber(temp[2]), tonumber(temp[3]), tonumber(temp[4])}
- else
- pos = {$posx,$posy,$posz}
- end
- local dir, dirx, diry = wheretomoveitem(pos[1],pos[2],pos[3], iid)
- if dir ~= '' then
- dest = ground(pos[1]+dirx,pos[2]+diry,pos[3])
- end
- end
- local ret = _MOVEITEMS(iid, dest, from, amount)
- setsetting('Cavebot/Looting/MoveItemsQuickly', temp, false)
- return ret
- end
- _EQUIPITEM = _EQUIPITEM or equipitem
- function equipitem(iid, dest, from, amount)
- dest, from = dest or '', from or ''
- local temp = getsetting('Cavebot/Looting/MoveItemsQuickly')
- if amount and amount < 100 then
- setsetting('Cavebot/Looting/MoveItemsQuickly', 'no', false)
- end
- local ret = _EQUIPITEM(iid, dest, from, amount)
- setsetting('Cavebot/Looting/MoveItemsQuickly', temp, false)
- return ret
- end
- _GETTILE = _GETTILE or gettile
- function gettile(x,y,z)
- x,y,z = x or $posx, y or $posy, z or $posz
- local dz = 2*(z-$posz)
- return _GETTILE(x+dz,y+dz,z)
- end
- _TOPITEM = _TOPITEM or topitem
- function topitem(x,y,z)
- x,y,z = x or $posx, y or $posy, z or $posz
- local dz = 2*(z-$posz)
- local ret = _TOPITEM(x+dz,y+dz,z)
- if itemproperty(ret.id,ITEM_TOPORDER3) then
- local tileinfo = gettile(x+dz,y+dz,z)
- local pos = 1
- while pos <= tileinfo.itemcount and tileinfo.item[pos].id ~= ret.id do
- pos = pos+1
- end
- for i=pos+1, tileinfo.itemcount do
- if tileinfo.item[i].id ~= 99 then
- ret = tileinfo.item[i]
- end
- end
- end
- return ret
- end
- _PRINT = _PRINT or print
- function print(...)
- local msgs = {...}
- local toprint = ''
- for i,j in ipairs(msgs) do
- if type(j) == 'table' then
- toprint = toprint..table.stringformat(j)..' '
- else
- toprint = toprint..tostring(j)..' '
- end
- end
- _PRINT(toprint:sub(1, #toprint-1))
- end
- _PRINTERROR = _PRINTERROR or printerror
- function printerror(...)
- local msgs = {...}
- local toprint = ''
- for i,j in ipairs(msgs) do
- if type(j) == 'table' then
- toprint = toprint..table.stringformat(j)..' '
- else
- toprint = toprint..tostring(j)..' '
- end
- end
- _PRINTERROR(toprint:sub(1, #toprint-1))
- end
- _LISTAS = _LISTAS or listas
- function listas(...)
- local msgs = {...}
- local toprint = ''
- for i,j in ipairs(msgs) do
- if type(j) == 'table' then
- toprint = toprint..table.stringformat(j)..' '
- else
- toprint = toprint..tostring(j)..' '
- end
- end
- _LISTAS(toprint:sub(1, #toprint-1))
- end
- function areitemsontile(x,y,z,considercap,considermoveable,...) --some credits to golfinhu for considermoveable
- if not (x and y and z) then
- printerror('You must give the coordinates to check for items.')
- return false
- end
- local items = {...}
- local temp = type(considercap)
- if temp == 'string' or (temp == 'number' and temp > 1000) then
- table.insert(items,temp)
- end
- if type(considermoveable) ~= 'boolean' then
- table.insert(items, considermoveable)
- end
- table.id(items)
- if x < 10 or y < 10 then
- x = $posx-x
- y = $posy-y
- z = $posz-z
- end
- table.id(items)
- local tile = gettile(x,y,z)
- for i=2, tile.itemcount do
- temp = tile.item[i].id
- if considermoveable and itemproperty(temp,ITEM_NOTMOVEABLE) and not itemproperty(temp,ITEM_SPLASH) and not itemproperty(temp,ITEM_TOPORDER1) then
- return false
- end
- if table.find(items,temp) and (not considercap or (type(considercap) == 'boolean' and $cap >= itemweight(temp)) or (type(considercap) == 'number' and $cap >= considercap)) then
- return true
- end
- end
- return false
- end
- function collecthiddenitems(dist,...)
- local items = {...}
- if not dist then
- dist = 10
- elseif (type(dist) == 'number' and dist > 100) or (type(dist) == 'string') then
- table.insert(items, dist)
- dist = 10
- end
- table.id(items)
- local i,j
- for a=0, dist do
- j = -a
- while j <= a do
- i = -a
- while i <= a do
- local pos = {$posx+i,$posy+j,$posz}
- if tilehasinfo(table.unpack(pos)) and tilereachable(table.unpack(pos)) then
- local tile = gettile(table.unpack(pos))
- local found = 0
- for p=1, tile.itemcount do
- if table.find(items, tile.item[p].id) and $cap >= itemweight(tile.item[p].id) then
- found = p
- end
- if itemproperty(tile.item[p].id, ITEM_NOTMOVEABLE) then
- found = 0
- end
- end
- if found > 0 then
- local topick = tile.item[found].id
- reachlocation(table.unpack(pos))
- local topid = topitem(table.unpack(pos)).id
- while topid ~= topick and isitemontile(topick, table.unpack(pos)) do
- moveitems(topid, 'ground', ground(table.unpack(pos)), 100) waitping()
- topid = topitem(table.unpack(pos)).id
- end
- moveitems(topick, '', ground(table.unpack(pos)), 100)
- return true
- end
- end
- if j ~= a and j ~= -a then
- i = i+a*2
- else
- i = i+1
- end
- end
- j = j+1
- end
- end
- end
- --[[
- function collecthiddenitems(dist,considercap,...)
- local items = {...}
- if type(dist) ~= 'number' then
- table.insert(items, itemid(dist))
- dist = 7
- elseif dist > 10 then
- table.insert(items, dist)
- dist = 7
- end
- if type(considercap) == 'number' then
- if considercap < 1000 then
- if $cap < considercap then return false end
- else
- table.insert(items, considercap)
- end
- elseif type(considercap) == 'string' then
- table.insert(items, itemid(considercap))
- elseif type(considercap) ~= 'boolean' then
- considercap = true
- end
- table.id(items)
- for j=-dist,dist do
- for i=-dist,dist do
- local pos = {$posx+i,$posy+j,$posz}
- if tilehasinfo(table.unpack(pos)) and areitemsontile(table.unpack(pos),considercap,table.unpack(items)) and tilereachable(table.unpack(pos)) then
- local topid = topitem(table.unpack(pos)).id
- if not itemproperty(topid, ITEM_NOTMOVEABLE) then
- pausewalking(0)
- return false
- end
- pausewalking(40000)
- reachlocation(table.unpack(pos))
- repeat
- while not table.find(items,topid) do
- local temp = {wheretomoveitem(table.unpack(pos),topid)}
- moveitems(topid, ground(pos[1]+temp[2],pos[2]+temp[3],z), ground(table.unpack(pos)), 100) waitping()
- topid = topitem(table.unpack(pos)).id
- end
- moveitems(topid,'backpack',ground(table.unpack(pos)), 100) waitping()
- until not areitemsontile(table.unpack(pos),considercap,table.unpack(items))
- end
- end
- end
- pausewalking(0)
- end
- --]]
- function returnwpt(n)
- if not $wptid then return false end
- n = n or 1
- gotolabel(math.positive($wptid-n))
- end
- function castspell(spellname, who)
- if type(spellname) ~= 'table' then
- spellname = spellinfo(spellname)
- end
- if cancastspell(spellname, who) then
- cast(spellname.words)
- return true
- end
- return false
- end
- function tilehasinfo(x,y,z)
- x = x-$posx
- y = y-$posy
- return (x <= SCREEN_RIGHT and x >= SCREEN_LEFT and y >= SCREEN_TOP and y <= SCREEN_BOTTOM and z == $posz)
- end
- function eatfoodfull(location, ...)
- while true do
- if not eatfood(location, ...) then
- return false
- end
- waitping()
- foreach newmessage m do
- if m.type == MSG_STATUS and m.content == 'You are full.' then
- return true
- end
- end
- end
- end
- function getfoodtime(id)
- id = itemid(id)
- local pos = bin2(foods, id, 1)
- if pos then
- return foods[pos][2]*1000
- end
- end
- function increasehungrytime(amount)
- amount = amount or 0
- if GLOBAL_HUNGRY == 0 or GLOBAL_HUNGRY < $timems then
- GLOBAL_HUNGRY = $timems + amount
- else
- GLOBAL_HUNGRY = GLOBAL_HUNGRY + amount
- end
- end
- function resethungrytime()
- GLOBAL_HUNGRY = 0
- end
- function gethungrytime()
- local temp = GLOBAL_HUNGRY-$timems
- if temp > 1200000 then
- return 1200000
- elseif temp < 0 then
- return 0
- else
- return temp
- end
- end
- function eatfood(location, ...)
- location = location or ''
- local foodtable = {3583, 3731, 3726, 3582, 3725, 3593, 3589, 12310, 3580, 3594, 3577, 3586, 3729, 3578, 8010, 3579, 3600, 3727, 3592, 3597, 3723, 3607, 5678, 3587, 3602, 3728, 3606, 3596, 3585, 3595, 3732, 3584, 3724, 3581, 3601, 3730, 3599, 3598, 3591, 3590, 3588}
- if (type(location) == 'number') then
- if location <= 15 then
- location = tostring(location)
- else
- foodtable = {location, ...}
- location = ''
- end
- elseif select("#", ...) > 0 then
- foodtable = {...}
- end
- if location == 'ground' then
- local foundfood = false
- for j=-1, 1 do
- for i=-1, 1 do
- local topid = topitem($posx+i, $posy+j, $posz).id
- local foodtime = getfoodtime(topid)
- if isfood(topid) and foodtime+gethungrytime() <= 1200000 then
- useitem(topid, ground($posx+i, $posy+j, $posz)) wait(100) increasehungrytime(foodtime) return true
- end
- end
- end
- elseif location:sub(1,6) == 'ground' then
- local coord = (location:sub(8)):token()
- coord[1],coord[2],coord[3] = tonumber(coord[1]),tonumber(coord[2]),tonumber(coord[3])
- local topid = topitem(table.unpack(coord)).id
- local foodtime = getfoodtime(topid)
- if isfood(topid) and foodtime+gethungrytime() <= 1200000 then
- useitem(topid, ground(table.unpack(coord))) increasehungrytime(foodtime) wait(100) return true
- end
- else
- for i,j in ipairs(foodtable) do
- local foodtime = getfoodtime(j)
- if itemcount(j, location) > 0 and foodtime+gethungrytime() <= 1200000 then
- useitem(j, location) increasehungrytime(foodtime) wait(100) return true
- end
- end
- end
- return false
- end
- function islocker(id)
- id = itemid(id)
- if id >= 3497 and id <= 3500 then
- return true
- end
- return false
- end
- function opendepot2(...)
- local itemtable = {...}
- table.id(itemtable)
- local walktrough = getsetting('Cavebot/Pathfinding/WalkThroughPlayers')
- setsetting('Cavebot/Pathfinding/WalkThroughPlayers', 'no', false)
- local tries, dppos, dpid = 0
- repeat
- for j=-6, 7 do
- for i=-8, 9 do
- local pos = {$posx+i, $posy+j, $posz}
- local topid = topitem(table.unpack(pos)).id
- if topid >= 3497 and topid <= 3500 and tilereachable(table.unpack(pos)) then
- reachlocation(table.unpack(pos))
- if math.abs(pos[1]-$posx) <= 1 and math.abs(pos[2]-$posy) <= 1 and $posz == pos[3] then
- dppos = pos
- dpid = topid
- break
- end
- end
- end
- if dpid then break end
- end
- if dpid then break end
- wait(500)
- tries = tries+1
- until tries > 5
- if not dpid then
- return false
- end
- setsetting('Cavebot/Pathfinding/WalkThroughPlayers', walktrough, false)
- tries = 0
- repeat
- openitem(dpid, ground(table.unpack(dppos))) waitcontainer('Locker')
- if windowcount('Locker') == 0 then
- local topid = topitem(table.unpack(dppos)).id
- while topid ~= dpid do
- local dir, dirx, diry = wheretomoveitem(x,y,z,topid)
- if not table.find(itemtable, topid) then
- moveitems(topid, ground($posx+dirx, $posy+diry, $posz), ground(table.unpack(dppos)), 100)
- else
- moveitems(topid, 'backpack', ground(table.unpack(dppos)), 100)
- end
- wait(100)
- topid = topitem(table.unpack(dppos)).id
- end
- else
- return true
- end
- wait(100)
- tries = tries+1
- until windowcount('Locker') > 0 or tries > 5
- end
- function waitandlogout()
- while $connected do
- while $battlesigned do
- foreach creature m 'ms' do
- if iscreaturereachable(m) then
- setattackmode('none', 'chase')
- attack(m)
- break
- end
- end
- pausewalking(300)
- wait(100)
- end
- logout()
- wait(100)
- end
- end
- function opengrounditem(id)
- if id then
- id = itemid(id)
- end
- for i=SCREEN_LEFT, SCREEN_RIGHT do
- for j=SCREEN_TOP, SCREEN_BOTTOM do
- local x,y,z = $posx+i, $posy+j, $posz
- local topid = topitem(x,y,z).id
- if tilereachable(x,y,z) and (not id and itemproperty(topid, ITEM_ISCONTAINER)) or topid == id then
- reachlocation(x,y,z)
- openitem(topid, ground(x,y,z)) waitcontainer() return true
- end
- end
- end
- return false
- end
- function getbpindex(bpcolor) --by golfinhu
- local bpcolors = {'beach', 'blue', 'brocade', 'brown', 'camouflage', 'crown', 'demon', 'dragon', 'expedition', 'fur', 'golden', 'green', 'grey', 'heart', 'holding', 'minotaur', 'moon', 'orange', 'pirate', 'purple', 'red', 'santa', 'yellow', 'jewelled'}
- local bpcolor = bpcolor:lower()
- if bpcolor:find('holding') then
- bpcolor = 'holding'
- elseif bpcolor:token(1) == 'backpack' then
- bpcolor = 'brown'
- end
- local color = bpcolor:token(1)
- if not table.find(bpcolors, color) then
- printerror('Bp color not valid')
- return false
- end
- local bps = {}
- for i = 0, windowcount() - 1 do
- local bpname = getcontainer(i).name:lower()
- if bpname == 'backpack of holding' then
- bpname = 'holding backpack'
- elseif bpname == 'backpack' then
- bpname = 'brown backpack'
- end
- if bpname == color..' backpack' then
- if color == 'holding' then
- table.insert(bps, 'backpack of holding '..i)
- else
- table.insert(bps, color..' backpack '..i)
- end
- end
- end
- return bps
- end
- -- get the index of the backpack name --
- function closebpcolor(bpcolor, indexs, indexe) --by golfinhu
- if not bpcolor then
- return false
- elseif not indexs then
- if bpcolor:find('holding') then
- return closewindows('backpack of holding')
- else
- return closewindows(bpcolor:token(1)..' backpack')
- end
- end
- local indexe = indexe or indexs
- local indexs, indexe = tonumber(indexs) + 1, tonumber(indexe) + 1
- local index = getbpindex(bpcolor)
- if table.isempty(index) or #index < indexs then return false end
- for i = indexs, math.lowest(indexe,#index) do
- closewindows(index[i])
- end
- end
- -- close the specified backpack name using index by name --
- function itemcountcorpse(corpse,...) --by golfinhu
- local itemlist = {...}
- if not corpse or #itemlist == 0 then return 0 end
- corpse = corpse:lower()
- if corpse:sub(1,4) ~= 'dead' then
- corpse = 'dead '..corpse
- end
- local total = 0
- for i = 0, windowcount() - 1 do
- local container = getcontainer(i).name:lower()
- if (corpse == 'dead' and container:find('dead')) or container == corpse then
- total = total + totalitems(tostring(i),table.unpack(itemlist))
- end
- end
- return total
- end
- function moveitemsfromcorpse(corpse,dest,amount,...) --by golfinhu
- local itemlist = {...}
- if type(dest) == 'number' then
- table.insert(itemlist,dest)
- dest = ''
- end
- if type(amount) == 'number' and amount > 100 or type(amount) == 'string' then
- table.insert(itemlist,amount)
- amount = 100
- end
- if not corpse or #itemlist == 0 then return false end
- local corpse = corpse:lower()
- local corpsetoken = corpse:token()
- if corpsetoken[1] ~= 'dead' then
- corpse = 'dead '..table.concat(corpsetoken, " ")
- end
- for i = 0, windowcount() - 1 do
- local container = getcontainer(i).name:lower()
- if (corpse == 'dead' and container:find('dead')) or container == corpse then
- for a,b in ipairs(itemlist) do
- if itemcount(b,i) > 0 then
- moveitems(b, dest, tostring(i), amount)
- end
- end
- end
- end
- end
- function string:removews() --by golfinhu
- self = self:gsub("^%s*", "")
- self = self:gsub("%s*$", "")
- return self:gsub(" +", " ")
- end
- function string:attackmsg()
- local ttable = {dmg = 0, dealer = {name = '', type = ''}, target = {name = '', type = ''}}
- ttable.dmg, ttable.dealer.name = self:match('You lose (%w+) .+ due to an attack by (.+)%.')
- if ttable.dmg then
- ttable.target = {name = $name, type = 'player'}
- if ttable.dealer.name:sub(1,2) == 'a ' then
- ttable.dealer = {name = ttable.dealer.name:sub(3), type = 'monster'}
- elseif ttable.dealer.name:sub(1,3) == 'an ' then
- ttable.dealer = {name = ttable.dealer.name:sub(4), type = 'monster'}
- elseif ttable.dealer.name:sub(1,4) == 'the ' then
- ttable.dealer = {name = ttable.dealer.name:sub(4), type = 'monster'}
- else
- ttable.dealer.type = 'player'
- end
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.target.name, ttable.dmg = self:match('(.+) loses (%w+) .+ due to your attack%.')
- if ttable.dmg then
- ttable.dealer = {name = $name, type = 'player'}
- if ttable.target.name:sub(1,2) == 'A ' then
- ttable.target = {name = ttable.target.name:sub(3), type = 'monster'}
- elseif ttable.target.name:sub(1,3) == 'An ' then
- ttable.target = {name = ttable.target.name:sub(4), type = 'monster'}
- elseif ttable.target.name:sub(1,4) == 'The ' then
- ttable.target = {name = ttable.target.name:sub(4), type = 'monster'}
- else
- ttable.target.type = 'player'
- end
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.target.name, ttable.dmg, ttable.dealer.name = self:match('(.+) loses (%w+) .+ due to an attack by (.+)%.')
- if ttable.dmg then
- if ttable.dealer.name:sub(1,2) == 'a ' then
- ttable.dealer = {name = ttable.dealer.name:sub(3), type = 'monster'}
- elseif ttable.dealer.name:sub(1,3) == 'an ' then
- ttable.dealer = {name = ttable.dealer.name:sub(4), type = 'monster'}
- elseif ttable.dealer.name:sub(1,4) == 'the ' then
- ttable.dealer = {name = ttable.dealer.name:sub(5), type = 'monster'}
- else
- ttable.dealer.type = 'player'
- end
- if ttable.target.name:sub(1,2) == 'A ' then
- ttable.target = {name = ttable.target.name:sub(3), type = 'monster'}
- elseif ttable.target.name:sub(1,3) == 'An ' then
- ttable.target = {name = ttable.target.name:sub(4), type = 'monster'}
- elseif ttable.target.name:sub(1,4) == 'The ' then
- ttable.target = {name = ttable.target.name:sub(5), type = 'monster'}
- else
- ttable.target.type = 'player'
- end
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- end
- end
- end
- return {dmg = 0, dealer = {name = '', type = ''}, target = {name = '', type = ''}}
- end
- function string:healmsg()
- --Lorysa healed herself for 201 hitpoints.
- local ttable = {dmg = 0, healer = '', target = ''}
- if not self:find('heal') then return {dmg = 0, healer = '', target = ''} end
- ttable.dmg = self:match('You healed yourself for (%w+) hitpoint[s]*%.')
- if ttable.dmg then
- ttable.target, ttable.healer = $name, $name
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.healer, ttable.dmg = self:match('(.+) healed h[erim]+self for (%w+) hitpoint[s]*%.')
- if ttable.dmg then
- if ttable.healer:sub(1,2) == 'A ' then
- ttable.healer = tt.healer:sub(3)
- elseif ttable.healer:sub(1,3) == 'An ' then
- ttable.healer = tt.healer:sub(4)
- elseif ttable.healer:sub(1,4) == 'The ' then
- ttable.healer = tt.healer:sub(5)
- end
- ttable.target = ttable.healer
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.target, ttable.dmg = self:match('You heal (.+) for (%w+) hitpoint[s]*%.')
- if ttable.dmg then
- if ttable.target:sub(1,2) == 'a ' then
- ttable.target = tt.target:sub(3)
- elseif ttable.target:sub(1,3) == 'an ' then
- ttable.target = tt.target:sub(4)
- elseif ttable.target:sub(1,4) == 'the ' then
- ttable.target = tt.target:sub(5)
- end
- ttable.healer = $name
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.healer, ttable.dmg = self:match('You were healed by (.+) for (%w+) hitpoint[s]*%.')
- if ttable.dmg then
- if ttable.healer:sub(1,2) == 'a ' then
- ttable.healer = tt.healer:sub(3)
- elseif ttable.healer:sub(1,3) == 'an ' then
- ttable.healer = tt.healer:sub(4)
- elseif ttable.healer:sub(1,4) == 'the ' then
- ttable.healer = tt.healer:sub(5)
- end
- ttable.target = $name
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- else
- ttable.target, ttable.healer, ttable.dmg = self:match('(.+) was healed by (.+) for (%w+) hitpoint[s]*%.')
- if ttable.dmg then
- if ttable.target:sub(1,2) == 'A ' then
- ttable.target = tt.target:sub(3)
- elseif ttable.target:sub(1,3) == 'An ' then
- ttable.target = tt.target:sub(4)
- elseif ttable.target:sub(1,4) == 'The ' then
- ttable.target = tt.target:sub(5)
- end
- if (ttable.healer:sub(1,2)):lower() == 'a ' then
- ttable.healer = tt.healer:sub(3)
- elseif (ttable.healer:sub(1,3)):lower() == 'an ' then
- ttable.healer = tt.healer:sub(4)
- elseif (ttable.healer:sub(1,4)):lower() == 'the ' then
- ttable.healer = tt.healer:sub(5)
- end
- ttable.dmg = tonumber(ttable.dmg)
- return ttable
- end
- end
- end
- end
- end
- return {dmg = 0, healer = '', target = ''}
- end
- function string:lootmsg()
- local n, temp, loot = self:match('Loot of (.+): (.+)')
- local minfoodt, valuet = 5000000, 0
- if n then
- if (n:sub(1,2)):lower() == 'a ' then
- n = n:sub(3)
- elseif (n:sub(1,3)):lower() == 'an ' then
- n = n:sub(4)
- elseif (n:sub(1,4)):lower() == 'the ' then
- n = n:sub(5)
- end
- if temp ~= 'nothing' then
- temp = temp:token(nil, ', ')
- loot = {}
- for i,j in ipairs(temp) do
- local tt = j:find(' ') or #j+1
- local temp1 = j:sub(1,tt-1)
- local amount = tonumber(temp1)
- local temp2
- if amount then
- temp1 = amount
- temp2 = j:sub(tt+1, #j)
- elseif temp1 == 'a' or temp1 == 'an' then
- temp1 = 1
- temp2 = j:sub(tt+1, #j)
- else
- temp1 = 1
- temp2 = j
- end
- local pos = table.find(loot, temp2:lower(), 'name')
- setwarning(WARNING_ITEM, false)
- local iid = itemid(temp2)
- setwarning(WARNING_ITEM, true)
- if iid > 0 then
- if iid == 2995 then
- valuet = valuet+1000
- elseif iid == 6558 then
- valuet = valuet+400
- elseif isfood(iid) then
- local tempfoodtime = getfoodtime(iid)
- if tempfoodtime < minfoodt then
- minfoodt = tempfoodtime
- end
- else
- valuet = valuet+itemvalue(iid)*temp1
- end
- end
- if not pos then
- table.insert(loot, {name = temp2:lower(), count = temp1})
- else
- loot[pos].count = loot[pos].count + temp1
- end
- end
- else
- return {name = n:lower(), items = {}}
- end
- end
- n = n or ''
- loot = loot or {}
- return {name = n:lower(), items = loot, value = valuet, minfood = minfoodt}
- end
- function timebetween(ft,st,delay)
- local ctime,ftime,stime = tosec(),tosec(ft),tosec(st)
- delay = delay or 0
- return ctime >= ftime and ctime <= stime + delay
- end
- local ssmsgs = {'The server will be saved in 5 minutes, please come back in 10 minutes.'}
- local inventoryfullmsgs = {'You cannot put more objects in this container.'}
- local lowcapmsgs = {}
- DYNAMICHUD = {aux = {x=0,y=0}, moved = {x=0,y=0}, moving = false}
- function DYNAMICHUD:new()
- n = n or {aux = {x=0,y=0}, moved = {x=0,y=0}, moving = false}
- setmetatable(n, self)
- self.__index = self
- return n
- end
- function DYNAMICHUD:init()
- filterinput(false, true, false, false)
- function inputevents(type, v1, v2)
- if type == IEVENT_RMOUSEDOWN then
- self.moving = true
- self.aux = {x = $cursor.x-self.moved.x, y = $cursor.y-self.moved.y}
- end
- if type == IEVENT_RMOUSEUP then
- self.moving = false
- end
- end
- end
- function DYNAMICHUD:check()
- if self.moving then
- auto(10)
- self.moved = {x = $cursor.x-self.aux.y, y = $cursor.y-self.aux.y}
- end
- end
- function DYNAMICHUD:setposition(x,y)
- setposition(x+self.moved.x,self.moved.y)
- end
- function math:highest(b)
- if self > b then
- return self
- end
- return b
- end
- function math:lowest(b)
- if self < b then
- return self
- end
- return b
- end
- function creaturestringformat(cre)
- local ret = '{'
- for i,j in ipairs(_CREATUREPROPERTIES) do
- if type(cre[j]) == 'string' then
- ret = ret..j..' = "'..cre[j]..'"'..', '
- else
- ret = ret..j..' = '..tostring(cre[j])..', '
- end
- end
- return ret:sub(1,#ret-2)..'}'
- end
- function table:stringformat(tablename, separator)
- if type(self) ~= 'table' then
- return ''
- end
- separator = separator or ''
- tablename = tablename or ''
- local ret
- if tablename == '' then
- ret = '{'
- else
- ret = tablename..' = {'
- end
- local count = 0
- for i,j in ipairs(self) do
- count = count+1
- local type = type(j)
- if type == 'string' then
- ret = ret..'"'..j..'", '..separator
- elseif type == 'number' then
- ret = ret..j..', '..separator
- elseif type == 'table' then
- ret = ret..table.stringformat(j)..', '..separator
- elseif type == 'userdata' then
- if j.color1 then
- ret = ret..creaturestringformat(j)..', '..separator
- end
- end
- end
- if count == 0 then
- for i,j in pairs(self) do
- local type = type(j)
- if type == 'string' then
- ret = ret..i..' = "'..j..'", '..separator
- elseif type == 'number' then
- ret = ret..i..' = '..j..', '..separator
- elseif type == 'table' then
- ret = ret..i..' = '..table.stringformat(j)..', '..separator
- elseif type == 'userdata' then
- if j.color1 then
- ret = ret..i..' = '..creaturestringformat(j)..', '..separator
- end
- end
- end
- end
- return ret:sub(1,#ret-2)..'}'
- end
- function ispk(mid)
- return mid.skull == SKULL_WHITE or mid.skull == SKULL_RED or mid.skull == SKULL_YELLOW or mid.skull == SKULL_ORANGE
- end
- function maroundfloor(dist,floor,...)
- local temp
- local creaturestocheck = {...}
- local count = 0
- dist = dist or 10
- if dist == 0 then
- dist = 10
- end
- if type(floor) == 'string' then
- temp = -(tonumber(floor))
- if not temp then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- elseif floor > 1000 then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- table.lower(creaturestocheck)
- if temp then
- if temp > 0 then
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if diff <= temp and diff >= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- else
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if diff >= temp and diff <= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- end
- else
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if math.abs(diff) <= math.abs(floor) and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- end
- return count
- end
- function maroundfloorignore(dist,floor,...)
- local temp
- local creaturestocheck = {...}
- local count = 0
- dist = dist or 10
- if dist == 0 then
- dist = 10
- end
- if type(floor) == 'string' then
- temp = -(tonumber(floor))
- if not temp then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- elseif floor > 1000 then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- table.lower(creaturestocheck)
- if temp then
- if temp > 0 then
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if diff <= temp and diff >= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- else
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if diff >= temp and diff <= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- end
- else
- foreach creature c 'm' do
- local diff = c.posz-$posz
- if math.abs(diff) <= math.abs(floor) and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- end
- return count
- end
- function paroundfloor(dist,floor,...)
- local temp
- local creaturestocheck = {...}
- local count = 0
- dist = dist or 10
- if dist == 0 then
- dist = 10
- end
- if type(floor) == 'string' then
- temp = -(tonumber(floor))
- if not temp then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- elseif floor > 1000 then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- table.lower(creaturestocheck)
- if temp then
- if temp > 0 then
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and diff <= temp and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and diff >= 0 and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- else
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and diff >= temp and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and diff <= 0 and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- end
- else
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and math.abs(diff) <= math.abs(floor) and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or table.find(creaturestocheck,c.name:lower()) or table.find(creaturestocheck,c.id) or table.find(creaturestocheck,c)) then
- count = count+1
- end
- end
- end
- return count
- end
- function paroundfloorignore(dist,floor,...)
- local temp
- local creaturestocheck = {...}
- local count = 0
- dist = dist or 10
- if dist == 0 then
- dist = 10
- end
- if type(floor) == 'string' then
- temp = -(tonumber(floor))
- if not temp then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- elseif floor > 1000 then
- table.insert(creaturestocheck, floor)
- floor = 7
- end
- table.lower(creaturestocheck)
- if temp then
- if temp > 0 then
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and diff <= temp and diff >= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- else
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and diff >= temp and diff <= 0 and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- end
- else
- foreach creature c 'p' do
- local diff = c.posz-$posz
- if c ~= $self and math.abs(diff) <= math.abs(floor) and math.highest(math.abs(c.posx-$posx), math.abs(c.posy-$posy)) <= dist and (#creaturestocheck == 0 or (not table.find(creaturestocheck,c.name:lower()) and not table.find(creaturestocheck,c.id) and not table.find(creaturestocheck,c))) then
- count = count+1
- end
- end
- end
- return count
- end
- function bininsert1asc(tablename,value)
- if type(tablename) == 'table' then
- local left,right = 1, #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid] == value then
- return mid
- end
- if tablename[mid] > value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return left
- end
- function bininsert2asc(tablename,value,argument,left,right)
- if type(tablename) == 'table' then
- left,right = left or 1, right or #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid][argument] == value then
- return mid
- end
- if tablename[mid][argument] > value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return left
- end
- function bininsert1desc(tablename,value)
- if type(tablename) == 'table' then
- local left,right = 1, #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid] == value then
- return mid
- end
- if tablename[mid] < value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return left
- end
- function bininsert2desc(tablename,value,argument,left,right)
- if type(tablename) == 'table' then
- local left,right = left or 1, right or #tablename
- while left <= right do
- local mid = math.floor((right+left)/2)
- if tablename[mid][argument] == value then
- return mid
- end
- if tablename[mid][argument] < value then
- right = mid-1
- else
- left = mid+1
- end
- end
- end
- return left
- end
- function table:insertsorted(value, argument, order, disallowduplicated)
- if type(self) == 'table' then
- if type(value) == 'userdata' or type(value) == 'table' then
- if argument then
- if type(argument) == 'table' then
- for i=1,#argument do
- if type(argument[i]) ~= 'table' then
- argument[i] = {argument[i], 'asc'}
- elseif not argument[i][2] then
- argument[i][2] = 'asc'
- end
- end
- if argument[1][2] == 'asc' then
- inssortedasc_1(self, value, argument)
- else
- inssorteddesc_1(self, value, argument)
- end
- else
- if order == true then
- disallowduplicated = true
- order = false
- end
- order = order or 'asc'
- local postoinsert
- if order == 'asc' then
- postoinsert = bininsert2asc(self, value, argument)
- else
- postoinsert = bin2insertdesc(self, value, argument)
- end
- table.insert(self, postoinsert, value)
- return true
- end
- else
- printerror('You must give some argument to order according to.')
- end
- else
- if argument then
- local temp = order
- order = argument
- disallowduplicated = temp
- end
- order = order or 'asc'
- local postoinsert
- if order == 'asc' then
- postoinsert = bin1insertasc(self, value)
- else
- postoinsert = bin1insertdesc(self, value)
- end
- table.insert(self, postoinsert, value)
- return true
- end
- end
- return false
- end
- function inssortedasc_1(tablename, value, argument)
- local i = #tablename
- local arg = argument[1][1]
- while i >= 1 do
- if (tablename[i][arg] > value[arg]) then
- tablename[i+1] = tablename[i]
- elseif (tablename[i][arg] == value[arg]) then
- if (#argument > 1) then
- if argument[2][2] == 'asc' then
- return inssortedasc_2(tablename, value, argument, 2, i)
- else
- return inssorteddesc_2(tablename, value, argument, 2, i)
- end
- else
- tablename[i+1] = value
- return true
- end
- else
- tablename[i+1] = value
- return true
- end
- i = i-1
- end
- tablename[i+1] = value
- return true
- end
- function inssortedasc_2(tablename, value, argument, argpos, right)
- local i = right
- local arg1,arg2 = argument[argpos][1], argument[argpos-1][1]
- while i >= 1 and tablename[i][arg2] == value[arg2] do
- if (tablename[i][arg1] > value[arg1]) then
- tablename[i+1] = tablename[i]
- elseif (tablename[i][arg1] == value[arg1]) then
- if (argpos < #argument) then
- if argument[argpos+1][2] == 'asc' then
- return inssortedasc_2(tablename, value, argument, argpos+1, i)
- else
- return inssorteddesc_2(tablename, value, argument, argpos+1, i)
- end
- else
- tablename[i+1] = value
- return true
- end
- else
- tablename[i+1] = value
- return true
- end
- i = i-1
- end
- tablename[i+1] = value
- return true
- end
- function inssorteddesc_1(tablename, value, argument)
- local i = #tablename
- local arg = argument[1][1]
- while i >= 1 do
- if (tablename[i][arg] < value[arg]) then
- tablename[i+1] = tablename[i]
- elseif (tablename[i][arg] == value[arg]) then
- if (#argument > 1) then
- if argument[2][2] == 'asc' then
- return inssortedasc_2(tablename, value, argument, 2, i)
- else
- return inssorteddesc_2(tablename, value, argument, 2, i)
- end
- else
- tablename[i+1] = value
- return true
- end
- else
- tablename[i+1] = value
- return true
- end
- i = i-1
- end
- tablename[i+1] = value
- return true
- end
- function inssorteddesc_2(tablename, value, argument, argpos, right)
- local i = right
- local arg1,arg2 = argument[argpos][1], argument[argpos-1][1]
- while i >= 1 and tablename[i][arg2] == value[arg2] do
- if (tablename[i][arg1] < value[arg1]) then
- tablename[i+1] = tablename[i]
- elseif (tablename[i][arg1] == value[arg1]) then
- if (argpos < #argument) then
- if argument[argpos+1][2] == 'asc' then
- return inssortedasc_2(tablename, value, argument, argpos+1, i)
- else
- return inssorteddesc_2(tablename, value, argument, argpos+1, i)
- end
- else
- tablename[i+1] = value
- return true
- end
- else
- tablename[i+1] = value
- return true
- end
- i = i-1
- end
- tablename[i+1] = value
- return true
- end
- function ringinuse(iid)
- local rings = {{3092, 3095}, {3091, 3094}, {3093, 3096}, {3052, 3089}, {3098, 3100}, {3097, 3099}, {3051, 3088}, {3053, 3090}, {3049, 3086}, {9593, 9593}, {9393, 9392}, {3007, 3007}, {6299, 6300}, {9585, 9585}, {3048, 3048}, {3050, 3087}, {3245, 3245}, {3006, 3006}, {349, 349}, {3004, 3004}}
- local temp = table.find(rings, itemid(iid), 1)
- if temp then
- return rings[temp][2]
- end
- return 0
- end
- function castspellarea(spell, amount, ignoreplayers, ...)
- if type(spell) ~= 'table' then
- spell = spellinfo(spell)
- end
- if cancastspell(spell) then
- if type(amount) ~= 'number' then
- amount = 0
- end
- local monsters = {...}
- if type(ignoreplayers) ~= 'boolean' then
- table.insert(monsters, ignoreplayers)
- ignoreplayers = false
- end
- local needdir = false
- if table.find({'front', 'bigbeam', 'smallbeam', 'bigwave', 'smallwave', 'strike'}, spell.condition) then
- needdir = true
- end
- if needdir then
- local count = {w = 0, e = 0, n = 0, s = 0}
- foreach creature m 's' do
- for i,j in pairs(count) do
- if isonspellarea(m, spell.condition, i) then
- if m.ismonster then
- if #monsters == 0 or table.find(monsters,m.name:lower()) or table.find(monsters,m.id) or table.find(monsters,m) then
- count[i] = count[i]+1
- end
- elseif not ignoreplayers then
- return false
- end
- end
- end
- end
- local bestdir = $self.dir
- for i,j in pairs(count) do
- if j > count[bestdir] then
- bestdir = i
- end
- end
- if count[bestdir] >= amount then
- while $self.dir ~= bestdir do turn(bestdir) wait(50,100) end
- cast(spell.words)
- return true
- end
- else
- local count = 0
- foreach creature m 's' do
- if isonspellarea(m, spell.condition) then
- if m.ismonster then
- if #monsters == 0 or table.find(monsters,m.name:lower()) or table.find(monsters,m.id) or table.find(monsters,m) then
- count = count+1
- end
- elseif not ignoreplayers then
- return false
- end
- end
- end
- if count >= amount then
- cast(spell.words)
- return true
- end
- end
- end
- end
- function tilewalkable(x,y,z)
- x,y,z = x or $posx, y or $posy, z or $posz
- if type(x) == 'string' then
- local dirx = {c = 0, n = 0, s = 0, w = -1, e = 1, nw = -1, ne = 1, sw = -1, se = 1}
- local diry = {c = 0, n = -1, s = 1, w = 0, e = 0, nw = -1, ne = -1, sw = 1, se = 1}
- for i,j in pairs(dirx) do
- if i == x then
- x = j
- y = diry[i]
- break
- end
- end
- z = $posz
- end
- local tile = gettile(x,y,z)
- local v = 1
- if tile.item[v].id == 0 or itemproperty(tile.item[v].id, ITEM_FLOORCHANGE) or not itemproperty(tile.item[v].id, ITEM_GROUND) then
- return false
- end
- v = 2
- if itemproperty(tile.item[v].id, ITEM_TOPORDER1) then
- v = 3
- end
- if itemproperties(tile.item[v].id, ITEM_MINIMAP, ITEM_NOTMOVEABLE) then
- if itemproperty(tile.item[v].id, ITEM_BLOCKPATHS) and not itemproperty(tile.item[v].id, ITEM_GROUND) then
- return false
- elseif itemproperty(tile.item[v].id, ITEM_TOPORDER2) and itemproperty(tile.item[v].id, ITEM_BLOCKPATHS) and (itemproperty(tile.item[v].id, ITEM_HEIGHTED) or itemproperty(tile.item[v].id, ITEM_LIGHTFONT)) then
- return false
- end
- end
- for i=1, tile.itemcount do
- if (itemproperty(tile.item[i].id, ITEM_BLOCKWALK) or (tile.item[i].id == 99 and (tile.item[i].count > 0x40000000 or getsetting('Cavebot/Pathfinding/WalkThroughPlayers') == 'no'))) then
- return false
- end
- end
- return true
- end
- function trapped()
- if not $cavebot or ($wpttype == 'action') or ($wptx == 0) then
- for j=-1, 1 do
- for i=-1, 1 do
- if i ~= 0 or j ~= 0 then
- if tilewalkable($posx+i,$posy+j,$posz) then
- return false
- end
- end
- end
- end
- return true
- else
- if tilereachable($wptx,$wpty,$wptz,true) then
- return false
- end
- return true
- end
- end
- function randomize(ttable)
- local value = 0
- if type(ttable) == 'table' then
- value = math.random(table.unpack(ttable))
- end
- return value
- end
- _USEITEMON = _USEITEMON or useitemon
- function useitemon(fromid,toid,todest,fromdest)
- toid, todest, fromdest = toid or 0, todest or '', fromdest or ''
- if toid == 0 or not toid then
- local tableequip = {{'rhand', $rhand}, {'lhand', $lhand}, {'head', $head}, {'chest', $chest}, {'legs', $legs}, {'feet', $feet}, {'finger', $finger}, {'neck', $neck}, {'belt', $belt}, {'back', $back}}
- local temp = table.find(tableequip, todest, 1)
- if temp then
- toid = tableequip[temp][2].id
- end
- end
- return _USEITEMON(fromid,toid,todest,fromdest)
- end
- ------------------------------Raphael.lua---------------------------------
- -- Raphael's Library v2.9.7
- -- Last updated: 08/21 - 01:54
- --[[
- * Changelog v2.9.7
- *
- * - Fixed a small mistake (getting tired of it) on the library versions workaround.
- *
- --]]
- RAPHAEL_LIB = "2.9.7"
- print('Raphael\'s Library loaded. Last updated: 08/21 - 01:54 (v' .. RAPHAEL_LIB .. ')')
- table.unpack = table.unpack or unpack
- unpack = unpack or table.unpack
- f = false
- LUCAS_LIB = tonumber((LUCAS_LIB:gsub('%.', function() if not f then f = true return '.' else return '' end end)))
- f = false
- RAPHAEL_LIB = tonumber((RAPHAEL_LIB:gsub('%.', function() if not f then f = true return '.' else return '' end end)))
- -- HUD Events
- iEvent_MouseEnter = IEVENT_MOUSEENTER
- iEvent_MouseLeave = IEVENT_MOUSELEAVE
- iEvent_MouseMove = IEVENT_MOUSEMOVE
- iEvent_MiddleDown = IEVENT_MMOUSEDOWN
- iEvent_MiddleUp = IEVENT_MMOUSEUP
- iEvent_RightDown = IEVENT_RMOUSEDOWN
- iEvent_RightUp = IEVENT_RMOUSEUP
- iEvent_LeftDown = IEVENT_LMOUSEDOWN
- iEvent_LeftUp = IEVENT_LMOUSEUP
- iEvent_KeyDown = IEVENT_KEYDOWN
- iEvent_KeyUp = IEVENT_KEYUP
- local skills = {
- magic = {$mlevelpc, nil, nil, nil, nil, nil, nil},
- fist = {$fistpc, nil, nil, nil, nil, nil, nil},
- club = {$clubpc, nil, nil, nil, nil, nil, nil},
- sword = {$swordpc, nil, nil, nil, nil, nil, nil},
- axe = {$axepc, nil, nil, nil, nil, nil, nil},
- distance = {$distancepc, nil, nil, nil, nil, nil, nil},
- shielding = {$shieldingpc, nil, nil, nil, nil, nil, nil},
- fishing = {$fishingpc, nil, nil, nil, nil, nil, nil}
- }
- function flasks() -- Working
- return itemcount(283) + itemcount(284) + itemcount(285)
- end
- function dropflasks() -- Working
- local flaskids = {283, 284, 285}
- for i = 1, #flaskids do
- if itemcount(flaskids[i]) > 0 then
- moveitems(flaskids[i], 'ground')
- waitping()
- end
- end
- end
- function gold() -- Working
- return itemcount(3031) + itemcount(3035) * 100 + itemcount(3043) * 10000
- end
- function moveitemlist(locationto, locationfrom, ...) -- Working
- local t = {...}
- for i = 1, #t do
- if itemcount(t[i], locationfrom or '') > 0 then
- moveitems(t[i], locationto, locationfrom or '')
- waitping()
- end
- end
- end
- function npctalk(...) -- Working
- local arg = {...}
- -- Adjust settings to lower tab pressingtime.
- local presswait = get('PressWaitTime')
- set('PressWaitTime', '200 to 300')
- -- Checks for caps lock and normal wait parameters.
- local cc, nw
- if type(arg[#arg]) == 'boolean' then
- if type(arg[#arg-1]) == 'boolean' then
- if arg[#arg] then
- nw = true
- end
- if arg[#arg-1] then
- cc = true
- end
- table.remove(arg)
- elseif arg[#arg] then
- cc = true
- end
- table.remove(arg)
- end
- local f
- -- Sets the desired wait method.
- if nw then
- f = function()
- waitping()
- return true
- end
- else
- f = function(msg, type)
- local c = 0
- while c < 30 do
- foreach newmessage m do
- if m.sender == $name and m.content == msg and m.type == type then
- return true
- end
- end
- c = c + 1
- wait(90, 110)
- end
- return false
- end
- -- Makes all args string
- for k, v in ipairs(arg) do
- v = tostring(v)
- end
- end
- -- Checks the caps lock
- if cc then
- press("a")
- wait(200, 400)
- if $typedtext == "A" then
- table.upper(arg)
- --press("[CAPSLOCK]")
- --waitping()
- end
- end
- local p = false
- if not ischannel('NPCs') then
- while not p do
- say('Default', arg[1])
- p = f(arg[1], MSG_DEFAULT)
- end
- table.remove(arg, 1)
- wait(400, 600)
- end
- for k, v in ipairs(arg) do
- p = false
- while not p do
- say('NPCs', v)
- p = f(v, MSG_SENT)
- if not p then
- if not ischannel('NPCs') then
- npctalk(select(k, ...))
- return
- end
- end
- end
- end
- set('PressWaitTime', presswait)
- end
- function skilltime(skilltype) -- Needs to be remade/adjusted.
- local percent = {magic = $mlevelpc, fist = $fistpc, club = $clubpc, sword = $swordpc, axe = $axepc, distance = $distancepc, shielding = $shieldingpc, fishing = $fishingpc}
- local skillpc = percent[skilltype]
- if skillpc ~= skills[skilltype][1] then
- if skillpc ~= 0 then
- if skills[skilltype][3] then
- skills[skilltype][2] = ($timems - skills[skilltype][3]) * (100 - skillpc) / (skillpc - skills[skilltype][1])
- else
- skills[skilltype][2] = nil
- end
- end
- skills[skilltype][1] = skillpc
- skills[skilltype][3] = $timems
- end
- if skills[skilltype][2] then
- return math.max(math.floor((skills[skilltype][2] - ($timems - skills[skilltype][3])) / 1000), 0)
- else
- return 0
- end
- end
- function keyid(key) -- Working -- Find full list at: http://api.farmanager.com/en/winapi/virtualkeycodes.html
- local keys = {MOUSELEFT = 0x01, MOUSERIGHT = 0x02, MOUSEMIDDLE = 0x04, BACKSPACE = 0x08, TAB = 0x09, CLEAR = 0x0C, ENTER = 0x0D, SHIFT = 0x10, CTRL = 0x11, ALT = 0x12, PAUSE = 0x13, CAPSLOCK = 0x14, ESC = 0x1B, SPACE = 0x20, PAGEUP = 0x21, PAGEDOWN = 0x22, END = 0x25, HOME = 0x24, LEFTARROW = 0x25, UPARROW = 0x26, RIGHTARROW = 0x27, DOWNARROW = 0x28, SELECT = 0x29, PRINT = 0x2A, ExECUTE = 0x2B, PRINTSCREEN =0x2C, INSERT = 0x2D, DELETE = 0x2E, HELP = 0x2F, A = 0x41, B = 0x42, C = 0x43, D = 0x44, E = 0x45, F = 0x46, G = 0x47, H = 0x48, I = 0x49, J = 0x4A, K = 0x4B, L = 0x4C, M = 0x4D, N = 0x4E, O = 0x4F, P = 0x50, Q = 0x51, R = 0x52, S = 0x53, T = 0x54, U = 0x55, V = 0x56, W = 0x57, x = 0x58, Y = 0x59, Z = 0x5A, SLEEP = 0x5F, NUM0 = 0x60, NUM1 = 0x61, NUM2 = 0x62, NUM3 = 0x63, NUM4 = 0x64, NUM5 = 0x65, NUM6 = 0x66, NUM7 = 0x67, NUM8 = 0x68, NUM9 = 0x69, MULTIPLY = 0x6A, ADD = 0x6B, SEPARATOR = 0x6C, SUBTRACT = 0x6D, DECIMAL = 0x6E, DIVIDE = 0x6F, F1 = 0x70, F2 = 0x71, F3 = 0x72, F4 = 0x73, F5 = 0x74, F6 = 0x75, F7 = 0x76, F8 = 0x77, F9 = 0x78, F10 = 0x89, F11 = 0x7A, F12 = 0x7B, F13 = 0x7C, F14 = 0x7D, F15 = 0x7E, F16 = 0x7F, F17 = 0x80, F18 = 0x81, F19 = 0x82, F20 = 0x83, F21 = 0x84, F22 = 0x85, F23 = 0x86, F24 = 0x87, NUMLOCK = 0x90, SCROLLLOCK = 0x91, COMMA = 0xBC, HIFFEN = 0xBD, DOT = 0xBE, BAR = 0xBF, SINGLEQUOTE = 0xD3}
- local numberkeys = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39}
- if tonumber(key) then
- return numberkeys[key + 1]
- end
- return keys[string.upper(key)]
- end
- function press(keys) -- Working
- local i = 1
- while i <= #keys do
- local key = ''
- if string.sub(keys, i, i) == '[' then
- i2 = i + string.find(string.sub(keys, i), ']')
- key = string.sub(keys, i+1, i2-2)
- keyevent(keyid(key))
- i = i2
- elseif string.sub(keys, i, i) ~= ']' then
- keyevent(keyid(string.sub(keys, i, i)))
- i = i + 1
- end
- end
- end
- function itemprice(itemname) -- Working
- return itemcost(itemname)
- end
- function filecontent(filename) -- Working
- if not fileexists(filename) then
- return ''
- end
- local handler = io.open(filename, 'r')
- content = handler:read('*a')
- handler:close()
- return content
- end
- function filelinescount(filename) -- Working
- if not fileexists(filename) then
- return 0
- end
- local linecount = 0
- for line in io.lines(filename) do
- linecount = linecount + 1
- end
- return linecount
- end
- function fileline(filename, linenum) -- Working
- local linen, linew = 0, ''
- for line in io.lines(filename) do
- linen = linen + 1
- if linen == linenum then
- linew = line
- end
- end
- return linew
- end
- function filewrite(filename, text) -- Working.
- local handler = io.open(filename, 'a+')
- handler:write(text)
- handler:close()
- end
- function fileexists(filename) -- Working
- local handler, exists = io.open(filename), false
- if type(handler) ~= 'nil' then
- exists = true
- handler:close()
- end
- local handler = nil
- return exists
- end
- function createfile(filename) -- Working
- if not fileexists(filename) then
- clearfile(filename)
- end
- end
- function execfile(filename)
- exec(filecontent(filename))
- end
- function filewriteline(filename, text) -- Working.
- local skip = ''
- if filelinescount(filename) > 0 then
- skip = '\n'
- end
- local handler = io.open(filename, 'a+')
- handler:write(skip..text)
- handler:close()
- end
- function clearfile(filename) -- Working.
- local handler = io.open(filename, 'w+')
- handler:close()
- end
- function filerewrite(filename, text)
- local handler = io.open(filename, 'w+')
- handler:write(text)
- handler:close()
- end
- function isfileline(filename, text) -- Working
- local n = 0
- if fileexists(filename) then
- for line in io.lines(filename) do
- n = n + 1
- if line == text then
- return n
- end
- end
- end
- return false
- end
- file = {}
- file.content = filecontent
- file.linescount = filelinescount
- file.line = fileline
- file.write = filewrite
- file.exists = fileexists
- file.create = createfile
- file.exec = execfile
- file.writeline = filewriteline
- file.clear = clearfile
- file.rewrite = filerewrite
- file.isline = isfileline
- function exec(execstring) -- Working
- local func = loadstring(execstring)
- local arg = {pcall(func)}
- table.insert(arg, arg[1])
- table.remove(arg, 1)
- return table.unpack(arg)
- end
- function vocation() -- Working
- local voc = 'unknown'
- local vocs = {
- mage = 5,
- paladin = 10,
- knight = 15
- }
- local hpplevel = ($maxhp - 185) / ($level - 8)
- for k, v in pairs(vocs) do
- if hpplevel == v then
- voc = k
- break
- end
- end
- if voc == 'mage' then
- local items = {
- druid = {
- rhand = {3065, 3066, 3067, 3069, 3070, 8082, 8083, 8084},
- chest = {8038, 8041}
- },
- sorcerer = {
- rhand = {3071, 3072, 3073, 3074, 3075, 8092, 8093, 8094},
- chest = {8037, 8039, 8040, 8062}
- }
- }
- for k, v in pairs(items) do
- for p, q in pairs(v) do
- local id = exec('return $' .. p .. '.id')
- for _, x in ipairs(q) do
- if x == id then
- return k
- end
- end
- end
- end
- end
- return voc
- end
- function maxcap() -- Working
- local vocs = {
- unknown = 0,
- druid = 10,
- sorcerer = 10,
- mage = 10,
- paladin = 20,
- knight = 30
- }
- return vocs[vocation()] * ($level - 8) + 470
- end
- function string.explode(self, sep) -- By Socket, improved by Hardek. Working
- local result = {}
- self:gsub("[^".. sep .."*]+", function(s) table.insert(result, (string.gsub(s, "^%s*(.-)%s*$", "%1"))) end)
- return result
- end
- function sethealrule(rule, hprange, mprange, method, condition, spam) -- Working
- local settings = {'HealthRange', 'ManaRange', 'HealMethod', 'ExtraCondition', 'SpamRate'}
- local settingsTo = {((hprange:find('%%') and hprange:find(' %%')) and hprange:gsub('-', ' to ') or hprange:gsub('-', ' to '):gsub('%%', ' %%')):lower(), ((mprange:find('%%') and mprange:find(' %%')) and mprange:gsub('-', ' to ') or mprange:gsub('-', ' to '):gsub('%%', ' %%')):lower(), method:capitalizeall(), ((condition:lower():find('paralyze')) and 'If paralyzed' or ((condition == '') and 'No condition')):capitalize(), ((not spam) and '' or spam:gsub('-', ' to ')):lower()}
- for i = 1, #settings do
- setsetting('Healer/HealRules/'..rule..'/'..settings[i], settingsTo[i] or getsetting('Healer/HealRules/'..rule..'/'..settings[i]))
- end
- end
- function string.capitalize(self) -- Working
- return string.upper(self:sub(1,1)) .. self:sub(2):lower()
- end
- function string.capitalizeall(self) -- Working
- local t = string.explode(self, ' ')
- for i = 1, #t do
- t[i] = t[i]:capitalize()
- end
- return table.concat(t, ' ')
- end
- function bestskill() -- Working
- local t = {$axe+$axepc/100, {type = 'axe', skill = $axe, skillpc = $axepc}, $club+$clubpc/100, {type = 'club', skill = $club, skillpc = $clubpc}, $sword+$swordpc/100, {type = 'sword', skill = $sword, skillpc = $swordpc}, $distance+$distancepc/100, {type = 'distance', skill = $distance, skillpc = $distancepc}, $fist+$fistpc/100, {type = 'fist', skill = $fist, skillpc = $fistpc}}
- local j = 0
- for i = 1, #t, 2 do
- j = math.max(j, t[i])
- end
- return t[table.find2(t, j)+1]
- end
- function weaponskill() -- Working
- local t = {'axe', {type = 'axe', skill = $axe, skillpc = $axepc}, 'club', {type = 'club', skill = $club, skillpc = $clubpc}, 'sword', {type = 'sword', skill = $sword, skillpc = $swordpc}, {'bow', 'distance weapon'}, {type = 'distance', skill = $distance, skillpc = $distancepc}, 'no weapon', {type = 'fist', skill = $fist, skillpc = $fistpc}, {'rod', 'wand'}, {type = 'magic', skill = $mlevel, skillpc = $mlevelpc}}
- return t[table.find2(t, findweapontype())+1]
- end
- function table.find2(self, value, arg, notable, argonly) -- Working
- for i = 1, #self do
- if not argonly then
- if self[i] == value then
- return i
- end
- end
- if type(self[i]) == 'table' then
- if arg then
- if self[i][arg] == value then
- return i
- end
- elseif not notable then
- for j = 1, #self[i] do
- if self[i][j] == value then
- return i, j
- end
- end
- end
- end
- end
- end
- function exptolvl(a, b) -- Working
- a = a or $level + 1
- if b then
- return exptolvl(b) - exptolvl(a)
- elseif a then
- return 50 / 3 * (a ^ 3 - 6 * a ^ 2 + 17 * a - 12)
- end
- end
- function levelpc() -- Working
- return math.floor(($exp - exptolvl($level)) * 100 / exptolvl($level, $level + 1))
- end
- function table.random(self, start, finish, count, step) -- Working
- self = {}
- step = step or 1
- count = (count ~= 0 and count) and count or math.floor((finish - start) / step)
- for i = 1, count do
- local r = math.random(start, finish)
- while table.find(self, r) do
- r = math.random(start, finish)
- end
- table.insert(self, r)
- end
- return self
- end
- function iscursorin(sx, sy, fx, fy, area) -- working
- if type(sx) == 'table' then
- area = true
- fx = sx.width
- fy = sx.height
- sy = sx.y
- sx = sx.x
- end
- if area then
- fx, fy = sx + fx, sy + fy
- end
- if $cursor.x >= sx then
- if $cursor.x <= fx then
- if $cursor.y >= sy then
- if $cursor.y <= fy then
- return true
- end
- end
- end
- end
- return false
- end
- function utcoffset() -- Working
- local now = os.time()
- return os.difftime(now, os.time(os.date("!*t", now)) - (os.date('*t').isdst and 3600 or 0))
- end
- function cetoffset() -- Working
- local now = os.time()
- return os.difftime(now, os.time(os.date("!*t", now)) - (os.date('*t').isdst and 3600 or 0) + ((os.date('*t').yday > 141 and os.date('*t').yday < 233) and 7200 or 3600))
- end
- function utctime() -- Working
- return tosec(os.date('%X')) - utcoffset()
- end
- function cettime() -- Working
- return tosec(os.date('%X')) - cetoffset()
- end
- function timezone() -- Working
- if utcoffset() then
- return 'UTC '..utcoffset()/3600
- end
- return 'UTC'
- end
- function sstime(world) -- Working
- world = world:lower()
- local ssworlds = {
- 8, {'arcania', 'askara', 'aurea', 'berylia', 'celesta', 'furora', 'galana', 'guardia', 'iridia', 'kyra', 'morgana', 'nebula', 'obsidia', 'pandoria', 'refugia', 'saphira', 'selena', 'thoria', 'xerena'},
- 9, {'aldora', 'antica', 'azuera', 'candia', 'danubia', 'elysia', 'eternia', 'harmonia', 'hiberna', 'inferna', 'isara', 'lunara', 'nerana', 'nova', 'olympa', 'premia', 'secura', 'titania', 'valoria'},
- 11, {'astera', 'balera', 'danera', 'elera', 'empera', 'fortera', 'grimera', 'honera', 'jamera', 'keltera', 'lucera', 'luminera', 'malvera', 'menera', 'neptera', 'ocera', 'pythera', 'samera', 'shanera', 'shivera', 'silvera', 'tenebra', 'vinera', 'zanera'},
- 12, {'amera', 'calmera', 'chimera', 'dolera', 'fidera', 'julera', 'libera', 'magera', 'mythera', 'pacera', 'rubera', 'solera', 'trimera', 'unitera', 'xantera'}
- }
- for i = 2, 8, 2 do
- if table.binaryfind(ssworlds[i], world) then
- return (ssworlds[i-1] * 3600 - cettime()) % 86400
- end
- end
- end
- function time(secs, pattern) -- Working
- local times = {dd = math.floor(secs / 86400), hh = math.floor(secs / 3600) % 24, mm = math.floor(secs / 60) % 60, ss = secs % 60}
- if not pattern then
- if times.dd > 0 then
- pattern = 'dd:hh:mm:ss'
- elseif times.hh > 0 then
- pattern = 'hh:mm:ss'
- else
- pattern = 'mm:ss'
- end
- end
- pattern = pattern:lower()
- for k, v in pairs(times) do
- pattern = string.gsub(pattern, k, math.format(v, "00"))
- end
- return pattern
- end
- function math.format(self, pattern) -- Working
- local a, b = pattern, tostring(self)
- local c, d = (a:find("%.")), (b:find("%."))
- local za, zb = math.max(0, (c or #a + 1) - (d or #b + 1)), math.max(0, (#a - (c or 99999)) - (#b - (d or #b)))
- local dot = (c and not d) and '.' or ''
- return string.rep("0", za) .. b .. dot .. string.rep("0", zb)
- end
- function beep() -- Working
- playsound('monster.wav')
- end
- function sqmWidth() -- Working
- return ($worldwin.right - $worldwin.left) / 15
- end
- function distto(...) -- Working
- local arg = {...}
- local a, b, anyfloor
- if type(arg[1]) == 'userdata' then
- a = {x = arg[1].posx, y = arg[1].posy, z = arg[1].posz}
- if type(arg[2]) == 'userdata' then
- b = {x = arg[2].posx, y = arg[2].posy, z = arg[2].posz}
- anyfloor = arg[3]
- else
- b = {x = arg[2], y = arg[3], z = arg[4]}
- anyfloor = arg[5]
- end
- else
- a = {x = arg[1], y = arg[2], z = arg[3]}
- if type(arg[4]) == 'userdata' then
- b = {x = arg[4].posx, y = arg[4].posy, z = arg[4].posz}
- anyfloor = arg[5]
- else
- b = {x = arg[4], y = arg[5], z = arg[6]}
- anyfloor = arg[7]
- end
- end
- return (anyfloor or a.z == b.z) and math.max(math.abs(a.x - b.x), math.abs(a.y - b.y)) or -1
- end
- function string.at(self, n) -- Working
- return string.sub(self, n, n)
- end
- function string.ends(self, substr) -- Working
- return string.sub(self, -#substr) == substr
- end
- function string.starts(self, substr) -- Working
- return string.sub(self, #substr) == substr
- end
- function table.isempty(self) -- Working
- return next(self) == nil
- end
- function table.size(self) -- Working
- local i = 0
- for j in pairs(self) do
- i = i + 1
- end
- return i
- end
- function toyesno(arg) -- Working
- local returns = {true, 'yes', 'yes', false, 'no', 'no', nil, 'no'}
- local i = table.find2(returns, arg)
- if i then
- return returns[i+1]
- else
- return toyesno(arg ~= 0 and arg ~= '')
- end
- end
- function pm(message, ...) -- Working
- local players = {...}
- if #players > 1 then
- for k, v in ipairs(players) do
- pm(message, v)
- end
- elseif #players == 1 then
- local player = players[1]
- if ischannel(player) then
- say(player, message)
- else
- for i = 1, #player-1 do
- if ischannel(string.sub(player, 1, i) .. "...") then
- say(string.sub(player, 1, i) .. "...", message)
- return
- end
- end
- say('*' .. player .. '* ' .. message)
- end
- end
- end
- function sethotkey(hkname, state) -- Working
- if string.find(hkname, '/') then
- setsetting(hkname, toyesno(state))
- else
- if getsetting('Hotkeys/PersistentList/'..hkname..'/Enabled') then
- sethotkey('Hotkeys/PersistentList/'..hkname..'/Enabled', state)
- elseif getsetting('Hotkeys/CavebotList/'..hkname..'/Enabled', state) then
- sethotkey('Hotkeys/CavebotList/'..hkname..'/Enabled', state)
- else
- error('bad argument #1 to \'sethotkey\' (hotkey \'' .. hkname .. '\' couldn\'t be found)')
- end
- end
- end
- function getcont(location, bpsonly, index) -- Working
- local a, b = location or 0, location or 15
- local backpacks = {2854, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 3253, 5801, 5926, 5949, 7342, 8860, 9601, 9602, 9604, 9605, 10202, 10324, 10326, 10327, 10346}
- local conts = {}
- for i = a, b do
- local cont = getcontainer(i)
- if cont.isopen and cont.itemcount >= 1 then
- for k = 1, cont.itemcount do
- local item = cont.item[k]
- if bpsonly then
- if table.find(backpacks, item.id) then
- table.insert(conts, item.id)
- end
- elseif itemproperty(item.id, 4) then
- table.insert(conts, item.id)
- end
- end
- end
- end
- if index then
- return conts[index] or nil
- else
- return conts
- end
- end
- function movewhilemoveable(x, y, z, dx, dy, dz) -- Working
- local dx, dy, dz = dx or $posx, dy or $posy, dz or $posz
- local id = topitem(x, y, z).id
- while not itemproperty(id, 13) do
- moveitems(id, ground(dx, dy, dz), ground(x, y, z))
- waitping()
- id = topitem(x, y, z).id
- end
- end
- function boatprice(source, dest, post) -- Working. Credits to MeMyselfI
- local boat_table = {
- ["ab'dendriel"] = {
- carlin = 80,
- edron = 70,
- thais = 130,
- venore = 90,
- yalahar = 160
- },
- ankrahmun = {
- edron = 160,
- ["liberty bay"] = 90,
- ["port hope"] = 80,
- venore = 150,
- yalahar = 230
- },
- carlin = {
- edron = 110,
- svargrond = 110,
- thais = 110,
- venore = 130,
- yalahar = 185
- },
- darashia = {
- ["liberty bay"] = 200,
- ["port hope"] = 180,
- venore = 60,
- yalahar = 210
- },
- edron = {
- ankrahmun = 160,
- carlin = 110,
- ["liberty bay"] = 170,
- ["port hope"] = 150,
- thais = 160,
- venore = 40
- },
- goroma = {
- ["liberty bay"] = 0
- },
- ["liberty bay"] = {
- darashia = 200,
- edron = 170,
- goroma = 500,
- ["port hope"] = 50,
- thais = 180,
- venore = 180,
- yalahar = 275
- },
- ["port hope"] = {
- darashia = 180,
- edron = 150,
- ["liberty bay"] = 50,
- thais = 160,
- venore = 160,
- yalahar = 260
- },
- svargrond = {
- thais = 180,
- venore = 150
- },
- thais = {
- carlin = 110,
- edron = 160,
- ["liberty bay"] = 180,
- ["port hope"] = 160,
- svargrond = 180,
- venore = 170,
- yalahar = 200
- },
- venore = {
- ankrahmun = 150,
- carlin = 130,
- darashia = 60,
- edron = 40,
- ["liberty bay"] = 180,
- ["port hope"] = 160,
- svargrond = 150,
- thais = 170,
- yalahar = 185
- },
- yalahar = {
- ankrahmun = 230,
- carlin = 185,
- darashia = 210,
- ["liberty bay"] = 275,
- ["port hope"] = 260,
- thais = 200,
- venore = 185
- }
- }
- source, dest = source:lower(), dest:lower()
- local i = boat_table[source]
- if i then
- i = i[dest]
- if i then
- return i - (post and 10 or 0)
- end
- printerror('Can\'t travel to ' .. dest .. ' from ' .. source .. '.')
- return 0
- end
- printerror('Couldn\'t find location ' .. source .. '.')
- end
- function listversion() -- Working
- return itemid('list version')
- end
- function findgrounditem(id, index) -- Working
- local items = {}
- local index = index or 1
- if type(id) == 'string' then
- id = itemid(id)
- end
- local fx, tx, fy, ty, z = $posx - 7, $posx + 7, $posy - 5, $posy + 5, $posz
- for y = fy, ty do
- for x = fx, tx do
- if topitem(x, y, z).id == id then
- table.insert(items, {x, y, z})
- end
- end
- end
- if #items >= index then
- return table.unpack(items[index])
- else
- return 0, 0, 0
- end
- end
- function canlevitate(x, y, z) -- Working
- z = z or $posz
- local tile = gettile(x, y, z)
- local c = 0
- for i = 1, tile.itemcount do
- local id = tile.item[i].id
- if itemproperty(id, 25) and not itemproperty(id, 30) then
- c = c + 1
- end
- end
- return c >= 3
- end
- function findrope(hotkeys) -- Working
- if itemcount(3003) >= 1 then
- return 'Rope'
- elseif itemcount(646) >= 1 then
- return 'Elvenhair rope'
- elseif itemcount(9598) >= 1 then
- return 'Driller'
- elseif hotkeys then
- if clientitemhotkey(3003) ~= 'not found' then
- return 'Rope'
- elseif clientitemhotkey(646) ~= 'not found' then
- return 'Elvenhair rope'
- elseif clientitemhotkey(9598) ~= 'not found' then
- return 'Driller'
- end
- else
- return nil
- end
- end
- function findshovel(hotkeys) -- Working
- if itemcount(3457) >= 1 then
- return 'Shovel'
- elseif itemcount(5710) >= 1 then
- return 'Light shovel'
- elseif itemcount(9598) >= 1 then
- return 'Driller'
- elseif hotkeys then
- if clientitemhotkey(3457) ~= 'not found' then
- return 'Shovel'
- elseif clientitemhotkey(5710) ~= 'not found' then
- return 'Light shovel'
- elseif clientitemhotkey(9598) ~= 'not found' then
- return 'Driller'
- end
- else
- return nil
- end
- end
- function getpath(setting, path, entry) -- Working
- if getsetting(setting) then
- return setting
- end
- if entry then
- local name = getsetting(entry, '_name')
- if string.ends(path .. name, setting) then
- return path .. name
- elseif #name > 0 then
- foreach settingsentry e (path .. name) do
- local s = getpath(setting, path .. name .. '/', e)
- if s then
- return s
- end
- end
- end
- else
- for _, v in ipairs({'Alerts', 'Cavebot', 'Healer', 'Hotkeys', 'Hud', 'Input', 'Targeting'}) do
- foreach settingsentry e v do
- local s = getpath(setting, v .. '/', e)
- if s then
- return s
- end
- end
- end
- end
- return nil
- end
- function set(setting, value, updgui) -- Working
- updgui = updgui or true
- local path = getpath(setting)
- if path then
- setsetting(path, value, updgui)
- else
- error('bad argument #1 to \'set\' (the specified setting does not exist)')
- end
- end
- function get(setting) -- Working
- local path = getpath(setting) or ''
- return getsetting(path, value, updgui)
- end
- function string.sub2(self, i, l) -- Working
- if l then
- return string.sub(self, i, i + l - math.min(1, i))
- else
- return string.sub(self, i)
- end
- end
- function ground(...) -- Working
- local arg = {...}
- if type(arg[1]) == 'table' then
- arg = {arg.x or arg.posx or $posx, arg.y or arg.posy or $posy, arg.z or arg.posz or $posz}
- elseif type(arg[1]) == 'userdata' then
- arg = {arg.posx, arg.posy, arg.posz}
- else
- arg = {arg[1] or $posx, arg[2] or $posy, arg[3] or $posz}
- end
- return "ground " .. table.concat(arg, " ")
- end
- border = "border"
- shadow = "shadow"
- _ADDTEXT = _ADDTEXT or addtext
- function addtext(...)
- local arg = {...}
- arg[2], arg[3] = arg[2] or 0, arg[3] or 0
- if arg[4] then
- local o = arg[7] or 1
- setfontcolor(arg[6] or 0x000000)
- _ADDTEXT(arg[1], arg[2] - o, arg[3] + o)
- if arg[4] == border then
- _ADDTEXT(arg[1], arg[2] + o, arg[3] - o)
- _ADDTEXT(arg[1], arg[2] + o, arg[3] + o)
- _ADDTEXT(arg[1], arg[2] - o, arg[3] - o)
- _ADDTEXT(arg[1], arg[2] - o, arg[3])
- _ADDTEXT(arg[1], arg[2] + o, arg[3])
- _ADDTEXT(arg[1], arg[2], arg[3] + o)
- _ADDTEXT(arg[1], arg[2], arg[3] - o)
- end
- setfontcolor(arg[5] or 0xFFFFFF)
- end
- _ADDTEXT(arg[1], arg[2], arg[3])
- end
- function isBetween(v1, v2, x, y, w, h)
- if v1 >= x then
- if v1 <= x + w then
- if v2 >= y then
- if v2 <= y + h then
- return true
- end
- end
- end
- end
- return false
- end
- function isadmin()
- return (pcall(
- function()
- local handler = io.open('test.txt', 'w+')
- handler:write('test')
- handler:close()
- end
- ))
- end
- local Default = {}
- Default.Button = {}
- Default.Button.Size = {x = 50, y = 20}
- Default.Button.Spacing = {x = 6, y = 6}
- Default.Button.Position = {x = 0, y = 0}
- Default.Button.Action = function() end
- Default.Button.Text = "Button"
- ------------------------------------------------------------------------------
- -- Oriented Object Programming - First Try --
- ------------------------------------------------------------------------------
- Align = {
- left = "left",
- right = "right",
- bot = "bottom",
- top = "top"
- }
- Listbox = {}
- -- Creates the object
- function Listbox:new(obj)
- obj = obj or {}
- if not obj.lines then
- obj.lines = {}
- end
- if not obj.defaultColor then
- obj.defaultColor = 0xFFFFFF
- end
- if not obj.maxIndex then
- obj.maxIndex = 5
- end
- if not obj.verAlign then
- obj.verAlign = Align.bot
- end
- if not obj.horAlign then
- obj.horAlign = Align.left
- end
- if not obj.spacing then
- obj.spacing = 13
- end
- return setmetatable(obj, {__index = self})
- end
- function Listbox:setDefaultColor(color)
- self.defaultColor = color
- end
- function Listbox:getDefaultColor()
- return self.defaultColor
- end
- function Listbox:setMaxIndex(maxIndex)
- self.maxIndex = maxIndex
- end
- function Listbox:getMaxIndex()
- return self.maxIndex
- end
- function Listbox:setAlignment(...)
- local arg = {...}
- if not select(2, self:getAlignment(arg[1]:sub(1, 3))) then
- self[arg[1]:sub(1, 3) .. "Align"] = arg[2]
- else
- self.horAlign, self.verAlign = arg[1], arg[2]
- end
- end
- function Listbox:getAlignment(way)
- way = (way or "abc"):sub(1, 3)
- if way == "hor" then
- return self.horAlign
- elseif way == "ver" then
- return self.verAlign
- else
- return self.horAlign, self.verAlign
- end
- end
- function Listbox:setLineSpacing(spacing)
- self.spacing = spacing
- end
- function Listbox:getLineSpacing()
- return self.spacing
- end
- function Listbox:getLine(index)
- return self.lines[index]
- end
- function Listbox:size()
- return #self.lines
- end
- function Listbox:checkSize()
- local maxindex = self:getMaxIndex()
- while self:size() > maxindex do
- self:rmvLine()
- end
- end
- function Listbox:addLine(value, color, index)
- table.insert(self.lines, index or 1, {text = value, color = color})
- self:checkSize()
- end
- function Listbox:rmvLine(index)
- if index then
- table.remove(self.lines, index)
- else
- table.remove(self.lines)
- end
- end
- function Listbox:setPosition(x, y)
- local hor, ver = self:getAlignment()
- local size, spac = self:size(), self:getLineSpacing()
- if ver == Align.bot then
- y = y - (size * spac)
- end
- local Align = {"left", "right"}
- setjustify(Align[math.abs(table.find(Align, hor) - 2) + 1])
- setposition(x, y)
- end
- function Listbox:draw()
- local size = self:size()
- local maxindex = self:getMaxIndex()
- local spacing = self:getLineSpacing()
- local color = self:getDefaultColor()
- if size > 0 then
- for i = 1, size do
- local line = self:getLine(i)
- setfontcolor(line.color or color)
- addtext(line.text, 0, (i - 1) * spacing)
- end
- end
- end
- ------------------------------------------------------------------------------
- -- Oriented Object Programming - Second Try --
- ------------------------------------------------------------------------------
- State = {
- Released = 0,
- Pressed = 1
- }
- Button = {}
- -- Object creator
- function Button:new(obj)
- obj = obj or {}
- -- Checks for non-defined values
- obj.Size = obj.Size or Default.Button.Size
- obj.Spacing = obj.Spacing or Default.Button.Spacing
- obj.Position = obj.Position or Default.Button.Position
- obj.Action = obj.Action or Default.Button.Action
- obj.Text = obj.Text or Default.Button.Text
- return setmetatable(obj, {__index = self})
- end
- -- Pressed or Not
- Button.State = 0
- Button.AutoSize = true
- function Button:setText(t)
- self.Text = t
- if self.AutoSize then
- local charsWidth = {
- [" "] = 3,
- ["!"] = 3,
- ['"'] = 6,
- ["#"] = 9,
- ["$"] = 7,
- ["%"] = 12,
- ["&"] = 9,
- ["'"] = 3,
- ["("] = 5,
- [")"] = 5,
- ["*"] = 6,
- [","] = 4,
- ["-"] = 5,
- ["."] = 3,
- ["/"] = 6,
- ["0"] = 7,
- ["1"] = 7,
- ["2"] = 7,
- ["3"] = 7,
- ["4"] = 7,
- ["5"] = 7,
- ["6"] = 7,
- ["7"] = 7,
- ["8"] = 7,
- ["9"] = 7,
- [":"] = 3,
- [";"] = 3,
- ["<"] = 9,
- ["="] = 9,
- [">"] = 9,
- ["?"] = 6,
- ["@"] = 10,
- ["A"] = 9,
- ["B"] = 7,
- ["C"] = 7,
- ["D"] = 8,
- ["E"] = 6,
- ["F"] = 6,
- ["G"] = 8,
- ["H"] = 8,
- ["I"] = 5,
- ["J"] = 6,
- ["K"] = 7,
- ["L"] = 6,
- ["M"] = 10,
- ["N"] = 7,
- ["O"] = 8,
- ["P"] = 7,
- ["Q"] = 8,
- ["R"] = 8,
- ["S"] = 7,
- ["T"] = 7,
- ["U"] = 8,
- ["V"] = 7,
- ["X"] = 7,
- ["W"] = 11,
- ["Y"] = 7,
- ["Z"] = 7,
- ["["] = 5,
- ["\\"] = 6,
- ["]"] = 5,
- ["^"] = 9,
- ["_"] = 7,
- ["`"] = 6,
- ["a"] = 7,
- ["b"] = 7,
- ["c"] = 6,
- ["d"] = 7,
- ["e"] = 7,
- ["f"] = 4,
- ["g"] = 7,
- ["h"] = 7,
- ["i"] = 3,
- ["j"] = 4,
- ["k"] = 7,
- ["l"] = 3,
- ["m"] = 11,
- ["n"] = 7,
- ["o"] = 7,
- ["p"] = 7,
- ["q"] = 7,
- ["r"] = 5,
- ["s"] = 6,
- ["t"] = 5,
- ["u"] = 7,
- ["v"] = 7,
- ["x"] = 7,
- ["w"] = 9,
- ["y"] = 7,
- ["z"] = 6,
- ["{"] = 7,
- ["|"] = 7,
- ["}"] = 7,
- ["~"] = 9,
- }
- local w = self.Spacing.x * 2
- for i = 1, #t do
- w = w + (charsWidth[string.sub(t, i, i)] or 0)
- end
- self:setSize(w, 8 + self.Spacing.y * 2)
- end
- end
- function Button:getText()
- return self.Text
- end
- function Button:setSize(x, y)
- self.Size.x = x
- self.Size.y = y
- end
- function Button:getSize()
- return self.Size
- end
- function Button:setSpacing(x, y)
- self.Spacing.x = x
- self.Spacing.y = y
- if self.AutoSize then
- self:setText(self.Text)
- end
- end
- function Button:getSpacing()
- return self.Spacing
- end
- function Button:setState(state)
- self.State = state
- end
- function Button:getState()
- return self.State
- end
- function Button:setPosition(x, y)
- self.Position.x = x
- self.Position.y = y
- end
- function Button:getPosition()
- return self.Position
- end
- function Button:setEvent(f)
- self.Action = f
- end
- function Button:runEvent()
- self.Action()
- end
- function Button:setAutoSize(v)
- self.AutoSize = v
- if v then
- self:setText(self.Text)
- end
- end
- function Button:draw()
- -- Sets predefined options
- setfontweight(255)
- setbordercolor(0x000000)
- setfillstyle("image", "Button.png")
- setfontstyle("Tahoma", 8, 0xDFDFDF)
- -- Sets some variables for later use
- local colors = {0x6D6D6D, 0x2A2A2A, 0x6D6D6D}
- local Pos = self.Position
- local Size = self.Size
- -- Draws the button shape
- addshape("rect", Pos.x, Pos.y, Size.x, Size.y)
- -- Draws upper and left borders
- setbordercolor(colors[self.State +1])
- addshape("rect", Pos.x + 1, Pos.y, Size.x - 1, -1)
- addshape("rect", Pos.x, Pos.y, -1, Size.y)
- -- Draws bottom and right borders
- setbordercolor(colors[self.State +2])
- addshape("rect", Pos.x + 1, Pos.y + Size.y + 1, Size.x - 1, -1)
- addshape("rect", Pos.x + Size.x + 1, Pos.y, -1, Size.y)
- -- Adds the text
- addtext(self.Text, Pos.x + self.Spacing.x + self.State, Pos.y + self.Spacing.y + self.State)
- end
- ------------------------------Hardek.lua---------------------------------
- -- Hardek's neobot library 0.9.6
- print('Hardek Library Version: 0.9.6')
- function waitping(base)
- local base = base or 200
- if ping == 0 then ping = base end
- wait(2 * ping, 4 * ping)
- end
- function timeleft(t, ctime)
- local ctime = ctime or currenttime()
- return tosec(t) - tosec(ctime)
- end
- function depositall()
- npctalk('hi', 'deposit all', 'yes')
- end
- function withdraw(amount, npc, sayhi)
- if not amount or amount == 0 then
- return true
- end
- if sayhi == true then
- npctalk('hi', 'withdraw ' .. amount, 'yes')
- else
- npctalk('withdraw ' .. amount, 'yes')
- end
- waitping()
- foreach newmessage m do
- if m.content == 'There is not enough gold on your account.' then
- if (not npc) or (npc == '') or (m.sender == npc) then
- return false
- end
- end
- end
- return true
- end
- function tryexec(cmd, x, y, z, maxtries)
- local tries = 0
- maxtries = maxtries or 5
- while tries <= maxtries do
- if $posx ~= x or $posy ~= y or $posz ~= z then
- moveto(x, y, z)
- tries = tries + 1
- waitping()
- else
- exec(cmd)
- return true
- end
- end
- return false
- end
- function opendepot()
- local wtp = getsetting('Cavebot/Pathfinding/WalkThroughPlayers')
- if wtp == 'yes' then setsetting('Cavebot/Pathfinding/WalkThroughPlayers', 'no') end
- reachgrounditem('depot') waitping()
- openitem('depot') waitping()
- setsetting('Cavebot/Pathfinding/WalkThroughPlayers', wtp)
- end
- function movetoinsist(x, y, z, maxtries)
- local tries = 0
- maxtries = maxtries or 5
- while tries <= maxtries and $posx ~= x and $posy ~= y do
- tries = tries + 1
- if $posz ~= z then return false end
- moveto(x, y, z)
- waitping()
- end
- return true
- end
- function refillsofts()
- local quit = false
- npctalk('hi')
- while not quit and itemcount('worn soft boots') > 0 do
- npctalk('repair', 'yes')
- wait(2000, 3000)
- foreach newmessage m do
- if m.content == 'At last, someone poorer than me.' then
- if (not npc) or (m.sender == 'Aldo') then
- if not (movetoinsist(33019, 32053, 6) and
- withdraw(10000, 'Rokyn', true) and
- movetoinsist(32953, 32108, 6)) then
- quit = true
- else
- npcsay('hi')
- end
- end
- end
- end
- end
- end
- function __loop_open(container, ignore, maxtries)
- if type(container) == 'string' then container = container:lower() end
- ignore = ignore:lower()
- maxtries = maxtries or 5
- if container == ignore then return (windowcount(container) ~= 0) end
- local countbefore = windowcount()
- local tries = 0
- while (countbefore == windowcount()) and windowcount(container) == 0 and tries <= maxtries do
- if tries == maxtries then return false end
- openitem(container, 'Locker', true)
- waitping()
- tries = tries + 1
- end
- return true
- end
- function __dp_item(item, from, container, container_id)
- local continue = true
- while continue and itemcount(item, from) > 0 do
- if emptycount(container_id) == 0 then
- continue = (itemcount(container) > 0)
- if continue then
- openitem(container, container_id)
- waitping()
- end
- else
- moveitems(item, container_id, from)
- waitping()
- end
- end
- end
- function deposititems(dest, stack, from, open, ...)
- local items = {...}
- if type(items[1]) == 'table' then items = items[1] end
- if open and windowcount('locker') == 0 then opendepot() waitping() end
- dest = dest or 'locker'
- stack = stack or 'locker'
- if type(from) ~= 'table' then from = {from} end
- if type(dest) == 'string' then dest = dest:lower() end
- if type(stack) == 'string' then stack = stack:lower() end
- if (not __loop_open(stack, 'locker')) or (not __loop_open(dest, 'locker')) then return false end
- destd = windowcount() - 1
- if stack == dest then stackd = destd else stackd = destd - 1 end
- for i = 1, #items do
- if itemproperty(items[i], ITEM_STACKABLE) then
- for j = 1, #from do
- __dp_item(items[i], from[j], stack, stackd)
- end
- end
- end
- for i = 1, #items do
- if not itemproperty(items[i], ITEM_STACKABLE) then
- for j = 1, #from do
- __dp_item(items[i], from[j], dest, destd)
- end
- end
- end
- end
- function dropitemsex(cap, ...)
- local cap = cap or 250
- local drop = {...}
- if $cap < cap then
- for i = 1, #drop do
- while $cap < cap and itemcount(drop[i]) > 0 do
- local count = math.ceil((cap - $cap) / itemweight(drop[i]))
- moveitems(itemid(drop[i]), 'ground', '', count)
- end
- end
- end
- end
- function dontlist()
- listas('dontlist')
- end
- function goback()
- gotolabel(0)
- end
- function creatureinfo(creaturename)
- if creaturename == '' then return nil end
- return creatures_table[table.binaryfind(creatures_table,creaturename:lower(),'name')]
- end
- function creaturemaxhp(creaturename)
- if creaturename == '' then return 0 end
- local cre = creatureinfo(creaturename)
- if cre then return cre.hp end
- printerror('Monster: '..creaturename..' not found')
- return 0
- end
- function creaturehp(creaturename)
- if creaturename == '' then return 0 end
- if type(creaturename) ~= 'userdata' then
- creaturename = findcreature(creaturename)
- end
- local cre = creaturename
- local creinfo = creatureinfo(cre.name)
- if not creinfo then
- printerror('Monster: '.. cre.name ..' not found')
- return 0
- end
- return creinfo.hp*100/cre.hppc
- end
- function creatureexp(creaturename)
- if creaturename == '' then return 0 end
- local cre = creatureinfo(creaturename)
- if cre then return cre.exp end
- printerror('Monster: '..creaturename..' not found')
- return 0
- end
- function expratio(creaturename)
- if creaturename == '' then return 0 end
- local cre = creatureinfo(creaturename)
- if cre then return cre.ratio end
- printerror('Monster: '..creaturename..' not found')
- return 0
- end
- function maxdamage(creaturename)
- if creaturename == '' then return 0 end
- if creaturename then
- local cre = creatureinfo(creaturename)
- if cre then return cre.maxdmg end
- printerror('Monster: '..creaturename..' not found')
- return 0
- else
- local total = 0
- foreach creature c "ms" do
- total = total + maxdamage(c.name)
- end
- return total
- end
- end
- function getelementword(element)
- local spells = {physical = 'moe ico', holy = 'san', death = 'mort', fire = 'flam', ice = 'frigo', energy = 'vis', earth = 'tera'}
- if spells[element] then return spells[element] end
- printerror('Element: '..element..' not found')
- return nil
- end
- function bestelement(creaturename, strongonly)
- if creaturename == '' then return nil end
- local cre = creatureinfo(creaturename)
- local voc = vocation()
- strongonly = strongonly or false
- if voc == 'knight' then
- return 'physical', cre.physicalmod
- elseif voc == 'paladin' then
- if cre.physicalmod > cre.holymod then
- return 'physical', cre.physicalmod
- else
- return 'holy', cre.holymod
- end
- elseif voc == 'sorcerer' then
- local best = ''
- local max = 0
- local elements = {}
- if strongonly then
- elements = {'energy', 'fire'}
- else
- elements = {'energy', 'fire', 'ice', 'earth', 'death'}
- end
- for i = 1, #elements do
- if cre[elements[i]..'mod'] > max then
- max = cre[elements[i]..'mod']
- best = elements[i]
- end
- end
- return best, max
- elseif voc == 'druid' then
- local best = ''
- local max = 0
- local elements = {}
- if strongonly then
- elements = {'ice', 'earth'}
- else
- elements = {'energy', 'fire', 'ice', 'earth', 'physical'}
- end
- for i = 1, #elements do
- if cre[elements[i]..'mod'] > max then
- max = cre[elements[i]..'mod']
- best = elements[i]
- end
- end
- return best, max
- elseif voc == 'mage' then
- local best = ''
- local max = 0
- local elements = {'ice', 'earth', 'energy', 'fire'}
- for i = 1, #elements do
- if cre[elements[i]..'mod'] > max then
- max = cre[elements[i]..'mod']
- best = elements[i]
- end
- end
- return best, max
- end
- if cre then return cre.bestspell end
- printerror('Monster: '..creaturename..' not found')
- return nil
- end
- function beststrike(creaturename)
- if creaturename == '' then return nil end
- return 'exori '..getelementword(bestelement(creaturename, false))
- end
- function beststrongstrike(creaturename)
- if creaturename == '' then return nil end
- return 'exori gran '..getelementword(bestelement(creaturename, true))
- end
- function bestspell(creaturename)
- return beststrike(creaturename)
- end
- function buyitemstocap(itemname, cap)
- local tries = 0
- local amount = math.floor(($cap - cap) / itemweight(itemname))
- local maxtries = maxtries or (2 * amount / 100)
- if not $tradeopen then opentrade() end
- while $cap > cap and tries <= maxtries do
- count = itemcount(itemname)
- amount = math.floor(($cap - cap) / itemweight(itemname)) % 100
- if amount == 0 then amount = 100 end
- buyitems(itemname, amount)
- waitping()
- tries = tries + 1
- end
- end
- function itemscosttocap(itemname, cap)
- local item = iteminfo(itemname)
- if item then
- return item.npcprice * math.floor((($cap - cap) / item.weight))
- end
- printerror('Item: '..itemname..' not found')
- return 0
- end
- function trapped()
- for i = -2, 2 do
- for j = -2, 2 do
- local cx = $posx + i
- local cy = $posy + j
- if tilereachable(cx, cy, $posz) then return false end
- end
- end
- return true
- end
- function euclideandist(sx, sy, dx, dy)
- return math.sqrt(math.pow(dx - sx, 2) + math.pow(dy - sy, 2))
- end
- function distto(sx, sy, dx, dy)
- local distx = math.abs(sx - dx)
- local disty = math.abs(sy - dy)
- if distx > disty then
- return distx
- else
- return disty
- end
- end
- function leavetrap(spell)
- spell = spell or 'none'
- local cr = nil
- local distmin = 100
- local sp = ''
- local cb = $cavebot
- if cb and trapped() then setcavebot('off') end
- while trapped() do
- wait(1000)
- foreach creature c "ms" do
- if c.dist == 1 then
- if cb then
- if not cr then cr = c end
- local dist = distto($wptx, $wpty, c.posx, c.posy)
- if dist < distmin then
- distmin = dist
- cr = c
- end
- else
- cr = c
- break
- end
- end
- end
- attack(cr)
- if spell ~= 'none' then
- if spell == 'strike' then sp = bestspell(cr.name) else sp = spell end
- cast(sp)
- end
- end
- if cb then setcavebot('on') end
- end
- function getplayerskill() -- credits for sirmate on this one
- local weaponType = findweapontype()
- local playerVocation = vocation()
- if (playerVocation == 'knight') then
- if (weaponType == 'club') then
- return {$club, $clubpc}
- elseif (weaponType == 'sword') then
- return {$sword, $swordpc}
- elseif (weaponType == 'axe') then
- return {$axe, $axepc}
- end
- elseif (playerVocation == 'paladin') then
- return {$distance, $distancepc}
- elseif (playerVocation == 'mage' or playerVocation == 'druid' or playerVocation == 'sorcerer') then
- if ($club >= $sword and $axe) then
- return {$club, $clubpc}
- elseif ($sword >= $club and $axe) then
- return {$sword, $swordpc}
- elseif ($axe >= $club and $sword) then
- return {$axe, $axepc}
- end
- end
- end
- function spelldamage(spell, level, mlevel, skill)
- level = level or $level
- mlevel = mlevel or $mlevel
- skill = skill or getplayerskill()[1]
- local sp = spell:gsub(' ', '_')
- if not spellformulas[sp] then
- printerror('Spell: '..spell..' not found.')
- return nil
- end
- return spellformulas[sp](level, mlevel, skill)
- end
- -- information tables
- spellformulas = {
- beserk = function(a, b, c) return {((a + b) * 0.5 + (c / 5)), ((a + b) * 1.5 + (c / 5))} end,
- whirlwind_throw = function(a, b, c) return {(a + b) / 3 + c / 5, a + b + c / 5} end,
- fierce_beserk = function(a, b, c) return {((a + b * 2) * 1.1 + (c / 5)), ((a + b * 2) * 3 + (c / 5))} end,
- etheral_spear = function(a, b) return {(a + 25) / 3 + b / 5, (a + 25 + b / 5)} end,
- strike = function(l, m) return {0.2 * l + 1.403 * m + 08, 0.2 * l + 2.203 * m + 13} end,
- divine_missile = function(l, m) return {0.2 * l + 1.790 * m + 11, 0.2 * l + 3.000 * m + 18} end,
- ice_wave = function(l, m) return {0.2 * l + 0.810 * m + 04, 0.2 * l + 2.000 * m + 12} end,
- fire_wave = function(l, m) return {0.2 * l + 1.250 * m + 04, 0.2 * l + 2.000 * m + 12} end,
- light_magic_missile = function(l, m) return {0.2 * l + 0.400 * m + 02, 0.2 * l + 0.810 * m + 04} end,
- heavy_magic_missile = function(l, m) return {0.2 * l + 0.810 * m + 04, 0.2 * l + 1.590 * m + 10} end,
- stalagmite = function(l, m) return {0.2 * l + 0.810 * m + 04, 0.2 * l + 1.590 * m + 10} end,
- icicle = function(l, m) return {0.2 * l + 1.810 * m + 10, 0.2 * l + 3.000 * m + 18} end,
- fireball = function(l, m) return {0.2 * l + 1.810 * m + 10, 0.2 * l + 3.000 * m + 18} end,
- holy_missile = function(l, m) return {0.2 * l + 1.790 * m + 11, 0.2 * l + 3.750 * m + 24} end,
- sudden_death = function(l, m) return {0.2 * l + 4.605 * m + 28, 0.2 * l + 7.395 * m + 46} end,
- thunderstorm = function(l, m) return {0.2 * l + 1.000 * m + 06, 0.2 * l + 2.600 * m + 16} end,
- stone_shower = function(l, m) return {0.2 * l + 1.000 * m + 06, 0.2 * l + 2.600 * m + 16} end,
- avalanche = function(l, m) return {0.2 * l + 1.200 * m + 07, 0.2 * l + 2.800 * m + 17} end,
- great_fireball = function(l, m) return {0.2 * l + 1.200 * m + 07, 0.2 * l + 2.800 * m + 17} end,
- explosion = function(l, m) return {0.2 * l + 0.0 * m, 0.2 * l + 4.8 * m} end,
- energy_beam = function(l, m) return {0.2 * l + 2.5 * m, 0.2 * l + 4.0 * m} end,
- great_energy_beam = function(l, m) return {0.2 * l + 4.0 * m, 0.2 * l + 7.0 * m} end,
- divine_caldera = function(l, m) return {0.2 * l + 4.0 * m, 0.2 * l + 6.0 * m} end,
- terra_wave = function(l, m) return {0.2 * l + 3.5 * m, 0.2 * l + 7.0 * m} end,
- energy_wave = function(l, m) return {0.2 * l + 4.5 * m, 0.2 * l + 9.0 * m} end,
- heal_friend = function(l, m) return {0.2 * l + 010 * m, 0.2 * l + 014 * m} end,
- rage_of_the_skies = function(l, m) return {0.2 * l + 5.0 * m, 0.2 * l + 012 * m} end,
- hells_core = function(l, m) return {0.2 * l + 7.0 * m, 0.2 * l + 014 * m} end,
- wrath_of_nature = function(l, m) return {0.2 * l + 5.0 * m, 0.2 * l + 010 * m} end,
- eternal_winter = function(l, m) return {0.2 * l + 6.0 * m, 0.2 * l + 012 * m} end,
- divine_healing = function(l, m) return {0.2 * l + 18.5 * m, 0.2 * l + 025 * m} end,
- light_healing = function(l, m) return {0.2 * l + 1.400 * m + 08, 0.2 * l + 1.795 * m + 11} end,
- intense_healing = function(l, m) return {0.2 * l + 3.184 * m + 20, 0.2 * l + 5.590 * m + 35} end,
- ultimate_healing = function(l, m) return {0.2 * l + 7.220 * m + 44, 0.2 * l + 12.79 * m + 79} end,
- wound_cleansing = function(l, m) return {0.2 * l + 4.000 * m + 25, 0.2 * l + 7.750 * m + 50} end,
- mass_healing = function(l, m) return {0.2 * l + 5.700 * m + 26, 0.2 * l + 10.43 * m + 62} end,
- }
- creatures_table = {
- {name = "achad", exp = 70, hp = 185, ratio = 0.378, maxdmg = 80, deathmod = 100, firemod = 90, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "acid blob", exp = 250, hp = 250, ratio = 1.000, maxdmg = 160, deathmod = 0, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "acolyte of darkness", exp = 200, hp = 325, ratio = 0.615, maxdmg = 120, deathmod = 0, firemod = 0, energymod = 80, earthmod = 0, icemod = 90, holymod = 105, physicalmod = 105},
- {name = "acolyte of the cult", exp = 300, hp = 390, ratio = 0.769, maxdmg = 220, deathmod = 105, firemod = 100, energymod = 110, earthmod = 80, icemod = 80, holymod = 80, physicalmod = 110},
- {name = "adept of the cult", exp = 400, hp = 430, ratio = 0.930, maxdmg = 242, deathmod = 105, firemod = 100, energymod = 105, earthmod = 60, icemod = 80, holymod = 70, physicalmod = 100},
- {name = "amazon", exp = 60, hp = 110, ratio = 0.545, maxdmg = 60, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 105},
- {name = "ancient scarab", exp = 720, hp = 1000, ratio = 0.720, maxdmg = 380, deathmod = 100, firemod = 120, energymod = 80, earthmod = 0, icemod = 105, holymod = 100, physicalmod = 90},
- {name = "anmothra", exp = 10000, hp = 2100, ratio = 4.762, maxdmg = 350, deathmod = 110, firemod = 0, energymod = 75, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "annihilon", exp = 15000, hp = 40000, ratio = 0.375, maxdmg = 2650, deathmod = 5, firemod = 100, energymod = 5, earthmod = 100, icemod = 80, holymod = 105, physicalmod = 100},
- {name = "apocalypse", exp = 80000, hp = 160000, ratio = 0.500, maxdmg = 9800, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "apprentice sheng", exp = 150, hp = 95, ratio = 1.579, maxdmg = 80, deathmod = 100, firemod = 100, energymod = 0, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "arachir the ancient one", exp = 1800, hp = 1600, ratio = 1.125, maxdmg = 480, deathmod = 0, firemod = 101, energymod = 80, earthmod = 100, icemod = 95, holymod = 105, physicalmod = 99},
- {name = "arkhothep", exp = 0, hp = 1, ratio = 0.000, maxdmg = 5000, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "armenius", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "arthei", exp = 4000, hp = 4200, ratio = 0.952, maxdmg = 1000, deathmod = 0, firemod = 101, energymod = 100, earthmod = 0, icemod = 100, holymod = 105, physicalmod = 100},
- {name = "ashmunrah", exp = 3100, hp = 5000, ratio = 0.620, maxdmg = 2412, deathmod = 0, firemod = 105, energymod = 80, earthmod = 75, icemod = 80, holymod = 110, physicalmod = 90},
- {name = "assassin", exp = 105, hp = 175, ratio = 0.600, maxdmg = 160, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 105},
- {name = "avalanche", exp = 305, hp = 550, ratio = 0.555, maxdmg = 250, deathmod = 100, firemod = 70, energymod = 110, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "axeitus headbanger", exp = 140, hp = 365, ratio = 0.384, maxdmg = 130, deathmod = 100, firemod = 105, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "azerus", exp = 6000, hp = 7500, ratio = 0.800, maxdmg = 1000, deathmod = 85, firemod = 85, energymod = 85, earthmod = 85, icemod = 85, holymod = 85, physicalmod = 100},
- {name = "azure frog", exp = 20, hp = 60, ratio = 0.333, maxdmg = 24, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "badger", exp = 5, hp = 23, ratio = 0.217, maxdmg = 12, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "bandit", exp = 65, hp = 245, ratio = 0.265, maxdmg = 43, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 110},
- {name = "bane of light", exp = 450, hp = 925, ratio = 0.486, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 95, earthmod = 0, icemod = 0, holymod = 125, physicalmod = 65},
- {name = "banshee", exp = 900, hp = 1000, ratio = 0.900, maxdmg = 652, deathmod = 0, firemod = 0, energymod = 100, earthmod = 0, icemod = 100, holymod = 125, physicalmod = 100},
- {name = "barbaria", exp = 355, hp = 345, ratio = 1.029, maxdmg = 170, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "barbarian bloodwalker", exp = 195, hp = 305, ratio = 0.639, maxdmg = 200, deathmod = 101, firemod = 100, energymod = 90, earthmod = 105, icemod = 50, holymod = 80, physicalmod = 95},
- {name = "barbarian brutetamer", exp = 90, hp = 145, ratio = 0.621, maxdmg = 54, deathmod = 101, firemod = 100, energymod = 80, earthmod = 100, icemod = 50, holymod = 90, physicalmod = 120},
- {name = "barbarian headsplitter", exp = 85, hp = 100, ratio = 0.850, maxdmg = 110, deathmod = 101, firemod = 100, energymod = 80, earthmod = 110, icemod = 50, holymod = 90, physicalmod = 100},
- {name = "barbarian skullhunter", exp = 85, hp = 135, ratio = 0.630, maxdmg = 65, deathmod = 101, firemod = 100, energymod = 80, earthmod = 110, icemod = 50, holymod = 90, physicalmod = 95},
- {name = "baron brute", exp = 3000, hp = 5025, ratio = 0.597, maxdmg = 474, deathmod = 100, firemod = 20, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "bat", exp = 10, hp = 30, ratio = 0.333, maxdmg = 8, deathmod = 100, firemod = 100, energymod = 100, earthmod = 120, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "battlemaster zunzu", exp = 2500, hp = 5000, ratio = 0.500, maxdmg = 650, deathmod = 90, firemod = 75, energymod = 80, earthmod = 0, icemod = 85, holymod = 100, physicalmod = 85},
- {name = "bazir", exp = 0, hp = 1, ratio = 0.000, maxdmg = 4000, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "bear", exp = 23, hp = 80, ratio = 0.287, maxdmg = 25, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "behemoth", exp = 2500, hp = 4000, ratio = 0.625, maxdmg = 635, deathmod = 105, firemod = 70, energymod = 90, earthmod = 20, icemod = 110, holymod = 70, physicalmod = 90},
- {name = "berserker chicken", exp = 220, hp = 465, ratio = 0.473, maxdmg = 270, deathmod = 90, firemod = 90, energymod = 90, earthmod = 90, icemod = 90, holymod = 90, physicalmod = 120},
- {name = "betrayed wraith", exp = 3500, hp = 4200, ratio = 0.833, maxdmg = 455, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 50, holymod = 120, physicalmod = 100},
- {name = "big boss trolliver", exp = 105, hp = 150, ratio = 0.700, maxdmg = 40, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "black knight", exp = 1600, hp = 1800, ratio = 0.889, maxdmg = 500, deathmod = 80, firemod = 5, energymod = 20, earthmod = 0, icemod = 0, holymod = 108, physicalmod = 80},
- {name = "black sheep", exp = 0, hp = 20, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "blazing fire elemental", exp = 450, hp = 650, ratio = 0.692, maxdmg = 450, deathmod = 70, firemod = 0, energymod = 80, earthmod = 100, icemod = 125, holymod = 100, physicalmod = 100},
- {name = "blightwalker", exp = 5850, hp = 8900, ratio = 0.657, maxdmg = 900, deathmod = 0, firemod = 50, energymod = 80, earthmod = 0, icemod = 50, holymod = 130, physicalmod = 110},
- {name = "blistering fire elemental", exp = 1300, hp = 1500, ratio = 0.867, maxdmg = 975, deathmod = 60, firemod = 0, energymod = 80, earthmod = 50, icemod = 115, holymod = 0, physicalmod = 75},
- {name = "blood crab", exp = 160, hp = 290, ratio = 0.552, maxdmg = 110, deathmod = 100, firemod = 110, energymod = 105, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 80},
- {name = "blood crab", exp = 180, hp = 320, ratio = 0.562, maxdmg = 111, deathmod = 100, firemod = 0, energymod = 105, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 99},
- {name = "bloodpaw", exp = 50, hp = 100, ratio = 0.500, maxdmg = 40, deathmod = 100, firemod = 80, energymod = 110, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "bloom of doom", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "blue djinn", exp = 215, hp = 330, ratio = 0.652, maxdmg = 325, deathmod = 112, firemod = 20, energymod = 50, earthmod = 100, icemod = 110, holymod = 99, physicalmod = 100},
- {name = "bog raider", exp = 800, hp = 1300, ratio = 0.615, maxdmg = 600, deathmod = 95, firemod = 15, energymod = 110, earthmod = 70, icemod = 105, holymod = 105, physicalmod = 120},
- {name = "bonebeast", exp = 580, hp = 515, ratio = 1.126, maxdmg = 340, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 120, physicalmod = 100},
- {name = "bonelord", exp = 170, hp = 260, ratio = 0.654, maxdmg = 235, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "bones", exp = 3750, hp = 9500, ratio = 0.395, maxdmg = 1200, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "boogey", exp = 475, hp = 930, ratio = 0.511, maxdmg = 200, deathmod = 0, firemod = 110, energymod = 110, earthmod = 60, icemod = 75, holymod = 110, physicalmod = 100},
- {name = "boreth", exp = 1800, hp = 1400, ratio = 1.286, maxdmg = 800, deathmod = 0, firemod = 101, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "bovinus", exp = 60, hp = 150, ratio = 0.400, maxdmg = 50, deathmod = 100, firemod = 80, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "braindeath", exp = 985, hp = 1225, ratio = 0.804, maxdmg = 700, deathmod = 0, firemod = 115, energymod = 90, earthmod = 0, icemod = 80, holymod = 120, physicalmod = 90},
- {name = "bride of night", exp = 450, hp = 275, ratio = 1.636, maxdmg = 100, deathmod = 80, firemod = 100, energymod = 100, earthmod = 100, icemod = 120, holymod = 100, physicalmod = 100},
- {name = "brimstone bug", exp = 900, hp = 1300, ratio = 0.692, maxdmg = 420, deathmod = 0, firemod = 110, energymod = 110, earthmod = 0, icemod = 110, holymod = 110, physicalmod = 105},
- {name = "brutus bloodbeard", exp = 795, hp = 1200, ratio = 0.662, maxdmg = 350, deathmod = 100, firemod = 100, energymod = 101, earthmod = 100, icemod = 101, holymod = 99, physicalmod = 100},
- {name = "bug", exp = 18, hp = 29, ratio = 0.621, maxdmg = 23, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "butterfly", exp = 0, hp = 2, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cake golem", exp = 0, hp = 1, ratio = 0.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "captain jones", exp = 825, hp = 800, ratio = 1.031, maxdmg = 400, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 0},
- {name = "carniphila", exp = 150, hp = 255, ratio = 0.588, maxdmg = 330, deathmod = 100, firemod = 120, energymod = 90, earthmod = 0, icemod = 65, holymod = 100, physicalmod = 100},
- {name = "carrion worm", exp = 70, hp = 145, ratio = 0.483, maxdmg = 45, deathmod = 100, firemod = 105, energymod = 99, earthmod = 80, icemod = 105, holymod = 100, physicalmod = 100},
- {name = "cat", exp = 0, hp = 20, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cave rat", exp = 10, hp = 30, ratio = 0.333, maxdmg = 10, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "centipede", exp = 34, hp = 70, ratio = 0.486, maxdmg = 46, deathmod = 100, firemod = 115, energymod = 90, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "chakoya toolshaper", exp = 40, hp = 80, ratio = 0.500, maxdmg = 80, deathmod = 105, firemod = 60, energymod = 115, earthmod = 100, icemod = 0, holymod = 90, physicalmod = 100},
- {name = "chakoya tribewarden", exp = 40, hp = 68, ratio = 0.588, maxdmg = 30, deathmod = 105, firemod = 75, energymod = 115, earthmod = 100, icemod = 0, holymod = 90, physicalmod = 100},
- {name = "chakoya windcaller", exp = 48, hp = 84, ratio = 0.571, maxdmg = 82, deathmod = 110, firemod = 50, energymod = 115, earthmod = 100, icemod = 0, holymod = 80, physicalmod = 100},
- {name = "charged energy elemental", exp = 450, hp = 500, ratio = 0.900, maxdmg = 375, deathmod = 100, firemod = 0, energymod = 0, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 105},
- {name = "chicken", exp = 0, hp = 15, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "chikhaton", exp = 35000, hp = 1, ratio = 35000.000, maxdmg = 1130, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "chizzoron the distorter", exp = 0, hp = 8000, ratio = 0.000, maxdmg = 2300, deathmod = 70, firemod = 100, energymod = 80, earthmod = 0, icemod = 80, holymod = 90, physicalmod = 100},
- {name = "cobra", exp = 30, hp = 65, ratio = 0.462, maxdmg = 5, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cockroach", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cocoon", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "coldheart", exp = 3500, hp = 7000, ratio = 0.500, maxdmg = 675, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "colerian the barbarian", exp = 90, hp = 265, ratio = 0.340, maxdmg = 100, deathmod = 100, firemod = 100, energymod = 80, earthmod = 120, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "coral frog", exp = 20, hp = 60, ratio = 0.333, maxdmg = 24, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "countess sorrow", exp = 13000, hp = 6500, ratio = 2.000, maxdmg = 2905, deathmod = 0, firemod = 110, energymod = 90, earthmod = 0, icemod = 50, holymod = 100, physicalmod = 0},
- {name = "crab", exp = 30, hp = 55, ratio = 0.545, maxdmg = 20, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "crazed beggar", exp = 35, hp = 100, ratio = 0.350, maxdmg = 25, deathmod = 110, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 95},
- {name = "crimson frog", exp = 20, hp = 60, ratio = 0.333, maxdmg = 24, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "crocodile", exp = 40, hp = 105, ratio = 0.381, maxdmg = 40, deathmod = 100, firemod = 110, energymod = 105, earthmod = 80, icemod = 90, holymod = 100, physicalmod = 105},
- {name = "crypt shambler", exp = 195, hp = 330, ratio = 0.591, maxdmg = 195, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 125, physicalmod = 100},
- {name = "crystal spider", exp = 900, hp = 1250, ratio = 0.720, maxdmg = 358, deathmod = 100, firemod = 0, energymod = 120, earthmod = 80, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "cublarc the plunderer", exp = 400, hp = 400, ratio = 1.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cursed gladiator", exp = 215, hp = 435, ratio = 0.494, maxdmg = 200, deathmod = 100, firemod = 105, energymod = 100, earthmod = 80, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "cyclops", exp = 150, hp = 260, ratio = 0.577, maxdmg = 105, deathmod = 110, firemod = 100, energymod = 75, earthmod = 110, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "cyclops drone", exp = 200, hp = 325, ratio = 0.615, maxdmg = 180, deathmod = 105, firemod = 100, energymod = 90, earthmod = 110, icemod = 80, holymod = 99, physicalmod = 100},
- {name = "cyclops smith", exp = 255, hp = 435, ratio = 0.586, maxdmg = 220, deathmod = 105, firemod = 90, energymod = 80, earthmod = 110, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "damaged worker golem", exp = 95, hp = 260, ratio = 0.365, maxdmg = 90, deathmod = 90, firemod = 100, energymod = 105, earthmod = 50, icemod = 90, holymod = 50, physicalmod = 75},
- {name = "darakan the executioner", exp = 1600, hp = 3500, ratio = 0.457, maxdmg = 390, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "dark apprentice", exp = 100, hp = 225, ratio = 0.444, maxdmg = 100, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dark magician", exp = 185, hp = 325, ratio = 0.569, maxdmg = 100, deathmod = 101, firemod = 90, energymod = 80, earthmod = 80, icemod = 90, holymod = 80, physicalmod = 100},
- {name = "dark monk", exp = 145, hp = 190, ratio = 0.763, maxdmg = 150, deathmod = 60, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 110, physicalmod = 120},
- {name = "dark torturer", exp = 4650, hp = 7350, ratio = 0.633, maxdmg = 1300, deathmod = 90, firemod = 0, energymod = 70, earthmod = 10, icemod = 110, holymod = 110, physicalmod = 100},
- {name = "deadeye devious", exp = 500, hp = 1450, ratio = 0.345, maxdmg = 250, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "death blob", exp = 300, hp = 320, ratio = 0.938, maxdmg = 212, deathmod = 0, firemod = 110, energymod = 110, earthmod = 0, icemod = 90, holymod = 110, physicalmod = 70},
- {name = "deathbringer", exp = 5100, hp = 10000, ratio = 0.510, maxdmg = 1265, deathmod = 0, firemod = 0, energymod = 120, earthmod = 0, icemod = 0, holymod = 110, physicalmod = 100},
- {name = "deathslicer", exp = 0, hp = 1, ratio = 0.000, maxdmg = 1000, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "deathspawn", exp = 0, hp = 225, ratio = 0.000, maxdmg = 1000, deathmod = 0, firemod = 85, energymod = 85, earthmod = 0, icemod = 85, holymod = 110, physicalmod = 100},
- {name = "deer", exp = 0, hp = 25, ratio = 0.000, maxdmg = 1, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "defiler", exp = 3700, hp = 3650, ratio = 1.014, maxdmg = 712, deathmod = 100, firemod = 125, energymod = 90, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "demodras", exp = 6000, hp = 4500, ratio = 1.333, maxdmg = 1150, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "demon", exp = 6000, hp = 8200, ratio = 0.732, maxdmg = 1530, deathmod = 70, firemod = 0, energymod = 50, earthmod = 60, icemod = 112, holymod = 112, physicalmod = 70},
- {name = "demon parrot", exp = 225, hp = 360, ratio = 0.625, maxdmg = 190, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "demon skeleton", exp = 240, hp = 400, ratio = 0.600, maxdmg = 235, deathmod = 0, firemod = 0, energymod = 100, earthmod = 0, icemod = 100, holymod = 125, physicalmod = 100},
- {name = "demon (goblin)", exp = 25, hp = 50, ratio = 0.500, maxdmg = 30, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "destroyer", exp = 2500, hp = 3700, ratio = 0.676, maxdmg = 700, deathmod = 80, firemod = 70, energymod = 0, earthmod = 80, icemod = 115, holymod = 103, physicalmod = 99},
- {name = "devovorga", exp = 0, hp = 1, ratio = 0.000, maxdmg = 9400, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dharalion", exp = 380, hp = 380, ratio = 1.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "diabolic imp", exp = 2900, hp = 1950, ratio = 1.487, maxdmg = 870, deathmod = 90, firemod = 0, energymod = 100, earthmod = 50, icemod = 110, holymod = 110, physicalmod = 100},
- {name = "diblis the fair", exp = 1800, hp = 1500, ratio = 1.200, maxdmg = 1500, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 105, physicalmod = 60},
- {name = "dipthrah", exp = 2900, hp = 4200, ratio = 0.690, maxdmg = 1400, deathmod = 0, firemod = 100, energymod = 80, earthmod = 80, icemod = 100, holymod = 110, physicalmod = 0},
- {name = "dire penguin", exp = 119, hp = 173, ratio = 0.688, maxdmg = 115, deathmod = 100, firemod = 50, energymod = 105, earthmod = 50, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dirtbeard", exp = 375, hp = 630, ratio = 0.595, maxdmg = 225, deathmod = 100, firemod = 110, energymod = 100, earthmod = 80, icemod = 105, holymod = 90, physicalmod = 100},
- {name = "diseased bill", exp = 300, hp = 2000, ratio = 0.150, maxdmg = 769, deathmod = 25, firemod = 75, energymod = 75, earthmod = 0, icemod = 75, holymod = 75, physicalmod = 90},
- {name = "diseased dan", exp = 300, hp = 2000, ratio = 0.150, maxdmg = 381, deathmod = 95, firemod = 15, energymod = 110, earthmod = 80, icemod = 105, holymod = 105, physicalmod = 105},
- {name = "diseased fred", exp = 300, hp = 2000, ratio = 0.150, maxdmg = 450, deathmod = 45, firemod = 85, energymod = 85, earthmod = 0, icemod = 85, holymod = 85, physicalmod = 85},
- {name = "doctor perhaps", exp = 325, hp = 475, ratio = 0.684, maxdmg = 100, deathmod = 100, firemod = 90, energymod = 80, earthmod = 80, icemod = 80, holymod = 80, physicalmod = 105},
- {name = "dog", exp = 0, hp = 20, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "doom deer", exp = 200, hp = 405, ratio = 0.494, maxdmg = 155, deathmod = 100, firemod = 100, energymod = 0, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "doomhowl", exp = 3750, hp = 8500, ratio = 0.441, maxdmg = 644, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 85},
- {name = "doomsday cultist", exp = 100, hp = 125, ratio = 0.800, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dracola", exp = 11000, hp = 16200, ratio = 0.679, maxdmg = 4245, deathmod = 0, firemod = 0, energymod = 100, earthmod = 0, icemod = 0, holymod = 110, physicalmod = 100},
- {name = "dragon", exp = 700, hp = 1000, ratio = 0.700, maxdmg = 400, deathmod = 100, firemod = 0, energymod = 80, earthmod = 20, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "dragon hatchling", exp = 185, hp = 380, ratio = 0.487, maxdmg = 200, deathmod = 100, firemod = 0, energymod = 105, earthmod = 25, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "dragon lord", exp = 2100, hp = 1900, ratio = 1.105, maxdmg = 720, deathmod = 100, firemod = 0, energymod = 80, earthmod = 20, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "dragon lord hatchling", exp = 645, hp = 750, ratio = 0.860, maxdmg = 335, deathmod = 100, firemod = 0, energymod = 110, earthmod = 90, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "draken abomination", exp = 3800, hp = 6250, ratio = 0.608, maxdmg = 1000, deathmod = 0, firemod = 0, energymod = 105, earthmod = 0, icemod = 95, holymod = 105, physicalmod = 80},
- {name = "draken elite", exp = 4200, hp = 5550, ratio = 0.757, maxdmg = 1500, deathmod = 70, firemod = 0, energymod = 60, earthmod = 0, icemod = 100, holymod = 70, physicalmod = 85},
- {name = "draken spellweaver", exp = 2600, hp = 5000, ratio = 0.520, maxdmg = 1000, deathmod = 10, firemod = 0, energymod = 110, earthmod = 0, icemod = 110, holymod = 105, physicalmod = 110},
- {name = "draken warmaster", exp = 2400, hp = 4150, ratio = 0.578, maxdmg = 600, deathmod = 50, firemod = 0, energymod = 95, earthmod = 0, icemod = 105, holymod = 95, physicalmod = 95},
- {name = "drasilla", exp = 700, hp = 1320, ratio = 0.530, maxdmg = 390, deathmod = 100, firemod = 0, energymod = 80, earthmod = 100, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "dreadbeast", exp = 250, hp = 800, ratio = 0.312, maxdmg = 140, deathmod = 0, firemod = 45, energymod = 85, earthmod = 0, icemod = 60, holymod = 150, physicalmod = 70},
- {name = "dreadmaw", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dreadwing", exp = 3750, hp = 8500, ratio = 0.441, maxdmg = 100, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dryad", exp = 190, hp = 310, ratio = 0.613, maxdmg = 120, deathmod = 100, firemod = 120, energymod = 70, earthmod = 0, icemod = 99, holymod = 100, physicalmod = 110},
- {name = "duskbringer", exp = 2600, hp = 3000, ratio = 0.867, maxdmg = 700, deathmod = 10, firemod = 110, energymod = 110, earthmod = 50, icemod = 115, holymod = 105, physicalmod = 99},
- {name = "dwarf", exp = 45, hp = 90, ratio = 0.500, maxdmg = 30, deathmod = 105, firemod = 105, energymod = 100, earthmod = 90, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dwarf dispenser", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "dwarf geomancer", exp = 265, hp = 380, ratio = 0.697, maxdmg = 210, deathmod = 101, firemod = 40, energymod = 90, earthmod = 80, icemod = 105, holymod = 90, physicalmod = 100},
- {name = "dwarf guard", exp = 165, hp = 245, ratio = 0.673, maxdmg = 140, deathmod = 105, firemod = 105, energymod = 100, earthmod = 80, icemod = 100, holymod = 100, physicalmod = 90},
- {name = "dwarf henchman", exp = 15, hp = 350, ratio = 0.043, maxdmg = 93, deathmod = 85, firemod = 110, energymod = 100, earthmod = 100, icemod = 85, holymod = 100, physicalmod = 80},
- {name = "dwarf miner", exp = 60, hp = 120, ratio = 0.500, maxdmg = 30, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dwarf soldier", exp = 70, hp = 135, ratio = 0.519, maxdmg = 130, deathmod = 105, firemod = 105, energymod = 100, earthmod = 90, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "dworc fleshhunter", exp = 40, hp = 85, ratio = 0.471, maxdmg = 41, deathmod = 115, firemod = 110, energymod = 100, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "dworc venomsniper", exp = 35, hp = 80, ratio = 0.438, maxdmg = 17, deathmod = 110, firemod = 115, energymod = 100, earthmod = 0, icemod = 113, holymod = 80, physicalmod = 100},
- {name = "dworc voodoomaster", exp = 55, hp = 80, ratio = 0.688, maxdmg = 90, deathmod = 110, firemod = 115, energymod = 100, earthmod = 0, icemod = 110, holymod = 70, physicalmod = 100},
- {name = "earth elemental", exp = 450, hp = 650, ratio = 0.692, maxdmg = 328, deathmod = 50, firemod = 125, energymod = 0, earthmod = 0, icemod = 15, holymod = 50, physicalmod = 50},
- {name = "earth overlord", exp = 2800, hp = 4000, ratio = 0.700, maxdmg = 1500, deathmod = 80, firemod = 125, energymod = 100, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "eclipse knight", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "efreet", exp = 410, hp = 550, ratio = 0.745, maxdmg = 340, deathmod = 99, firemod = 10, energymod = 40, earthmod = 90, icemod = 105, holymod = 108, physicalmod = 100},
- {name = "elder bonelord", exp = 280, hp = 500, ratio = 0.560, maxdmg = 405, deathmod = 70, firemod = 110, energymod = 80, earthmod = 0, icemod = 70, holymod = 100, physicalmod = 100},
- {name = "elephant", exp = 160, hp = 320, ratio = 0.500, maxdmg = 100, deathmod = 100, firemod = 100, energymod = 110, earthmod = 100, icemod = 80, holymod = 100, physicalmod = 75},
- {name = "elf", exp = 42, hp = 100, ratio = 0.420, maxdmg = 40, deathmod = 101, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "elf arcanist", exp = 175, hp = 220, ratio = 0.795, maxdmg = 220, deathmod = 80, firemod = 50, energymod = 80, earthmod = 100, icemod = 100, holymod = 110, physicalmod = 100},
- {name = "elf scout", exp = 75, hp = 160, ratio = 0.469, maxdmg = 110, deathmod = 101, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "energy elemental", exp = 550, hp = 500, ratio = 1.100, maxdmg = 582, deathmod = 95, firemod = 0, energymod = 0, earthmod = 115, icemod = 0, holymod = 90, physicalmod = 70},
- {name = "energy overlord", exp = 2800, hp = 4000, ratio = 0.700, maxdmg = 1400, deathmod = 100, firemod = 101, energymod = 0, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 50},
- {name = "enlightened of the cult", exp = 500, hp = 700, ratio = 0.714, maxdmg = 285, deathmod = 101, firemod = 100, energymod = 101, earthmod = 100, icemod = 99, holymod = 80, physicalmod = 90},
- {name = "enraged bookworm", exp = 55, hp = 145, ratio = 0.379, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "enraged squirrel", exp = 0, hp = 35, ratio = 0.000, maxdmg = 6, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "esmeralda", exp = 600, hp = 800, ratio = 0.750, maxdmg = 384, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "essence of darkness", exp = 30, hp = 1000, ratio = 0.030, maxdmg = 25, deathmod = 0, firemod = 2, energymod = 0, earthmod = 0, icemod = 0, holymod = 20, physicalmod = 0},
- {name = "eternal guardian", exp = 1800, hp = 2500, ratio = 0.720, maxdmg = 300, deathmod = 80, firemod = 30, energymod = 90, earthmod = 0, icemod = 90, holymod = 80, physicalmod = 100},
- {name = "evil mastermind", exp = 675, hp = 1295, ratio = 0.521, maxdmg = 357, deathmod = 0, firemod = 100, energymod = 10, earthmod = 0, icemod = 80, holymod = 105, physicalmod = 95},
- {name = "evil sheep", exp = 240, hp = 350, ratio = 0.686, maxdmg = 140, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 80, holymod = 100, physicalmod = 80},
- {name = "evil sheep lord", exp = 340, hp = 400, ratio = 0.850, maxdmg = 118, deathmod = 100, firemod = 105, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 120},
- {name = "eye of the seven", exp = 0, hp = 1, ratio = 0.000, maxdmg = 500, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "fahim the wise", exp = 1500, hp = 2000, ratio = 0.750, maxdmg = 800, deathmod = 110, firemod = 99, energymod = 100, earthmod = 100, icemod = 115, holymod = 99, physicalmod = 100},
- {name = "fallen mooh'tah master ghar", exp = 4400, hp = 8000, ratio = 0.550, maxdmg = 1600, deathmod = 100, firemod = 40, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fatality", exp = 4285, hp = 5945, ratio = 0.721, maxdmg = 205, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fernfang", exp = 600, hp = 400, ratio = 1.500, maxdmg = 230, deathmod = 100, firemod = 100, energymod = 100, earthmod = 50, icemod = 30, holymod = 100, physicalmod = 100},
- {name = "ferumbras", exp = 12000, hp = 35000, ratio = 0.343, maxdmg = 2400, deathmod = 100, firemod = 10, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fire devil", exp = 145, hp = 200, ratio = 0.725, maxdmg = 160, deathmod = 95, firemod = 0, energymod = 70, earthmod = 80, icemod = 120, holymod = 110, physicalmod = 105},
- {name = "fire elemental", exp = 220, hp = 280, ratio = 0.786, maxdmg = 280, deathmod = 0, firemod = 0, energymod = 100, earthmod = 100, icemod = 125, holymod = 100, physicalmod = 100},
- {name = "fire overlord", exp = 2800, hp = 4000, ratio = 0.700, maxdmg = 1200, deathmod = 80, firemod = 0, energymod = 80, earthmod = 20, icemod = 125, holymod = 100, physicalmod = 99},
- {name = "flamecaller zazrak", exp = 2000, hp = 3000, ratio = 0.667, maxdmg = 560, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "flamethrower", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "flamingo", exp = 0, hp = 25, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fleabringer", exp = 0, hp = 265, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fluffy", exp = 3550, hp = 4500, ratio = 0.789, maxdmg = 750, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "foreman kneebiter", exp = 445, hp = 570, ratio = 0.781, maxdmg = 317, deathmod = 101, firemod = 101, energymod = 100, earthmod = 99, icemod = 100, holymod = 100, physicalmod = 99},
- {name = "freegoiz", exp = 0, hp = 1, ratio = 0.000, maxdmg = 1665, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "frost dragon", exp = 2100, hp = 1800, ratio = 1.167, maxdmg = 700, deathmod = 90, firemod = 0, energymod = 100, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 90},
- {name = "frost dragon hatchling", exp = 745, jp = 800, ratio = 0.931, maxdmg = 380, deathmod = 100, firemod = 0, energymod = 105, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "frost giant", exp = 150, hp = 270, ratio = 0.556, maxdmg = 200, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "frost giantess", exp = 150, hp = 275, ratio = 0.545, maxdmg = 150, deathmod = 103, firemod = 80, energymod = 110, earthmod = 100, icemod = 0, holymod = 90, physicalmod = 100},
- {name = "frost troll", exp = 23, hp = 55, ratio = 0.418, maxdmg = 20, deathmod = 115, firemod = 50, energymod = 110, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "frostfur", exp = 35, hp = 65, ratio = 0.538, maxdmg = 30, deathmod = 100, firemod = 80, energymod = 110, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "furious troll", exp = 185, hp = 245, ratio = 0.755, maxdmg = 100, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "fury", exp = 4500, hp = 4100, ratio = 1.098, maxdmg = 800, deathmod = 110, firemod = 0, energymod = 110, earthmod = 110, icemod = 70, holymod = 70, physicalmod = 110},
- {name = "fury of the emperor", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 110},
- {name = "gamemaster", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "gang member", exp = 70, hp = 295, ratio = 0.237, maxdmg = 95, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "gargoyle", exp = 150, hp = 250, ratio = 0.600, maxdmg = 65, deathmod = 99, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 60},
- {name = "gazer", exp = 90, hp = 120, ratio = 0.750, maxdmg = 50, deathmod = 100, firemod = 110, energymod = 89, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "general murius", exp = 450, hp = 550, ratio = 0.818, maxdmg = 250, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "ghastly dragon", exp = 4600, hp = 7800, ratio = 0.590, maxdmg = 1780, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 110},
- {name = "ghazbaran", exp = 15000, hp = 60000, ratio = 0.250, maxdmg = 5775, deathmod = 99, firemod = 0, energymod = 100, earthmod = 0, icemod = 0, holymod = 101, physicalmod = 99},
- {name = "ghost", exp = 120, hp = 150, ratio = 0.800, maxdmg = 125, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 0},
- {name = "ghost rat", exp = 0, hp = 1, ratio = 0.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "ghostly apparition", exp = 0, hp = 1, ratio = 0.000, maxdmg = 6, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "ghoul", exp = 85, hp = 100, ratio = 0.850, maxdmg = 97, deathmod = 0, firemod = 100, energymod = 70, earthmod = 80, icemod = 90, holymod = 125, physicalmod = 100},
- {name = "giant spider", exp = 900, hp = 1300, ratio = 0.692, maxdmg = 378, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "gladiator", exp = 90, hp = 185, ratio = 0.486, maxdmg = 90, deathmod = 101, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 90, physicalmod = 85},
- {name = "glitterscale", exp = 700, hp = 1000, ratio = 0.700, maxdmg = 0, deathmod = 100, firemod = 0, energymod = 100, earthmod = 20, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "gloombringer", exp = 0, hp = 1, ratio = 0.000, maxdmg = 3000, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "gnarlhound", exp = 60, hp = 198, ratio = 0.303, maxdmg = 70, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "gnorre chyllson", exp = 4000, hp = 7100, ratio = 0.563, maxdmg = 1100, deathmod = 100, firemod = 0, energymod = 110, earthmod = 0, icemod = 0, holymod = 99, physicalmod = 101},
- {name = "goblin", exp = 25, hp = 50, ratio = 0.500, maxdmg = 35, deathmod = 110, firemod = 100, energymod = 80, earthmod = 112, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "goblin assassin", exp = 52, hp = 75, ratio = 0.693, maxdmg = 50, deathmod = 101, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "goblin leader", exp = 75, hp = 50, ratio = 1.500, maxdmg = 95, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "goblin scavenger", exp = 37, hp = 60, ratio = 0.617, maxdmg = 75, deathmod = 110, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "golgordan", exp = 10000, hp = 40000, ratio = 0.250, maxdmg = 3127, deathmod = 0, firemod = 101, energymod = 100, earthmod = 100, icemod = 101, holymod = 99, physicalmod = 99},
- {name = "gozzler", exp = 180, hp = 240, ratio = 0.750, maxdmg = 245, deathmod = 50, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 50, physicalmod = 105},
- {name = "grand mother foulscale", exp = 1400, hp = 1850, ratio = 0.757, maxdmg = 300, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 105, holymod = 100, physicalmod = 100},
- {name = "grandfather tridian", exp = 1400, hp = 1800, ratio = 0.778, maxdmg = 540, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 65},
- {name = "gravelord oshuran", exp = 2400, hp = 3100, ratio = 0.774, maxdmg = 750, deathmod = 0, firemod = 100, energymod = 20, earthmod = 0, icemod = 50, holymod = 101, physicalmod = 100},
- {name = "green djinn", exp = 215, hp = 330, ratio = 0.652, maxdmg = 320, deathmod = 80, firemod = 20, energymod = 50, earthmod = 100, icemod = 110, holymod = 113, physicalmod = 80},
- {name = "green frog", exp = 0, hp = 25, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "grim reaper", exp = 5500, hp = 3900, ratio = 1.410, maxdmg = 1720, deathmod = 20, firemod = 110, energymod = 110, earthmod = 60, icemod = 35, holymod = 110, physicalmod = 80},
- {name = "grimgor guteater", exp = 670, hp = 1155, ratio = 0.580, maxdmg = 330, deathmod = 101, firemod = 0, energymod = 80, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "grorlam", exp = 2400, hp = 3000, ratio = 0.800, maxdmg = 530, deathmod = 101, firemod = 110, energymod = 80, earthmod = 0, icemod = 100, holymod = 80, physicalmod = 70},
- {name = "grynch clan goblin", exp = 4, hp = 80, ratio = 0.050, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hacker", exp = 45, hp = 430, ratio = 0.105, maxdmg = 35, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hairman the huge", exp = 335, hp = 600, ratio = 0.558, maxdmg = 110, deathmod = 101, firemod = 99, energymod = 99, earthmod = 99, icemod = 101, holymod = 100, physicalmod = 99},
- {name = "hand of cursed fate", exp = 5000, hp = 7500, ratio = 0.667, maxdmg = 920, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 110, holymod = 125, physicalmod = 100},
- {name = "harbinger of darkness", exp = 0, hp = 1, ratio = 0.000, maxdmg = 4066, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hatebreeder", exp = 11000, hp = 1, ratio = 11000.000, maxdmg = 1800, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 110},
- {name = "haunted treeling", exp = 310, hp = 450, ratio = 0.689, maxdmg = 320, deathmod = 99, firemod = 105, energymod = 100, earthmod = 0, icemod = 85, holymod = 80, physicalmod = 100},
- {name = "haunter", exp = 4000, hp = 8500, ratio = 0.471, maxdmg = 210, deathmod = 90, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hell hole", exp = 0, hp = 1, ratio = 0.000, maxdmg = 1000, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "hellfire fighter", exp = 3900, hp = 3800, ratio = 1.026, maxdmg = 2749, deathmod = 80, firemod = 0, energymod = 75, earthmod = 100, icemod = 125, holymod = 100, physicalmod = 50},
- {name = "hellgorak", exp = 10000, hp = 30000, ratio = 0.333, maxdmg = 1800, deathmod = 2, firemod = 2, energymod = 2, earthmod = 2, icemod = 2, holymod = 2, physicalmod = 2},
- {name = "hellhound", exp = 6800, hp = 7500, ratio = 0.907, maxdmg = 3342, deathmod = 100, firemod = 0, energymod = 90, earthmod = 80, icemod = 105, holymod = 125, physicalmod = 100},
- {name = "hellspawn", exp = 2550, hp = 3500, ratio = 0.729, maxdmg = 515, deathmod = 105, firemod = 60, energymod = 90, earthmod = 20, icemod = 110, holymod = 70, physicalmod = 80},
- {name = "heoni", exp = 515, hp = 900, ratio = 0.572, maxdmg = 100, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "herald of gloom", exp = 450, hp = 450, ratio = 1.000, maxdmg = 0, deathmod = 105, firemod = 100, energymod = 105, earthmod = 100, icemod = 80, holymod = 80, physicalmod = 105},
- {name = "hero", exp = 1200, hp = 1400, ratio = 0.857, maxdmg = 360, deathmod = 120, firemod = 70, energymod = 60, earthmod = 50, icemod = 90, holymod = 50, physicalmod = 70},
- {name = "hide", exp = 240, hp = 500, ratio = 0.480, maxdmg = 144, deathmod = 100, firemod = 115, energymod = 90, earthmod = 0, icemod = 115, holymod = 100, physicalmod = 60},
- {name = "high templar cobrass", exp = 515, hp = 410, ratio = 1.256, maxdmg = 80, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "hot dog", exp = 190, hp = 505, ratio = 0.376, maxdmg = 125, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 100, holymod = 105, physicalmod = 120},
- {name = "hunter", exp = 150, hp = 150, ratio = 1.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 80, physicalmod = 110},
- {name = "husky", exp = 0, hp = 140, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hyaena", exp = 20, hp = 60, ratio = 0.333, maxdmg = 20, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "hydra", exp = 2100, hp = 2350, ratio = 0.894, maxdmg = 750, deathmod = 100, firemod = 100, energymod = 110, earthmod = 0, icemod = 50, holymod = 70, physicalmod = 105},
- {name = "ice golem", exp = 295, hp = 385, ratio = 0.766, maxdmg = 305, deathmod = 0, firemod = 0, energymod = 120, earthmod = 100, icemod = 0, holymod = 0, physicalmod = 75},
- {name = "ice overlord", exp = 2800, hp = 4000, ratio = 0.700, maxdmg = 1408, deathmod = 100, firemod = 0, energymod = 125, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 50},
- {name = "ice witch", exp = 580, hp = 650, ratio = 0.892, maxdmg = 394, deathmod = 110, firemod = 50, energymod = 110, earthmod = 60, icemod = 0, holymod = 70, physicalmod = 100},
- {name = "incineron", exp = 3500, hp = 7000, ratio = 0.500, maxdmg = 1400, deathmod = 100, firemod = 0, energymod = 80, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "infernal frog", exp = 190, hp = 655, ratio = 0.290, maxdmg = 42, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "infernalist", exp = 4000, hp = 3650, ratio = 1.096, maxdmg = 120, deathmod = 99, firemod = 0, energymod = 0, earthmod = 5, icemod = 105, holymod = 80, physicalmod = 101},
- {name = "infernatil", exp = 85000, hp = 160000, ratio = 0.531, maxdmg = 6000, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "inky", exp = 250, hp = 600, ratio = 0.417, maxdmg = 367, deathmod = 100, firemod = 0, energymod = 105, earthmod = 10, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "insect swarm", exp = 40, hp = 50, ratio = 0.800, maxdmg = 25, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "irahsae", exp = 0, hp = 1, ratio = 0.000, maxdmg = 900, deathmod = 200, firemod = 100, energymod = 0, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "island troll", exp = 20, hp = 50, ratio = 0.400, maxdmg = 10, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "jagged earth elemental", exp = 1300, hp = 1500, ratio = 0.867, maxdmg = 750, deathmod = 55, firemod = 115, energymod = 15, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "juggernaut", exp = 8700, hp = 20000, ratio = 0.435, maxdmg = 2260, deathmod = 100, firemod = 70, energymod = 110, earthmod = 80, icemod = 90, holymod = 105, physicalmod = 50},
- {name = "killer caiman", exp = 800, hp = 1500, ratio = 0.533, maxdmg = 300, deathmod = 100, firemod = 100, energymod = 105, earthmod = 80, icemod = 90, holymod = 100, physicalmod = 95},
- {name = "killer rabbit", exp = 160, hp = 205, ratio = 0.780, maxdmg = 140, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "kitty", exp = 0, hp = 1, ratio = 0.000, maxdmg = 117, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "kongra", exp = 115, hp = 340, ratio = 0.338, maxdmg = 60, deathmod = 105, firemod = 80, energymod = 95, earthmod = 90, icemod = 115, holymod = 100, physicalmod = 100},
- {name = "kongra", exp = 0, hp = 20000, ratio = 0.000, maxdmg = 90, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "koshei the deathless", exp = 0, hp = 1, ratio = 0.000, maxdmg = 531, deathmod = 0, firemod = 110, energymod = 10, earthmod = 0, icemod = 80, holymod = 115, physicalmod = 80},
- {name = "kreebosh the exile", exp = 350, hp = 805, ratio = 0.435, maxdmg = 545, deathmod = 101, firemod = 100, energymod = 45, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "lancer beetle", exp = 275, hp = 400, ratio = 0.688, maxdmg = 246, deathmod = 50, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "larva", exp = 44, hp = 70, ratio = 0.629, maxdmg = 36, deathmod = 100, firemod = 110, energymod = 90, earthmod = 0, icemod = 105, holymod = 100, physicalmod = 100},
- {name = "latrivan", exp = 10000, hp = 25000, ratio = 0.400, maxdmg = 1800, deathmod = 0, firemod = 0, energymod = 99, earthmod = 100, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "lavahole", exp = 0, hp = 1, ratio = 0.000, maxdmg = 111, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "lersatio", exp = 2500, hp = 1600, ratio = 1.562, maxdmg = 650, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "lethal lissy", exp = 500, hp = 1450, ratio = 0.345, maxdmg = 160, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "leviathan", exp = 5000, hp = 6000, ratio = 0.833, maxdmg = 1471, deathmod = 99, firemod = 70, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 115},
- {name = "lich", exp = 900, hp = 880, ratio = 1.023, maxdmg = 500, deathmod = 0, firemod = 100, energymod = 20, earthmod = 0, icemod = 100, holymod = 110, physicalmod = 100},
- {name = "lion", exp = 30, hp = 80, ratio = 0.375, maxdmg = 40, deathmod = 108, firemod = 100, energymod = 100, earthmod = 80, icemod = 115, holymod = 80, physicalmod = 100},
- {name = "lizard abomination", exp = 1350, hp = 20000, ratio = 0.068, maxdmg = 1500, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 85},
- {name = "lizard chosen", exp = 2200, hp = 3050, ratio = 0.721, maxdmg = 880, deathmod = 100, firemod = 90, energymod = 80, earthmod = 0, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "lizard dragon priest", exp = 1320, hp = 1450, ratio = 0.910, maxdmg = 240, deathmod = 100, firemod = 55, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "lizard gate guardian", exp = 2000, hp = 3000, ratio = 0.667, maxdmg = 500, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "lizard high guard", exp = 1450, hp = 1800, ratio = 0.806, maxdmg = 370, deathmod = 100, firemod = 55, energymod = 100, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 95},
- {name = "lizard legionnaire", exp = 1100, hp = 1400, ratio = 0.786, maxdmg = 460, deathmod = 100, firemod = 55, energymod = 100, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "lizard magistratus", exp = 200, hp = 1, ratio = 200.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "lizard noble", exp = 250, hp = 1, ratio = 250.000, maxdmg = 330, deathmod = 100, firemod = 10, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "lizard sentinel", exp = 110, hp = 265, ratio = 0.415, maxdmg = 115, deathmod = 100, firemod = 110, energymod = 90, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "lizard snakecharmer", exp = 210, hp = 325, ratio = 0.646, maxdmg = 150, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 120},
- {name = "lizard templar", exp = 155, hp = 410, ratio = 0.378, maxdmg = 70, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "lizard zaogun", exp = 1700, hp = 2955, ratio = 0.575, maxdmg = 721, deathmod = 90, firemod = 55, energymod = 80, earthmod = 0, icemod = 85, holymod = 100, physicalmod = 95},
- {name = "lord of the elements", exp = 8000, hp = 8000, ratio = 1.000, maxdmg = 715, deathmod = 0, firemod = 70, energymod = 70, earthmod = 55, icemod = 70, holymod = 0, physicalmod = 99},
- {name = "lost soul", exp = 4000, hp = 5800, ratio = 0.690, maxdmg = 630, deathmod = 0, firemod = 0, energymod = 90, earthmod = 0, icemod = 50, holymod = 120, physicalmod = 100},
- {name = "mad scientist", exp = 205, hp = 325, ratio = 0.631, maxdmg = 127, deathmod = 105, firemod = 90, energymod = 80, earthmod = 80, icemod = 90, holymod = 80, physicalmod = 100},
- {name = "mad sheep", exp = 0, hp = 22, ratio = 0.000, maxdmg = 1, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "mad technomancer", exp = 55, hp = 1800, ratio = 0.031, maxdmg = 350, deathmod = 100, firemod = 0, energymod = 105, earthmod = 0, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "madareth", exp = 10000, hp = 75000, ratio = 0.133, maxdmg = 3359, deathmod = 5, firemod = 101, energymod = 1, earthmod = 100, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "magic pillar", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "magicthrower", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "mahrdis", exp = 3050, hp = 3900, ratio = 0.782, maxdmg = 2400, deathmod = 0, firemod = 0, energymod = 80, earthmod = 80, icemod = 110, holymod = 120, physicalmod = 100},
- {name = "mammoth", exp = 160, hp = 320, ratio = 0.500, maxdmg = 110, deathmod = 100, firemod = 110, energymod = 100, earthmod = 80, icemod = 80, holymod = 100, physicalmod = 85},
- {name = "man in the cave", exp = 770, hp = 485, ratio = 1.588, maxdmg = 157, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "marid", exp = 410, hp = 550, ratio = 0.745, maxdmg = 600, deathmod = 101, firemod = 10, energymod = 40, earthmod = 99, icemod = 101, holymod = 99, physicalmod = 100},
- {name = "marziel", exp = 3000, hp = 1900, ratio = 1.579, maxdmg = 800, deathmod = 0, firemod = 90, energymod = 80, earthmod = 0, icemod = 105, holymod = 105, physicalmod = 57},
- {name = "massacre", exp = 20000, hp = 32000, ratio = 0.625, maxdmg = 2800, deathmod = 110, firemod = 0, energymod = 100, earthmod = 100, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "massive earth elemental", exp = 950, hp = 1330, ratio = 0.714, maxdmg = 438, deathmod = 55, firemod = 115, energymod = 10, earthmod = 0, icemod = 0, holymod = 50, physicalmod = 70},
- {name = "massive energy elemental", exp = 950, hp = 1100, ratio = 0.864, maxdmg = 1050, deathmod = 99, firemod = 0, energymod = 0, earthmod = 105, icemod = 0, holymod = 75, physicalmod = 30},
- {name = "massive fire elemental", exp = 1400, hp = 1200, ratio = 1.167, maxdmg = 0, deathmod = 80, firemod = 0, energymod = 70, earthmod = 100, icemod = 115, holymod = 100, physicalmod = 60},
- {name = "massive water elemental", exp = 1100, hp = 1250, ratio = 0.880, maxdmg = 431, deathmod = 50, firemod = 0, energymod = 125, earthmod = 0, icemod = 0, holymod = 70, physicalmod = 70},
- {name = "mechanical fighter", exp = 255, hp = 420, ratio = 0.607, maxdmg = 200, deathmod = 100, firemod = 100, energymod = 50, earthmod = 0, icemod = 100, holymod = 0, physicalmod = 100},
- {name = "medusa", exp = 4050, hp = 4500, ratio = 0.900, maxdmg = 1000, deathmod = 100, firemod = 105, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "menace", exp = 4112, hp = 5960, ratio = 0.690, maxdmg = 215, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "mephiles", exp = 415, hp = 415, ratio = 1.000, maxdmg = 80, deathmod = 100, firemod = 0, energymod = 100, earthmod = 50, icemod = 110, holymod = 105, physicalmod = 110},
- {name = "mercury blob", exp = 180, hp = 150, ratio = 1.200, maxdmg = 105, deathmod = 0, firemod = 90, energymod = 100, earthmod = 35, icemod = 85, holymod = 35, physicalmod = 95},
- {name = "merikh the slaughterer", exp = 1500, hp = 2000, ratio = 0.750, maxdmg = 700, deathmod = 99, firemod = 99, energymod = 100, earthmod = 100, icemod = 101, holymod = 101, physicalmod = 100},
- {name = "merlkin", exp = 145, hp = 235, ratio = 0.617, maxdmg = 170, deathmod = 105, firemod = 80, energymod = 90, earthmod = 100, icemod = 115, holymod = 90, physicalmod = 100},
- {name = "merlkin", exp = 900, hp = 20000, ratio = 0.045, maxdmg = 10, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "midnight spawn", exp = 900, hp = 1, ratio = 900.000, maxdmg = 0, deathmod = 1, firemod = 70, energymod = 100, earthmod = 1, icemod = 110, holymod = 110, physicalmod = 70},
- {name = "midnight warrior", exp = 750, hp = 1000, ratio = 0.750, maxdmg = 250, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 85},
- {name = "mimic", exp = 0, hp = 30, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "minishabaal", exp = 4000, hp = 6000, ratio = 0.667, maxdmg = 800, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "minotaur", exp = 50, hp = 100, ratio = 0.500, maxdmg = 45, deathmod = 105, firemod = 80, energymod = 100, earthmod = 100, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "minotaur archer", exp = 65, hp = 100, ratio = 0.650, maxdmg = 100, deathmod = 101, firemod = 80, energymod = 100, earthmod = 100, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "minotaur guard", exp = 160, hp = 185, ratio = 0.865, maxdmg = 100, deathmod = 110, firemod = 80, energymod = 100, earthmod = 100, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "minotaur mage", exp = 150, hp = 155, ratio = 0.968, maxdmg = 205, deathmod = 110, firemod = 100, energymod = 80, earthmod = 80, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "monk", exp = 200, hp = 240, ratio = 0.833, maxdmg = 140, deathmod = 50, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 50, physicalmod = 110},
- {name = "monstor", exp = 575, hp = 960, ratio = 0.599, maxdmg = 248, deathmod = 100, firemod = 50, energymod = 107, earthmod = 70, icemod = 90, holymod = 103, physicalmod = 80},
- {name = "mooh'tah master", exp = 0, hp = 1, ratio = 0.000, maxdmg = 700, deathmod = 80, firemod = 70, energymod = 70, earthmod = 0, icemod = 100, holymod = 60, physicalmod = 99},
- {name = "morgaroth", exp = 15000, hp = 55000, ratio = 0.273, maxdmg = 3500, deathmod = 20, firemod = 0, energymod = 99, earthmod = 0, icemod = 105, holymod = 100, physicalmod = 99},
- {name = "morguthis", exp = 3000, hp = 4800, ratio = 0.625, maxdmg = 1900, deathmod = 0, firemod = 80, energymod = 80, earthmod = 110, icemod = 80, holymod = 120, physicalmod = 80},
- {name = "morik the gladiator", exp = 160, hp = 1235, ratio = 0.130, maxdmg = 310, deathmod = 101, firemod = 90, energymod = 90, earthmod = 90, icemod = 90, holymod = 90, physicalmod = 100},
- {name = "mr. punish", exp = 9000, hp = 22000, ratio = 0.409, maxdmg = 1807, deathmod = 110, firemod = 0, energymod = 0, earthmod = 105, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "muddy earth elemental", exp = 450, hp = 650, ratio = 0.692, maxdmg = 450, deathmod = 60, firemod = 115, energymod = 15, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "mummy", exp = 150, hp = 240, ratio = 0.625, maxdmg = 129, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 80, holymod = 125, physicalmod = 100},
- {name = "munster", exp = 35, hp = 58, ratio = 0.603, maxdmg = 15, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "mutated bat", exp = 615, hp = 900, ratio = 0.683, maxdmg = 462, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "mutated human", exp = 150, hp = 240, ratio = 0.625, maxdmg = 164, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 80, holymod = 125, physicalmod = 100},
- {name = "mutated rat", exp = 450, hp = 550, ratio = 0.818, maxdmg = 305, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "mutated tiger", exp = 750, hp = 1100, ratio = 0.682, maxdmg = 275, deathmod = 105, firemod = 80, energymod = 80, earthmod = 20, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "mutated zalamon", exp = 0, hp = 25000, ratio = 0.000, maxdmg = 1200, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 90, holymod = 100, physicalmod = 95},
- {name = "necromancer", exp = 580, hp = 580, ratio = 1.000, maxdmg = 260, deathmod = 50, firemod = 105, energymod = 80, earthmod = 0, icemod = 100, holymod = 105, physicalmod = 105},
- {name = "necropharus", exp = 1050, hp = 750, ratio = 1.400, maxdmg = 300, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "nightmare", exp = 2150, hp = 2700, ratio = 0.796, maxdmg = 750, deathmod = 0, firemod = 80, energymod = 80, earthmod = 0, icemod = 90, holymod = 125, physicalmod = 100},
- {name = "nightmare scion", exp = 1350, hp = 1400, ratio = 0.964, maxdmg = 420, deathmod = 0, firemod = 80, energymod = 80, earthmod = 0, icemod = 90, holymod = 125, physicalmod = 100},
- {name = "nightslayer", exp = 250, hp = 400, ratio = 0.625, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 100, earthmod = 100, icemod = 110, holymod = 100, physicalmod = 105},
- {name = "nightstalker", exp = 500, hp = 700, ratio = 0.714, maxdmg = 260, deathmod = 105, firemod = 100, energymod = 105, earthmod = 100, icemod = 80, holymod = 80, physicalmod = 105},
- {name = "nomad", exp = 60, hp = 160, ratio = 0.375, maxdmg = 80, deathmod = 120, firemod = 80, energymod = 100, earthmod = 100, icemod = 110, holymod = 80, physicalmod = 110},
- {name = "norgle glacierbeard", exp = 2100, hp = 4300, ratio = 0.488, maxdmg = 400, deathmod = 101, firemod = 100, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "novice of the cult", exp = 100, hp = 285, ratio = 0.351, maxdmg = 270, deathmod = 108, firemod = 105, energymod = 108, earthmod = 90, icemod = 90, holymod = 90, physicalmod = 120},
- {name = "omruc", exp = 2950, hp = 4300, ratio = 0.686, maxdmg = 1619, deathmod = 0, firemod = 80, energymod = 105, earthmod = 80, icemod = 105, holymod = 110, physicalmod = 100},
- {name = "orc", exp = 25, hp = 70, ratio = 0.357, maxdmg = 35, deathmod = 101, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orc berserker", exp = 195, hp = 210, ratio = 0.929, maxdmg = 200, deathmod = 110, firemod = 100, energymod = 85, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orc leader", exp = 270, hp = 450, ratio = 0.600, maxdmg = 255, deathmod = 101, firemod = 0, energymod = 80, earthmod = 110, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "orc marauder", exp = 205, hp = 235, ratio = 0.872, maxdmg = 80, deathmod = 100, firemod = 100, energymod = 100, earthmod = 101, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "orc rider", exp = 110, hp = 180, ratio = 0.611, maxdmg = 120, deathmod = 101, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orc shaman", exp = 110, hp = 115, ratio = 0.957, maxdmg = 81, deathmod = 105, firemod = 100, energymod = 50, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orc spearman", exp = 38, hp = 105, ratio = 0.362, maxdmg = 55, deathmod = 110, firemod = 100, energymod = 80, earthmod = 110, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "orc warlord", exp = 670, hp = 950, ratio = 0.705, maxdmg = 450, deathmod = 105, firemod = 20, energymod = 80, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orc warrior", exp = 50, hp = 125, ratio = 0.400, maxdmg = 60, deathmod = 110, firemod = 100, energymod = 70, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "orchid frog", exp = 20, hp = 60, ratio = 0.333, maxdmg = 24, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "orcus the cruel", exp = 280, hp = 480, ratio = 0.583, maxdmg = 250, deathmod = 100, firemod = 0, energymod = 80, earthmod = 120, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "orshabaal", exp = 10000, hp = 20500, ratio = 0.488, maxdmg = 5000, deathmod = 50, firemod = 0, energymod = 100, earthmod = 0, icemod = 101, holymod = 101, physicalmod = 100},
- {name = "overcharged energy element", exp = 1300, hp = 1750, ratio = 0.743, maxdmg = 895, deathmod = 100, firemod = 0, energymod = 0, earthmod = 120, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "panda", exp = 23, hp = 80, ratio = 0.287, maxdmg = 16, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "parrot", exp = 0, hp = 25, ratio = 0.000, maxdmg = 5, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "penguin", exp = 1, hp = 33, ratio = 0.030, maxdmg = 3, deathmod = 100, firemod = 100, energymod = 101, earthmod = 100, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "phantasm", exp = 4400, hp = 3950, ratio = 1.114, maxdmg = 800, deathmod = 0, firemod = 110, energymod = 110, earthmod = 80, icemod = 80, holymod = 110, physicalmod = 0},
- {name = "phrodomo", exp = 44000, hp = 80000, ratio = 0.550, maxdmg = 2000, deathmod = 70, firemod = 100, energymod = 0, earthmod = 0, icemod = 50, holymod = 100, physicalmod = 80},
- {name = "pig", exp = 0, hp = 25, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "pillar", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "pirate buccaneer", exp = 250, hp = 425, ratio = 0.588, maxdmg = 260, deathmod = 101, firemod = 105, energymod = 105, earthmod = 90, icemod = 105, holymod = 90, physicalmod = 110},
- {name = "pirate corsair", exp = 350, hp = 675, ratio = 0.519, maxdmg = 320, deathmod = 101, firemod = 110, energymod = 100, earthmod = 80, icemod = 105, holymod = 90, physicalmod = 100},
- {name = "pirate cutthroat", exp = 175, hp = 325, ratio = 0.538, maxdmg = 271, deathmod = 101, firemod = 110, energymod = 100, earthmod = 90, icemod = 105, holymod = 80, physicalmod = 100},
- {name = "pirate ghost", exp = 250, hp = 275, ratio = 0.909, maxdmg = 240, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 125, physicalmod = 0},
- {name = "pirate marauder", exp = 125, hp = 210, ratio = 0.595, maxdmg = 180, deathmod = 105, firemod = 110, energymod = 103, earthmod = 90, icemod = 100, holymod = 80, physicalmod = 100},
- {name = "pirate skeleton", exp = 85, hp = 190, ratio = 0.447, maxdmg = 50, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 125, physicalmod = 100},
- {name = "plaguesmith", exp = 4500, hp = 8250, ratio = 0.545, maxdmg = 890, deathmod = 99, firemod = 70, energymod = 110, earthmod = 0, icemod = 80, holymod = 110, physicalmod = 100},
- {name = "plaguethrower", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "poacher", exp = 70, hp = 90, ratio = 0.778, maxdmg = 70, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "poison spider", exp = 22, hp = 26, ratio = 0.846, maxdmg = 22, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "polar bear", exp = 28, hp = 85, ratio = 0.329, maxdmg = 30, deathmod = 110, firemod = 99, energymod = 101, earthmod = 100, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "priestess", exp = 420, hp = 390, ratio = 1.077, maxdmg = 195, deathmod = 99, firemod = 60, energymod = 100, earthmod = 30, icemod = 100, holymod = 110, physicalmod = 105},
- {name = "primitive", exp = 45, hp = 200, ratio = 0.225, maxdmg = 90, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "pythius the rotten", exp = 7000, hp = 9000, ratio = 0.778, maxdmg = 1250, deathmod = 0, firemod = 100, energymod = 0, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "quara constrictor", exp = 250, hp = 450, ratio = 0.556, maxdmg = 256, deathmod = 100, firemod = 0, energymod = 125, earthmod = 110, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara constrictor scout", exp = 200, hp = 450, ratio = 0.444, maxdmg = 205, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 105},
- {name = "quara hydromancer", exp = 800, hp = 1100, ratio = 0.727, maxdmg = 825, deathmod = 100, firemod = 0, energymod = 125, earthmod = 110, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara hydromancer scout", exp = 800, hp = 1100, ratio = 0.727, maxdmg = 670, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara mantassin", exp = 400, hp = 800, ratio = 0.500, maxdmg = 140, deathmod = 100, firemod = 0, energymod = 125, earthmod = 110, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara mantassin scout", exp = 100, hp = 220, ratio = 0.455, maxdmg = 110, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara pincher", exp = 1200, hp = 1800, ratio = 0.667, maxdmg = 340, deathmod = 100, firemod = 0, energymod = 125, earthmod = 110, icemod = 0, holymod = 100, physicalmod = 90},
- {name = "quara pincher scout", exp = 600, hp = 775, ratio = 0.774, maxdmg = 240, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 90},
- {name = "quara predator", exp = 1600, hp = 2200, ratio = 0.727, maxdmg = 470, deathmod = 100, firemod = 0, energymod = 125, earthmod = 110, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "quara predator scout", exp = 400, hp = 890, ratio = 0.449, maxdmg = 190, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "rabbit", exp = 0, hp = 15, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rahemos", exp = 3100, hp = 3700, ratio = 0.838, maxdmg = 1850, deathmod = 0, firemod = 5, energymod = 5, earthmod = 0, icemod = 0, holymod = 101, physicalmod = 140},
- {name = "rat", exp = 5, hp = 20, ratio = 0.250, maxdmg = 8, deathmod = 110, firemod = 100, energymod = 100, earthmod = 75, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "renegade orc", exp = 270, hp = 450, ratio = 0.600, maxdmg = 180, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rift brood", exp = 1600, hp = 3000, ratio = 0.533, maxdmg = 270, deathmod = 120, firemod = 0, energymod = 100, earthmod = 100, icemod = 0, holymod = 85, physicalmod = 99},
- {name = "rift lord", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rift phantom", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rift scythe", exp = 2000, hp = 3600, ratio = 0.556, maxdmg = 1000, deathmod = 99, firemod = 110, energymod = 110, earthmod = 60, icemod = 35, holymod = 110, physicalmod = 99},
- {name = "rift worm", exp = 1195, hp = 2800, ratio = 0.427, maxdmg = 0, deathmod = 100, firemod = 105, energymod = 100, earthmod = 125, icemod = 105, holymod = 105, physicalmod = 100},
- {name = "roaring water elemental", exp = 1300, hp = 1750, ratio = 0.743, maxdmg = 762, deathmod = 99, firemod = 0, energymod = 100, earthmod = 0, icemod = 0, holymod = 60, physicalmod = 55},
- {name = "rocko", exp = 3400, hp = 10000, ratio = 0.340, maxdmg = 600, deathmod = 0, firemod = 70, energymod = 75, earthmod = 0, icemod = 80, holymod = 90, physicalmod = 85},
- {name = "rocky", exp = 190, hp = 390, ratio = 0.487, maxdmg = 80, deathmod = 100, firemod = 101, energymod = 0, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "ron the ripper", exp = 500, hp = 1500, ratio = 0.333, maxdmg = 410, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rottie the rotworm", exp = 40, hp = 65, ratio = 0.615, maxdmg = 25, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rotworm", exp = 40, hp = 65, ratio = 0.615, maxdmg = 40, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rotworm queen", exp = 75, hp = 105, ratio = 0.714, maxdmg = 80, deathmod = 100, firemod = 120, energymod = 100, earthmod = 60, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "rukor zad", exp = 380, hp = 380, ratio = 1.000, maxdmg = 370, deathmod = 95, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 99},
- {name = "sandcrawler", exp = 20, hp = 30, ratio = 0.667, maxdmg = 3, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "scarab", exp = 120, hp = 320, ratio = 0.375, maxdmg = 115, deathmod = 100, firemod = 118, energymod = 90, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 85},
- {name = "scorn of the emperor", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 110},
- {name = "scorpion", exp = 45, hp = 45, ratio = 1.000, maxdmg = 67, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "sea serpent", exp = 2300, hp = 1950, ratio = 1.179, maxdmg = 800, deathmod = 90, firemod = 70, energymod = 105, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 115},
- {name = "seagull", exp = 0, hp = 25, ratio = 0.000, maxdmg = 3, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "serpent spawn", exp = 3050, hp = 3000, ratio = 1.017, maxdmg = 1400, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "servant golem", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "shadow hound", exp = 600, hp = 555, ratio = 1.081, maxdmg = 155, deathmod = 0, firemod = 110, energymod = 90, earthmod = 0, icemod = 110, holymod = 70, physicalmod = 120},
- {name = "shadow of boreth", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "shadow of lersatio", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "shadow of marziel", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "shard of corruption", exp = 5, hp = 600, ratio = 0.008, maxdmg = 200, deathmod = 0, firemod = 70, energymod = 75, earthmod = 0, icemod = 85, holymod = 100, physicalmod = 40},
- {name = "shardhead", exp = 650, hp = 800, ratio = 0.812, maxdmg = 300, deathmod = 0, firemod = 100, energymod = 120, earthmod = 100, icemod = 100, holymod = 0, physicalmod = 100},
- {name = "sharptooth", exp = 1600, hp = 2500, ratio = 0.640, maxdmg = 500, deathmod = 100, firemod = 0, energymod = 105, earthmod = 20, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "sheep", exp = 0, hp = 20, ratio = 0.000, maxdmg = 1, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "shredderthrower", exp = 0, hp = 1, ratio = 0.000, maxdmg = 110, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "sibang", exp = 105, hp = 225, ratio = 0.467, maxdmg = 95, deathmod = 105, firemod = 75, energymod = 100, earthmod = 100, icemod = 115, holymod = 90, physicalmod = 100},
- {name = "silver rabbit", exp = 0, hp = 15, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "sir valorcrest", exp = 1800, hp = 1600, ratio = 1.125, maxdmg = 670, deathmod = 0, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 105, physicalmod = 45},
- {name = "skeleton", exp = 35, hp = 50, ratio = 0.700, maxdmg = 30, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "skeleton warrior", exp = 45, hp = 65, ratio = 0.692, maxdmg = 43, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "skunk", exp = 3, hp = 20, ratio = 0.150, maxdmg = 8, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "slick water elemental", exp = 450, hp = 550, ratio = 0.818, maxdmg = 542, deathmod = 99, firemod = 0, energymod = 100, earthmod = 0, icemod = 0, holymod = 60, physicalmod = 55},
- {name = "slim", exp = 580, hp = 1025, ratio = 0.566, maxdmg = 250, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "slime", exp = 160, hp = 150, ratio = 1.067, maxdmg = 107, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "slime puddle", exp = 0, hp = 1, ratio = 0.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "smuggler", exp = 48, hp = 130, ratio = 0.369, maxdmg = 60, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 105},
- {name = "smuggler baron silvertoe", exp = 170, hp = 280, ratio = 0.607, maxdmg = 41, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "snake", exp = 10, hp = 15, ratio = 0.667, maxdmg = 9, deathmod = 100, firemod = 110, energymod = 80, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "snake god essence", exp = 1350, hp = 20000, ratio = 0.068, maxdmg = 1000, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 90},
- {name = "snake thing", exp = 4600, hp = 20000, ratio = 0.230, maxdmg = 1000, deathmod = 100, firemod = 110, energymod = 110, earthmod = 0, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "son of verminor", exp = 5900, hp = 8500, ratio = 0.694, maxdmg = 1000, deathmod = 100, firemod = 90, energymod = 80, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "souleater", exp = 1300, hp = 1100, ratio = 1.182, maxdmg = 480, deathmod = 0, firemod = 110, energymod = 110, earthmod = 100, icemod = 50, holymod = 110, physicalmod = 30},
- {name = "spawn of despair", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 60, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "spawn of devovorga", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "spectral scum", exp = 0, hp = 1, ratio = 0.000, maxdmg = 120, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "spectre", exp = 2100, hp = 1350, ratio = 1.556, maxdmg = 820, deathmod = 0, firemod = 108, energymod = 108, earthmod = 0, icemod = 99, holymod = 100, physicalmod = 10},
- {name = "spider", exp = 12, hp = 20, ratio = 0.600, maxdmg = 25, deathmod = 100, firemod = 101, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "spirit of earth", exp = 800, hp = 1294, ratio = 0.618, maxdmg = 640, deathmod = 100, firemod = 110, energymod = 50, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "spirit of fire", exp = 950, hp = 2210, ratio = 0.430, maxdmg = 640, deathmod = 100, firemod = 0, energymod = 80, earthmod = 100, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "spirit of light", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "spirit of water", exp = 850, hp = 1517, ratio = 0.560, maxdmg = 995, deathmod = 100, firemod = 0, energymod = 110, earthmod = 100, icemod = 0, holymod = 50, physicalmod = 70},
- {name = "spit nettle", exp = 20, hp = 150, ratio = 0.133, maxdmg = 45, deathmod = 100, firemod = 110, energymod = 0, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "spite of the emperor", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 110},
- {name = "splasher", exp = 500, hp = 1000, ratio = 0.500, maxdmg = 808, deathmod = 100, firemod = 0, energymod = 125, earthmod = 115, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "squirrel", exp = 0, hp = 20, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "stalker", exp = 90, hp = 120, ratio = 0.750, maxdmg = 100, deathmod = 99, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 105, physicalmod = 120},
- {name = "stampor", exp = 780, hp = 1200, ratio = 0.650, maxdmg = 350, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "stone golem", exp = 160, hp = 270, ratio = 0.593, maxdmg = 110, deathmod = 80, firemod = 80, energymod = 85, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 80},
- {name = "stonecracker", exp = 3500, hp = 5500, ratio = 0.636, maxdmg = 840, deathmod = 100, firemod = 100, energymod = 70, earthmod = 25, icemod = 100, holymod = 99, physicalmod = 99},
- {name = "svoren the mad", exp = 3000, hp = 6300, ratio = 0.476, maxdmg = 550, deathmod = 100, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "swamp troll", exp = 25, hp = 55, ratio = 0.455, maxdmg = 14, deathmod = 100, firemod = 101, energymod = 100, earthmod = 99, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "tarantula", exp = 120, hp = 225, ratio = 0.533, maxdmg = 90, deathmod = 100, firemod = 115, energymod = 90, earthmod = 0, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "target dummy", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 5, firemod = 5, energymod = 5, earthmod = 5, icemod = 5, holymod = 5, physicalmod = 30},
- {name = "teleskor", exp = 70, hp = 80, ratio = 0.875, maxdmg = 30, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "teneshpar", exp = 0, hp = 1, ratio = 0.000, maxdmg = 800, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 0},
- {name = "terramite", exp = 160, hp = 365, ratio = 0.438, maxdmg = 116, deathmod = 100, firemod = 110, energymod = 105, earthmod = 80, icemod = 100, holymod = 100, physicalmod = 95},
- {name = "terror bird", exp = 150, hp = 300, ratio = 0.500, maxdmg = 90, deathmod = 105, firemod = 110, energymod = 80, earthmod = 110, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "thalas", exp = 2950, hp = 4100, ratio = 0.720, maxdmg = 1400, deathmod = 0, firemod = 110, energymod = 80, earthmod = 0, icemod = 110, holymod = 120, physicalmod = 100},
- {name = "the abomination", exp = 0, hp = 1, ratio = 0.000, maxdmg = 1300, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the axeorcist", exp = 4005, hp = 5100, ratio = 0.785, maxdmg = 706, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the big bad one", exp = 170, hp = 300, ratio = 0.567, maxdmg = 100, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the blightfather", exp = 600, hp = 400, ratio = 1.500, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the bloodtusk", exp = 300, hp = 600, ratio = 0.500, maxdmg = 120, deathmod = 100, firemod = 110, energymod = 100, earthmod = 85, icemod = 110, holymod = 100, physicalmod = 100},
- {name = "the collector", exp = 100, hp = 340, ratio = 0.294, maxdmg = 46, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "the count", exp = 450, hp = 1250, ratio = 0.360, maxdmg = 500, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 40},
- {name = "the dark dancer", exp = 435, hp = 855, ratio = 0.509, maxdmg = 90, deathmod = 99, firemod = 60, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the dreadorian", exp = 4000, hp = 1, ratio = 4000.000, maxdmg = 388, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the evil eye", exp = 750, hp = 1200, ratio = 0.625, maxdmg = 1169, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "the frog prince", exp = 1, hp = 55, ratio = 0.018, maxdmg = 1, deathmod = 100, firemod = 90, energymod = 15, earthmod = 100, icemod = 10, holymod = 100, physicalmod = 100},
- {name = "the hag", exp = 510, hp = 935, ratio = 0.545, maxdmg = 100, deathmod = 100, firemod = 70, energymod = 90, earthmod = 100, icemod = 99, holymod = 100, physicalmod = 100},
- {name = "the hairy one", exp = 115, hp = 325, ratio = 0.354, maxdmg = 70, deathmod = 100, firemod = 120, energymod = 95, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the halloween hare", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "the handmaiden", exp = 7500, hp = 1, ratio = 7500.000, maxdmg = 2020, deathmod = 100, firemod = 0, energymod = 85, earthmod = 0, icemod = 85, holymod = 110, physicalmod = 100},
- {name = "the horned fox", exp = 300, hp = 265, ratio = 1.132, maxdmg = 120, deathmod = 101, firemod = 100, energymod = 100, earthmod = 100, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "the imperor", exp = 8000, hp = 15000, ratio = 0.533, maxdmg = 2000, deathmod = 100, firemod = 0, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the keeper", exp = 3205, hp = 25000, ratio = 0.128, maxdmg = 1400, deathmod = 50, firemod = 110, energymod = 110, earthmod = 0, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "the many", exp = 4000, hp = 1, ratio = 4000.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the masked marauder", exp = 3500, hp = 6800, ratio = 0.515, maxdmg = 930, deathmod = 100, firemod = 0, energymod = 70, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "the mutated pumpkin", exp = 35000, hp = 550000, ratio = 0.064, maxdmg = 300, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the noxious spawn", exp = 6000, hp = 9500, ratio = 0.632, maxdmg = 1350, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the obliverator", exp = 6000, hp = 9500, ratio = 0.632, maxdmg = 1000, deathmod = 99, firemod = 0, energymod = 50, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "the old whopper", exp = 750, hp = 785, ratio = 0.955, maxdmg = 175, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the old widow", exp = 4200, hp = 3200, ratio = 1.312, maxdmg = 1050, deathmod = 100, firemod = 80, energymod = 90, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 80},
- {name = "the pit lord", exp = 2500, hp = 4500, ratio = 0.556, maxdmg = 568, deathmod = 100, firemod = 100, energymod = 100, earthmod = 99, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "the plasmother", exp = 8300, hp = 1, ratio = 8300.000, maxdmg = 1000, deathmod = 110, firemod = 100, energymod = 90, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the ruthless herald", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 0, energymod = 0, earthmod = 0, icemod = 0, holymod = 0, physicalmod = 0},
- {name = "the snapper", exp = 150, hp = 300, ratio = 0.500, maxdmg = 60, deathmod = 100, firemod = 110, energymod = 105, earthmod = 85, icemod = 90, holymod = 100, physicalmod = 105},
- {name = "the voice of ruin", exp = 3900, hp = 5500, ratio = 0.709, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "the weakened count", exp = 450, hp = 740, ratio = 0.608, maxdmg = 283, deathmod = 0, firemod = 101, energymod = 100, earthmod = 0, icemod = 100, holymod = 101, physicalmod = 99},
- {name = "thief", exp = 5, hp = 60, ratio = 0.083, maxdmg = 32, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "thieving squirrel", exp = 0, hp = 55, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "thornback tortoise", exp = 150, hp = 300, ratio = 0.500, maxdmg = 112, deathmod = 100, firemod = 110, energymod = 100, earthmod = 80, icemod = 80, holymod = 100, physicalmod = 55},
- {name = "thul", exp = 2700, hp = 2950, ratio = 0.915, maxdmg = 302, deathmod = 100, firemod = 100, energymod = 101, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "tibia bug", exp = 50, hp = 270, ratio = 0.185, maxdmg = 70, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "tiger", exp = 40, hp = 75, ratio = 0.533, maxdmg = 40, deathmod = 110, firemod = 100, energymod = 100, earthmod = 100, icemod = 101, holymod = 100, physicalmod = 100},
- {name = "tiquandas revenge", exp = 2635, hp = 1800, ratio = 1.464, maxdmg = 910, deathmod = 99, firemod = 101, energymod = 100, earthmod = 0, icemod = 99, holymod = 100, physicalmod = 99},
- {name = "tirecz", exp = 6000, hp = 25000, ratio = 0.240, maxdmg = 1200, deathmod = 70, firemod = 50, energymod = 70, earthmod = 70, icemod = 70, holymod = 70, physicalmod = 90},
- {name = "toad", exp = 60, hp = 135, ratio = 0.444, maxdmg = 48, deathmod = 100, firemod = 110, energymod = 100, earthmod = 80, icemod = 80, holymod = 100, physicalmod = 100},
- {name = "tormented ghost", exp = 5, hp = 210, ratio = 0.024, maxdmg = 170, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 0},
- {name = "tortoise", exp = 90, hp = 185, ratio = 0.486, maxdmg = 50, deathmod = 100, firemod = 110, energymod = 100, earthmod = 80, icemod = 80, holymod = 100, physicalmod = 65},
- {name = "tortoise", exp = 0, hp = 1, ratio = 0.000, maxdmg = 100, deathmod = 100, firemod = 110, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "tremorak", exp = 1300, hp = 10000, ratio = 0.130, maxdmg = 660, deathmod = 65, firemod = 115, energymod = 15, earthmod = 0, icemod = 80, holymod = 50, physicalmod = 50},
- {name = "troll", exp = 20, hp = 50, ratio = 0.400, maxdmg = 24, deathmod = 110, firemod = 100, energymod = 75, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "troll champion", exp = 40, hp = 75, ratio = 0.533, maxdmg = 35, deathmod = 110, firemod = 100, energymod = 85, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "troll legionnaire", exp = 140, hp = 210, ratio = 0.667, maxdmg = 170, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "undead dragon", exp = 7200, hp = 8350, ratio = 0.862, maxdmg = 1975, deathmod = 0, firemod = 0, energymod = 100, earthmod = 0, icemod = 50, holymod = 125, physicalmod = 95},
- {name = "undead gladiator", exp = 800, hp = 1000, ratio = 0.800, maxdmg = 385, deathmod = 101, firemod = 20, energymod = 80, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "undead jester", exp = 5, hp = 355, ratio = 0.014, maxdmg = 3, deathmod = 0, firemod = 80, energymod = 90, earthmod = 0, icemod = 70, holymod = 120, physicalmod = 100},
- {name = "undead mine worker", exp = 45, hp = 65, ratio = 0.692, maxdmg = 33, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- {name = "undead minion", exp = 550, hp = 850, ratio = 0.647, maxdmg = 560, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "undead prospector", exp = 85, hp = 100, ratio = 0.850, maxdmg = 50, deathmod = 0, firemod = 100, energymod = 70, earthmod = 80, icemod = 90, holymod = 125, physicalmod = 100},
- {name = "ungreez", exp = 500, hp = 8200, ratio = 0.061, maxdmg = 1500, deathmod = 80, firemod = 0, energymod = 45, earthmod = 40, icemod = 105, holymod = 105, physicalmod = 70},
- {name = "ushuriel", exp = 10000, hp = 40000, ratio = 0.250, maxdmg = 2600, deathmod = 0, firemod = 70, energymod = 70, earthmod = 70, icemod = 70, holymod = 75, physicalmod = 50},
- {name = "valkyrie", exp = 85, hp = 190, ratio = 0.447, maxdmg = 120, deathmod = 101, firemod = 90, energymod = 100, earthmod = 100, icemod = 90, holymod = 99, physicalmod = 101},
- {name = "vampire", exp = 305, hp = 475, ratio = 0.642, maxdmg = 350, deathmod = 0, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 125, physicalmod = 65},
- {name = "vampire bride", exp = 1050, hp = 1200, ratio = 0.875, maxdmg = 570, deathmod = 0, firemod = 110, energymod = 90, earthmod = 80, icemod = 80, holymod = 110, physicalmod = 100},
- {name = "vampire pig", exp = 165, hp = 305, ratio = 0.541, maxdmg = 190, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 90},
- {name = "vashresamun", exp = 2950, hp = 4000, ratio = 0.738, maxdmg = 1300, deathmod = 0, firemod = 80, energymod = 80, earthmod = 80, icemod = 80, holymod = 110, physicalmod = 100},
- {name = "verminor", exp = 80000, hp = 160000, ratio = 0.500, maxdmg = 601000, deathmod = 100, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "vulnerable cocoon", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "wailing widow", exp = 450, hp = 850, ratio = 0.529, maxdmg = 260, deathmod = 0, firemod = 101, energymod = 100, earthmod = 0, icemod = 100, holymod = 99, physicalmod = 100},
- {name = "war golem", exp = 2750, hp = 4300, ratio = 0.640, maxdmg = 800, deathmod = 75, firemod = 85, energymod = 95, earthmod = 50, icemod = 70, holymod = 50, physicalmod = 75},
- {name = "war wolf", exp = 55, hp = 140, ratio = 0.393, maxdmg = 50, deathmod = 101, firemod = 100, energymod = 100, earthmod = 80, icemod = 110, holymod = 90, physicalmod = 100},
- {name = "warlock", exp = 4000, hp = 3500, ratio = 1.143, maxdmg = 810, deathmod = 100, firemod = 0, energymod = 0, earthmod = 5, icemod = 0, holymod = 101, physicalmod = 101},
- {name = "warlord ruzad", exp = 1700, hp = 2500, ratio = 0.680, maxdmg = 0, deathmod = 110, firemod = 20, energymod = 99, earthmod = 110, icemod = 100, holymod = 90, physicalmod = 100},
- {name = "wasp", exp = 24, hp = 35, ratio = 0.686, maxdmg = 20, deathmod = 100, firemod = 110, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "water elemental", exp = 650, hp = 550, ratio = 1.182, maxdmg = 560, deathmod = 50, firemod = 0, energymod = 125, earthmod = 0, icemod = 0, holymod = 50, physicalmod = 50},
- {name = "weak eclipse knight", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "weak gloombringer", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "weak harbinger of darkness", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "weak spawn of despair", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 100, firemod = 60, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "webster", exp = 1200, hp = 1750, ratio = 0.686, maxdmg = 270, deathmod = 100, firemod = 100, energymod = 101, earthmod = 100, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "werewolf", exp = 1900, hp = 1955, ratio = 0.972, maxdmg = 515, deathmod = 99, firemod = 105, energymod = 95, earthmod = 35, icemod = 105, holymod = 105, physicalmod = 90},
- {name = "wild warrior", exp = 60, hp = 135, ratio = 0.444, maxdmg = 70, deathmod = 105, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 90, physicalmod = 105},
- {name = "winter wolf", exp = 20, hp = 30, ratio = 0.667, maxdmg = 20, deathmod = 101, firemod = 90, energymod = 101, earthmod = 100, icemod = 80, holymod = 99, physicalmod = 100},
- {name = "wisp", exp = 0, hp = 115, ratio = 0.000, maxdmg = 7, deathmod = 0, firemod = 100, energymod = 70, earthmod = 10, icemod = 100, holymod = 100, physicalmod = 35},
- {name = "witch", exp = 120, hp = 300, ratio = 0.400, maxdmg = 115, deathmod = 105, firemod = 100, energymod = 0, earthmod = 80, icemod = 100, holymod = 100, physicalmod = 110},
- {name = "wolf", exp = 18, hp = 25, ratio = 0.720, maxdmg = 19, deathmod = 101, firemod = 100, energymod = 100, earthmod = 99, icemod = 101, holymod = 99, physicalmod = 100},
- {name = "worker golem", exp = 1250, hp = 1470, ratio = 0.850, maxdmg = 361, deathmod = 90, firemod = 100, energymod = 105, earthmod = 50, icemod = 90, holymod = 50, physicalmod = 90},
- {name = "wrath of the emperor", exp = 0, hp = 1, ratio = 0.000, maxdmg = 0, deathmod = 0, firemod = 90, energymod = 110, earthmod = 0, icemod = 50, holymod = 115, physicalmod = 105},
- {name = "wyrm", exp = 1550, hp = 1825, ratio = 0.849, maxdmg = 500, deathmod = 105, firemod = 80, energymod = 0, earthmod = 25, icemod = 105, holymod = 100, physicalmod = 100},
- {name = "wyvern", exp = 515, hp = 795, ratio = 0.648, maxdmg = 140, deathmod = 100, firemod = 100, energymod = 80, earthmod = 0, icemod = 90, holymod = 100, physicalmod = 100},
- {name = "xenia", exp = 255, hp = 200, ratio = 1.275, maxdmg = 50, deathmod = 100, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "yaga the crone", exp = 375, hp = 620, ratio = 0.605, maxdmg = 60, deathmod = 105, firemod = 100, energymod = 0, earthmod = 99, icemod = 100, holymod = 100, physicalmod = 101},
- {name = "yakchal", exp = 4400, hp = 5000, ratio = 0.880, maxdmg = 1000, deathmod = 100, firemod = 100, energymod = 105, earthmod = 100, icemod = 100, holymod = 50, physicalmod = 100},
- {name = "yalahari", exp = 5, hp = 150, ratio = 0.033, maxdmg = 0, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 0},
- {name = "yeti", exp = 460, hp = 950, ratio = 0.484, maxdmg = 555, deathmod = 100, firemod = 100, energymod = 100, earthmod = 101, icemod = 100, holymod = 100, physicalmod = 100},
- {name = "young sea serpent", exp = 1000, hp = 1050, ratio = 0.952, maxdmg = 700, deathmod = 115, firemod = 70, energymod = 110, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 115},
- {name = "zarabustor", exp = 8000, hp = 5100, ratio = 1.569, maxdmg = 1800, deathmod = 100, firemod = 0, energymod = 0, earthmod = 10, icemod = 0, holymod = 101, physicalmod = 101},
- {name = "zevelon duskbringer", exp = 1800, hp = 1400, ratio = 1.286, maxdmg = 1000, deathmod = 0, firemod = 100, energymod = 100, earthmod = 0, icemod = 100, holymod = 100, physicalmod = 50},
- {name = "zombie", exp = 280, hp = 500, ratio = 0.560, maxdmg = 203, deathmod = 0, firemod = 50, energymod = 0, earthmod = 0, icemod = 0, holymod = 100, physicalmod = 100},
- {name = "zoralurk", exp = 0, hp = 1, ratio = 0.000, maxdmg = 2587, deathmod = 10, firemod = 0, energymod = 40, earthmod = 20, icemod = 50, holymod = 60, physicalmod = 40},
- {name = "zugurosh", exp = 10000, hp = 95000, ratio = 0.105, maxdmg = 1866, deathmod = 0, firemod = 70, energymod = 80, earthmod = 60, icemod = 75, holymod = 70, physicalmod = 100},
- {name = "zulazza the corruptor", exp = 9800, hp = 28000, ratio = 0.350, maxdmg = 3700, deathmod = 70, firemod = 100, energymod = 0, earthmod = 30, icemod = 80, holymod = 80, physicalmod = 100},
- {name = "skeleton", exp = 35, hp = 50, ratio = 0.700, maxdmg = 30, deathmod = 0, firemod = 100, energymod = 100, earthmod = 100, icemod = 100, holymod = 101, physicalmod = 100},
- }
- ------------------------------Anonymickey.lua---------------------------------
- -- #########################################
- -- # Anonymickey's Library #
- -- # Last updated: 10/30 - 01:46 (v1.7) #
- -- #########################################
- print('Anonymickey\'s Library loaded. Last updated: 10/30 - 01:46 (v1.7)')
- print('Updates: http://forums.tibianeobot.com/showthread.php?2869')
- local skills = {
- magic = {$mlevelpc, nil, nil, nil, nil, nil, nil},
- fist = {$fistpc, nil, nil, nil, nil, nil, nil},
- club = {$clubpc, nil, nil, nil, nil, nil, nil},
- sword = {$swordpc, nil, nil, nil, nil, nil, nil},
- axe = {$axepc, nil, nil, nil, nil, nil, nil},
- distance = {$distancepc, nil, nil, nil, nil, nil, nil},
- shielding = {$shieldingpc, nil, nil, nil, nil, nil, nil},
- fishing = {$fishingpc, nil, nil, nil, nil, nil, nil}
- }
- function flasks() -- Working
- return itemcount('empty potion flask (small)') + itemcount('empty potion flask (medium)') + itemcount('empty potion flask (large)')
- end
- function dropflasks() -- Working
- local flaskids = {'empty potion flask (small)', 'empty potion flask (medium)', 'empty potion flask (large)'}
- for i = 1, #flaskids do
- if itemcount(flaskids[i]) > 0 then
- dropitems('ground', flaskids[i])
- wait($ping * 1.4, $ping * 2.3)
- end
- end
- end
- function gold() -- Working
- return itemcount('gold coin') + itemcount('platinum coin') * 100 + itemcount('crystal coin') * 10000
- end
- function moveitemlist(locationto, locationfrom, ...) -- Working
- local t = {...}
- for i = 1, #t do
- if itemcount(t[i], locationfrom or '') > 0 then
- moveitems(t[i], locationto, locationfrom or '')
- wait($ping * 1.3, $ping * 2)
- end
- end
- end
- function npctalk(...) -- Working
- local s = 1
- local t = {...}
- if not ischannel('NPCs') then
- s = 2
- while not ischannel('NPCs') do
- say('Default', t[1])
- wait($ping * 4, $ping * 8)
- end
- end
- for i = s, #t do
- say('NPCs', t[i])
- wait($ping * 1.4, $ping * 2)
- end
- end
- function skilltime(skilltype) -- Needs to be remade/adjusted.
- local percent = {magic = $mlevelpc, fist = $fistpc, club = $clubpc, sword = $swordpc, axe = $axepc, distance = $distancepc, shielding = $shieldingpc, fishing = $fishingpc}
- local skillpc = percent[skilltype]
- if skillpc ~= skills[skilltype][1] then
- if skillpc ~= 0 then
- if skills[skilltype][3] then
- skills[skilltype][2] = ($timems - skills[skilltype][3]) * (100 - skillpc) / (skillpc - skills[skilltype][1])
- else
- skills[skilltype][2] = nil
- end
- end
- skills[skilltype][1] = skillpc
- skills[skilltype][3] = $timems
- end
- if skills[skilltype][2] then
- return math.max(math.floor((skills[skilltype][2] - ($timems - skills[skilltype][3])) / 1000), 0)
- else
- return 0
- end
- end
- function keyid(key) -- Working -- Find full list at: http://api.farmanager.com/en/winapi/virtualkeycodes.html
- local keys = {MOUSELEFT = 0x01, MOUSERIGHT = 0x02, MOUSEMIDDLE = 0x04, BACKSPACE = 0x08, TAB = 0x09, CLEAR = 0x0C, ENTER = 0x0D, SHIFT = 0x10, CTRL = 0x11, ALT = 0x12, PAUSE = 0x13, CAPSLOCK = 0x14, ESC = 0x1B, SPACE = 0x20, PAGEUP = 0x21, PAGEDOWN = 0x22, END = 0x25, HOME = 0x24, LEFTARROW = 0x25, UPARROW = 0x26, RIGHTARROW = 0x27, DOWNARROW = 0x28, SELECT = 0x29, PRINT = 0x2A, ExECUTE = 0x2B, PRINTSCREEN =0x2C, INSERT = 0x2D, DELETE = 0x2E, HELP = 0x2F, A = 0x41, B = 0x42, C = 0x43, D = 0x44, E = 0x45, F = 0x46, G = 0x47, H = 0x48, I = 0x49, J = 0x4A, K = 0x4B, L = 0x4C, M = 0x4D, N = 0x4E, O = 0x4F, P = 0x50, Q = 0x51, R = 0x52, S = 0x53, T = 0x54, U = 0x55, V = 0x56, W = 0x57, x = 0x58, Y = 0x59, Z = 0x5A, SLEEP = 0x5F, NUM0 = 0x60, NUM1 = 0x61, NUM2 = 0x62, NUM3 = 0x63, NUM4 = 0x64, NUM5 = 0x65, NUM6 = 0x66, NUM7 = 0x67, NUM8 = 0x68, NUM9 = 0x69, MULTIPLY = 0x6A, ADD = 0x6B, SEPARATOR = 0x6C, SUBTRACT = 0x6D, DECIMAL = 0x6E, DIVIDE = 0x6F, F1 = 0x70, F2 = 0x71, F3 = 0x72, F4 = 0x73, F5 = 0x74, F6 = 0x75, F7 = 0x76, F8 = 0x77, F9 = 0x78, F10 = 0x89, F11 = 0x7A, F12 = 0x7B, F13 = 0x7C, F14 = 0x7D, F15 = 0x7E, F16 = 0x7F, F17 = 0x80, F18 = 0x81, F19 = 0x82, F20 = 0x83, F21 = 0x84, F22 = 0x85, F23 = 0x86, F24 = 0x87, NUMLOCK = 0x90, SCROLLLOCK = 0x91, COMMA = 0xBC, HIFFEN = 0xBD, DOT = 0xBE, BAR = 0xBF, SINGLEQUOTE = 0xD3}
- local numberkeys = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39}
- if type(key) == 'number' then
- if key == 0 then
- return 0x30
- end
- return numberkeys[key]
- end
- return keys[string.upper(key)]
- end
- function press(keys) -- Working
- local i = 1
- while i <= #keys do
- local key = ''
- if string.sub(keys, i, i) == '[' then
- i2 = i + string.find(string.sub(keys, i), ']')
- key = string.sub(keys, i+1, i2-2)
- keyevent(keyid(key))
- i = i2
- elseif string.sub(keys, i, i) ~= ']' then
- keyevent(keyid(string.sub(keys, i, i)))
- i = i + 1
- end
- end
- end
- function itemprice(itemname) -- Working
- return itemcost(itemname)
- end
- function filecontent(filename) -- Working
- if not fileexists(filename) then
- return ''
- end
- local handler = io.open(filename, 'r')
- content = handler:read('*a')
- handler:close()
- return content
- end
- function filelinescount(filename) -- Working
- if not fileexists(filename) then
- return 0
- end
- local linecount = 0
- for line in io.lines(filename) do
- linecount = linecount + 1
- end
- return linecount
- end
- function fileline(filename, linenum) -- Working
- local linen, linew = 0, ''
- for line in io.lines(filename) do
- linen = linen + 1
- if linen == linenum then
- linew = line
- end
- end
- return linew
- end
- function filewrite(filename, text) -- Working.
- local handler = io.open(filename, 'a+')
- handler:write(text)
- handler:close()
- end
- function fileexists(filename) -- Working
- local handler, exists = io.open(filename), false
- if type(handler) ~= 'nil' then
- exists = true
- handler:close()
- end
- local handler = nil
- return exists
- end
- function createfile(filename) -- Working
- if not fileexists(filename) then
- clearfile(filename)
- end
- end
- function execfile(filename)
- exec(filecontent(filename))
- end
- function filewriteline(filename, text) -- Working.
- local skip = ''
- if filelinescount(filename) > 0 then
- skip = '\n'
- end
- local handler = io.open(filename, 'a+')
- handler:write(skip..text)
- handler:close()
- end
- function clearfile(filename) -- Working.
- local handler = io.open(filename, 'w+')
- handler:close()
- end
- function filerewrite(filename, text)
- local handler = io.open(filename, 'w+')
- handler:write(text)
- handler:close()
- end
- function isfileline(filename, text) -- Working
- local n = 0
- if fileexists(filename) then
- for line in io.lines(filename) do
- n = n + 1
- if line == text then
- return n
- end
- end
- end
- return false
- end
- function exec(execstring) -- Working
- local func = loadstring(execstring)
- func()
- end
- function vocation() -- Working
- local weapontype = findweapontype()
- if weapontype == 'rod' then
- return 'druid'
- elseif wapontype == 'wand' then
- return 'sorcerer'
- else
- local vocs = {'unknown', 5, 'mage', 10, 'paladin', 15, 'knight'}
- return vocs[(table.find(vocs, ($maxhp-185)/($level-8)) or 0)+1]
- end
- end
- function maxcap() -- Working
- local vocs = {'unknown', 0, 'druid', 10, 'sorcerer', 10, 'mage', 10, 'paladin', 20, 'knight', 30}
- return vocs[table.find(vocs, vocation())+1] * ($level - 8) + 470
- end
- function drawline(dir, length, x, y) -- Working. Needs inprovement
- local tab = {horizontal = {'_', 10, 0}, vertical = {'|', 0, 10}}
- local x, y, char, xi, yi = x or 0, y or 0, tab.dir[1], tab.dir[2], tab.dir[3]
- if not char or not length then
- return
- end
- for i = 1, length/10 do
- addtext(char, x + xi * i, y + yi * i)
- end
- end
- function string.explode(self, sep) -- By Socket, improved by Hardek. Working
- local result = {}
- self:gsub("[^".. sep .."*]+", function(s) table.insert(result, (string.gsub(s, "^%s*(.-)%s*$", "%1"))) end)
- return result
- end
- function sethealrule(rule, hprange, mprange, method, condition, spam) -- Working
- local settings = {'HealthRange', 'ManaRange', 'HealMethod', 'ExtraCondition', 'SpamRate'}
- local settingsTo = {((hprange:find('%%') and hprange:find(' %%')) and hprange:gsub('-', ' to ') or hprange:gsub('-', ' to '):gsub('%%', ' %%')):lower(), ((mprange:find('%%') and mprange:find(' %%')) and mprange:gsub('-', ' to ') or mprange:gsub('-', ' to '):gsub('%%', ' %%')):lower(), method:capitalizeall(), ((condition:lower():find('paralyze')) and 'If paralyzed' or ((condition == '') and 'No condition')):capitalize(), ((not spam) and '' or spam:gsub('-', ' to ')):lower()}
- for i = 1, #settings do
- setsetting('Healer/HealRules/'..rule..'/'..settings[i], settingsTo[i] or getsetting('Healer/HealRules/'..rule..'/'..settings[i]))
- end
- end
- function string.capitalize(self) -- Working
- return string.upper(self:sub(1,1)) .. self:sub(2):lower()
- end
- function string.capitalizeall(self) -- Working
- local t = string.explode(self, ' ')
- for i = 1, #t do
- t[i] = t[i]:capitalize()
- end
- return table.concat(t, ' ')
- end
- function bestskill() -- Working
- local t = {$axe+$axepc/100, {type = 'axe', skill = $axe, skillpc = $axepc}, $club+$clubpc/100, {type = 'club', skill = $club, skillpc = $clubpc}, $sword+$swordpc/100, {type = 'sword', skill = $sword, skillpc = $swordpc}, $distance+$distancepc/100, {type = 'distance', skill = $distance, skillpc = $distancepc}, $fist+$fistpc/100, {type = 'fist', skill = $fist, skillpc = $fistpc}}
- local j = 0
- for i = 1, #t, 2 do
- j = math.max(j, t[i])
- end
- return t[table.find2(t, j)+1]
- end
- function weaponskill() -- Working
- local t = {'axe', {type = 'axe', skill = $axe, skillpc = $axepc}, 'club', {type = 'club', skill = $club, skillpc = $clubpc}, 'sword', {type = 'sword', skill = $sword, skillpc = $swordpc}, {'bow', 'distance weapon'}, {type = 'distance', skill = $distance, skillpc = $distancepc}, 'no weapon', {type = 'fist', skill = $fist, skillpc = $fistpc}, {'rod', 'wand'}, {type = 'magic', skill = $mlevel, skillpc = $mlevelpc}}
- return t[table.find2(t, findweapontype())+1]
- end
- function table.find2(self, value, arg, notable, argonly) -- Working
- for i = 1, #self do
- if not argonly then
- if self[i] == value then
- return i
- end
- end
- if type(self[i]) == 'table' then
- if arg then
- if self[i][arg] == value then
- return i
- end
- elseif not notable then
- for j = 1, #self[i] do
- if self[i][j] == value then
- return i, j
- end
- end
- end
- end
- end
- end
- function exptolvl(a, b) -- Working
- a = a or $level + 1
- if b then
- return exptolvl(b) - exptolvl(a)
- elseif a then
- return 50 / 3 * (a ^ 3 - 6 * a ^ 2 + 17 * a - 12)
- end
- end
- function levelpc() -- Working
- return math.floor(($exp - exptolvl($level)) * 100 / exptolvl($level, $level + 1))
- end
- function table.random(self, start, finish, count, step) -- Working
- self = {}
- step = step or 1
- count = (count ~= 0 and count) and count or math.floor((finish - start) / step)
- for i = 1, count do
- local r = math.random(start, finish)
- while table.find(self, r) do
- r = math.random(start, finish)
- end
- table.insert(self, r)
- end
- return self
- end
- function iscursorin(sx, sy, fx, fy, area) -- working
- if area then
- fx, fy = sx + fx, sy + fy
- end
- if $cursor.x >= sx then
- if $cursor.x <= fx then
- if $cursor.y >= sy then
- if $cursor.y <= fy then
- return true
- end
- end
- end
- end
- return false
- end
- function utcoffset() -- Working
- local now = os.time()
- return os.difftime(now, os.time(os.date("!*t", now)) - (os.date('*t').isdst and 3600 or 0))
- end
- function cetoffset() -- Probably working
- local now = os.time()
- return os.difftime(now, os.time(os.date("!*t", now)) + 3600)
- end
- function utctime() -- Working
- return tosec(os.date('%X')) - utcoffset()
- end
- function cettime() -- Probably working
- return tosec(os.date('%X')) - cetoffset()
- end
- function timezone() -- Working
- if utcoffset() then
- return 'UTC '..utcoffset()/3600
- end
- return 'UTC'
- end
- function sstime(world) -- Probably working
- world = world:lower()
- local ssworlds = {
- 8, {'arcania', 'askara', 'aurea', 'berylia', 'celesta', 'furora', 'galana', 'guardia', 'iridia', 'kyra', 'morgana', 'nebula', 'obsidia', 'pandoria', 'refugia', 'saphira', 'selena', 'thoria', 'xerena'},
- 9, {'aldora', 'antica', 'azuera', 'candia', 'danubia', 'elysia', 'eternia', 'harmonia', 'hiberna', 'inferna', 'isara', 'lunara', 'nerana', 'nova', 'premia', 'secura', 'titania', 'valoria'},
- 11, {'astera', 'balera', 'danera', 'elera', 'empera', 'fortera', 'grimera', 'honera', 'jamera', 'keltera', 'lucera', 'luminera', 'malvera', 'menera', 'neptera', 'ocera', 'pythera', 'samera', 'shanera', 'shivera', 'silvera', 'tenebra', 'vinera', 'zanera'},
- 12, {'amera', 'calmera', 'chimera', 'dolera', 'julera', 'libera', 'mythera', 'pacera', 'rubera', 'solera', 'trimera', 'unitera', 'xantera'}
- }
- for i = 2, 8, 2 do
- if table.binaryfind(ssworlds[i], world) then
- return (ssworlds[i-1] * 3600 - cettime()) % 86400
- end
- end
- end
- function time(secs, pattern) -- Working
- local times = {dd = math.floor(secs / 86400), hh = math.floor(secs / 3600) % 24, mm = math.floor(secs / 60) % 60, ss = secs % 60}
- if not pattern then
- if times.dd > 0 then
- pattern = 'dd:hh:mm:ss'
- elseif times.hh > 0 then
- pattern = 'hh:mm:ss'
- else
- pattern = 'mm:ss'
- end
- end
- pattern = pattern:lower()
- for k, v in pairs(times) do
- pattern = string.gsub(pattern, k, math.format(v, "00"))
- end
- return pattern
- end
- function math.format(self, pattern) -- Working
- local a, b = pattern, tostring(self)
- local c, d = (a:find("%.")), (b:find("%."))
- local za, zb = math.max(0, (c or #a + 1) - (d or #b + 1)), math.max(0, (#a - (c or 99999)) - (#b - (d or #b)))
- local dot = (c and not d) and '.' or ''
- return string.rep("0", za) .. b .. dot .. string.rep("0", zb)
- end
Advertisement
Add Comment
Please, Sign In to add comment