added: offline botting
changed: not in fight to start a bot
added: bot statistics
added: botting status (only for clients <9.0)
added: current action status
added: bot channel
added: calculating spell efficiency calculator (still beta)
fixed: heal bot loop
fixed: other minor bugs
added: paladin dist attacks
fixed: player could log out throwing error at console
added: you can now choose one from three info message types
added: now you can choose if player's outfit changes while botting
added: !checknodes, !botcommands commands to talkaction
function doPlayerShowNodesMessage(cid)
function changeOutfitOnBot(cid, oldOutfitStorage, newOutfitColor, action, firstUse)
function showStatistics(cid)
function killBotIfOffline(cid)
function botChannelLog(cid, message)
function doSendBottingInfo(cid)
function doSendColorSquare(cid)
function setPlayerAction(cid, action)
function reachCreature(cid, pid)
Your scripting skills are amazing
wow, I'm really amazed ! keep it going ! :')
OPEN TIBIA BOT (LUA SIDED)
I was working on this project recently very much and this is what I came up with.
The idea to create a lua project that would give a player possibility to gain exp while afk came to my mind after the open tibia servers were updated to 8.7. Most people couldn't use their elfbots to gain experience since elfbot wasn't supported anymore by NG Studios. So I thought "why not give them a free bot, that they don't even need to download?" and I created a http://otland.net/f81/teckmans-heal-bot-140091/ which is actually introduced in this bot. Currently I am developing the bot only for the newest revisions of tfs 0.3 (maybe it can work downversion but it's not tested).
So first the film showing current features (29 march 2013):
[video=youtube;6KrgOr-4Eeo]http://www.youtube.com/watch?v=6KrgOr-4Eeo[/video]
Changelog:
PHP:Cur rev: 2 2013-03-29 Released Beta 1 2013-03-29 Released Rev.2 added: offline botting changed: not in fight to start a bot added: bot statistics added: botting status (only for clients <9.0) added: current action status added: bot channel added: calculating spell efficiency calculator (still beta) fixed: heal bot loop fixed: other minor bugs added: paladin dist attacks fixed: player could log out throwing error at console added: you can now choose one from three info message types added: now you can choose if player's outfit changes while botting added: !checknodes, !botcommands commands to talkaction
The list of features:
PHP:- Adding and removing nodes - Start/stop botting - Moving to a node - Moving to another node if blocked - Auto potion heal - Auto spell heal - Smart healing system - Meele attacking - Spell casting - Following/reaching creature - Offline botting - Botting info - Changing outfit while botting - Session statistics - Bot channel and more...
Here is the list of all lib functions that can be used to create some own systems:
Lua:function doAnimatedInfo(cid, pos, message, color) function getWaitTime(cid) function addWaitTime(cid, time) function resetWaitTime(cid) function botDebug(message) function getCreaturesOnScreen(pos) function getCreatureFocus(cid, pid) function mapScreen(pos) function loadDirection(fromPos, toPos) function loadOtherDirections(dir) function moveFromTo(cid, fromPos, toPos) function addCavebotNode(cid) function resetNodes(cid) function doPlayerSetFocus(cid, pid) function isFocused(cid) function getPlayerFocus(cid) function setPlayerCurrentNodeId(cid, node) function getPlayerCurrentNodeId(cid) function getPlayerNextNodeId(cid) function loadNode(cid, node) function getRangeBetween(cid, pid) function doSpellAttack(cid, pid) function getPlayerWeaponInfo(cid) function doMeeleAttack(cid, pid) function healPlayerUsingPotion(cid) function checkFocus(cid) function startBot(cid) function doFollowMonster(cid, pid, lastCidPos, lastPidPos, previousRange) function healManaWithPotion(cid, potions) function healHealthWithPotion(cid, potions) function usePotion(cid, type) function kill(cid, type, bring) function isKilled(cid, type) function doHealPlayer(cid) function setOwnExhaustion(cid, id, time) function getOwnEhxaustion(cid, id) function doPlayerShowNodesMessage(cid) function changeOutfitOnBot(cid, oldOutfitStorage, newOutfitColor, action, firstUse) function showStatistics(cid) function killBotIfOffline(cid) function botChannelLog(cid, message) function doSendBottingInfo(cid) function doSendColorSquare(cid) function setPlayerAction(cid, action) function reachCreature(cid, pid)
And now the bot's libraries:
Main libraries:
Open Tibia Bot by Teckman.rar - Speedy Share - upload your files here
/data/lib/openBotConfig.lua
Lua:--//////////////////////////////////////////////////////////////////////////////////////////////// --////////////////////////// ////////////////////////// --////////////////// ////////////////// --/////////// Teckman's Bot System (LUA sided) /////////// --////// otland.net/f81/bot-lib-talkaction-open-tibia-bot-teckman-185444/ ////// --////////// rev.2 /////////// --////////////////// If you have any suggestions just PM me ////////////////// --////////////////////////// ////////////////////////// --//////////////////////////////////////////////////////////////////////////////////////////////// --////////////////////////// MAIN CONFIGURATION ////////////////////////// CHANGE_OUTFIT_ON_BOT = true -- INDICATES IF PLAYER'S OUTFIT CHANGE TO A CERTAIN COLOR WHILE BOTTING NEW_OUTFIT_COLOR = COLOR_DARKPURPLE BOT_CHANNEL_LOG = true -- IT WILL ALSO WORK ON NOT CUSTOM CHANNELS BUT IT'S NOT ADVISED BOT_CHANNEL_ID = 9 -- /DATA/XML/CHANNELS.XML CAN_HUNT_WHILE_OFFLINE = false -- IT'S STRANGE BUT NOW PEOPLE CAN BOT WHILE THEY'RE OFFLINE (ONLY IF 'true') SHOW_STATISTICS = true -- SUCH AS EXP/H, GAINED EXP, HUNT TIME AND SO ON BOTTING_INFO_ENABLED = true MESSAGE_INFO_TYPE = "cancel" -- AVAILABLE: "cancel" (advised), "console", "bot_channel" CLIENT_VERSION = 981 -- VERSION IN 3 DIGITS NUMBER (IF YOU ALLOW MULTIPLE CLIENT VERSIONS THEN SET TO THE HIGHEST ONE) ANIMATED_IFNO = true -- DEPRECATED ON 9.0+ VERSIONS, STILL WORKING ON LOWER DEBUG_MODE = false -- ADVICED TO TURN 'false' SINCE IT'S FOR DEVELOPING INFO ONLY MAX_CAVEBOT_NODES = 40 --////////////////////////// STORAGES CONFIGURATION ////////////////////////// OLD_OUTFIT_STORAGE = 900000 -- PLUS SOME FURTHER STORAGES NODE_START_STORAGE = 10000 TARGETING_FOCUS_STORAGE = 11000 CAVEBOT_NODE_STORAGE = 12000 CAVEBOT_CURRENT_NODE_STORAGE = 13000 ANIMATED_INFO_STORAGE = 19000 CHANGE_NODE_STORAGE = 220000 FUNCTION_KILL_STORAGE = 250000 STATISTICS_STORAGES = 23000 -- PLUS SOME FURTHER STORAGES CURRENT_BOT_ACTION = 190000 EX_EXHAUSTION = 65000 --////////////////////////// DELAY/INTERVAL CONFIGURATION (IN MS) ////////////////////////// CAVEBOT_WALK_DELAY = 200 TARGETING_MEELE_INTERVAL = 2000 -- HOW OFTEN A PLAYER WILL DO A MELEE ATTACK ANIMATED_SPAM_RATE = 2000 CHECK_FOCUS_DELAY = 100 MIN_BLOCKED_TIME_TO_CHANGE_NODE = 10000 -- AFTER HOW MANY SECONDS A PLAYER WILL CHANGE TO ANOTHER NODE IF STUCK POTION_DELAY = 1000 -- POTIONING DELAY STATISTICS_INTERVAL = 15000 -- HOW OFTEN STATISTICS ARE SHOW (ABOUT 4 LINES IN BOT LOG) --////////////////////////// OTHER CONFIGURATION ////////////////////////// HEALING_WITH_POTION = 60 -- IN % (FROM HOW MUCH 80% BOT WILL USE A POTION. NO WORRIES IT HAS BUILDED SMART POTIONING SYSTEM - SO NO WASTE) BLOCKED_TILES = { 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5654, 5653, 5652, 9026, 9027, 9028, 9029, 9030, 9031, 9032, 9033, 9034, 9035, 9036, 9037, 9038, 9039, 9040, 9041, 9042, 1304, 598, 599, 600, 601 }
Database:
Code:CREATE TABLE IF NOT EXISTS `bot_nodes` ( `nodeId` int(11) NOT NULL, `playerId` int(11) NOT NULL, `x` int(11) NOT NULL, `y` int(11) NOT NULL, `z` int(11) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I will update bot frequently. It will be all reported in changelog.
IMPORTANT:
If someone could create a function that would check if player can step on a tile without going through every declared item on a tile I would be thankful.
looks good. Well work and for sure alot of time spent. But my question is : I edited my ot files to debug if custom or edited clients are connecting to it(preventing selfmade bots) and debug if any programms are used on a client = debug since it changed theyre notification of my source.
So is anyone there to test this since I didnt see a dl link there ? I'd liek to see if my shit is still save
FLAG_PATHFINDING = 16
FLAG_IGNOREFIELDDAMAGE = 32
function _isWalkable(cid, position, ignoreFieldDamage, ignorePathfinding)
return doTileQueryAdd(ignoreFieldDamage and cid or getCreatureByName("Rat"), position, (ignoreFieldDamage and FLAG_IGNOREFIELDDAMAGE or 0) + (not ignorePathfinding and FLAG_PATHFINDING or 0))
end
2013-04-02 Revision 3 released
added: auto looting
added: auto coin changing
added: isBotting(cid) command
added: !removeloot, !resetloot, !addloot commands to talkaction
function doPlayerShowNodesMessage(cid)
function isBotting(cid)
autoLoot.createLootTable(corpse)
autoLoot.getPlayerLooting(cid)
autoLoot.addPlayerLootItem(cid, item)
autoLoot.resetPlayerLootItems(cid)
autoLoot.findPlayerLootItem(cid, item)
autoLoot.removePlayerLootItem(cid, item)
autoLoot.doLoot(cid, pos, item)
autoLoot.automaticallyChangeCoins(cid)
CREATE TABLE IF NOT EXISTS `bot_auto_loot` (
`playerId` int(11) NOT NULL,
`itemId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@teckman
Use engine function to 'auto walk to point', your bot makes too many diagonal moves. Engine function can be faster then your LUA code.
My functions from luascript.cpp (TFS 0.3.6):
[CPP]
int32_t LuaScriptInterface::luaGoTo(lua_State* L)
{
//goTo(cid, position, minDist, maxDist, fullPathSearch, clearSight, maxSearchDist)
int32_t maxSearchDist = 1;
if(lua_gettop(L) > 6)
maxSearchDist = popNumber(L);
bool clearSight = true;
if(lua_gettop(L) > 5)
clearSight = popNumber(L);
bool fullPathSearch = true;
if(lua_gettop(L) > 4)
fullPathSearch = popNumber(L);
int32_t maxDist = 1;
if(lua_gettop(L) > 3)
maxDist = popNumber(L);
int32_t minDist = 1;
if(lua_gettop(L) > 2)
minDist = popNumber(L);
PositionEx pos;
popPosition(L, pos);
std::list<Direction> listDir;
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
if(g_game.getPathToEx(player, pos, listDir, minDist, maxDist, fullPathSearch, clearSight, maxSearchDist))
{
lua_pushboolean(L, g_game.playerAutoWalk(player->getID(), listDir));
return 1;
}
}
lua_pushboolean(L, false);
return 1;
}
int32_t LuaScriptInterface::luaCanGoTo(lua_State* L)
{
//canGoTo(cid, position, minDist, maxDist, fullPathSearch, clearSight, maxSearchDist)
int32_t maxSearchDist = 1;
if(lua_gettop(L) > 6)
maxSearchDist = popNumber(L);
bool clearSight = true;
if(lua_gettop(L) > 5)
clearSight = popNumber(L);
bool fullPathSearch = true;
if(lua_gettop(L) > 4)
fullPathSearch = popNumber(L);
int32_t maxDist = 1;
if(lua_gettop(L) > 3)
maxDist = popNumber(L);
int32_t minDist = 1;
if(lua_gettop(L) > 2)
minDist = popNumber(L);
PositionEx pos;
popPosition(L, pos);
std::list<Direction> listDir;
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
if(g_game.getPathToEx(player, pos, listDir, minDist, maxDist, fullPathSearch, clearSight, maxSearchDist))
{
lua_pushboolean(L, true);
return 1;
}
}
lua_pushboolean(L, false);
return 1;
}[/CPP]