Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
My bot
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: My bot

  1. #1
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    My bot

    Since I won't be developing it anymore, I decided to release it

    Largely based/influenced upon TibiaAPI (as a lot of C# Tibia projects tend to be) and beziak's internal caller

    Quote Originally Posted by README
    This project was released in an unfinished state, there will be bugs, and ugly and non-commented code,
    it'll also be inconsistent in places, as some stuff haven't been updated
    Some scripts are also in need of refactoring, as they will try to call outdated (and non-existant) code

    Known issues:
    Crashes the client randomly, seems to be more likely to happen if you run intensive tasks that
    involves sending a lot of packets for prolonged periods
    The cavebot's attack will sometimes not attack properly, seems to be a client bug, fixed by running a script

    Would not have been possible without TibiaAPI, I learned a great deal from it
    Also kudos to klusbert, DarkstaR, Jo3Bingham, Blequi, Farsa, beziak and possibly others
    Should be noted that it's designed for a 7.72 OT server with 7.4 item IDs, but it should be easy enough to port to newer versions

    https://dl.dropboxusercontent.com/u/...rce%20code.zip
    http://austria.christofferforsberg.se/source%20code.zip

    github repo: https://github.com/crilleforsberg/bot
    Last edited by Blaster_89; 06-28-2013 at 02:08 PM. Reason: Added github repo

  2. #2
    Senior Member
    Join Date
    Oct 2010
    Posts
    146
    wow, thx for sharing Blaster

    P.S. why don't you upload it to a repository like Github, Googlecode, etc? It would be easier to get it, and would live longer I suppose

  3. #3
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Thanks for this release, Blaster. It's interesting to me to see how you have structured it considering I am also using C# for JAPI, and yours looks a lot better organised :P

  4. #4
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    it contains a lot of code, if it isn't complete, I think it is almost there.

    Since my beginning I saw some snippets you posted over the whole tpforums and since there I had curiosity about how you code due your OOP style of coding. Now I'm killing it definitely .

    I agree with Puterin, some code repo would be easier to browse code even if HD storage isn't a problem nowadays.

    btw, good job and for sure it will be a good and reachable reference from now on for the whole community.

  5. #5
    Beziak's caller does not use any thread sync which is 99% what is causing your crashes, if you ever feel like fixing that. I wont lie, it will be a hard fix to accomplish remotely (without injection).

    All in all, it looks good. The coding style is something that is definitely a good example. I feel like its much cleaner than a lot of open source software, including TUGBot haha.

  6. #6
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191
    Updated first post with link to a github repo
    Glad you like it

    Quote Originally Posted by DarkstaR View Post
    Beziak's caller does not use any thread sync which is 99% what is causing your crashes, if you ever feel like fixing that. I wont lie, it will be a hard fix to accomplish remotely (without injection).
    Yes, that's what I thought after doing some searching
    I ended up just writing a script to restart the client and load scripts if it happened

  7. #7
    Quote Originally Posted by Blaster_89 View Post
    Updated first post with link to a github repo
    Glad you like it



    Yes, that's what I thought after doing some searching
    I ended up just writing a script to restart the client and load scripts if it happened

    You can do a freeze of the main client thread, yielding to the thread that Beziaks caller executes. The problem is that a function you call might be using the same memory as the client at the same time, causing problems. There's a few good ways to do this:


    Method 1:
    • Allocate some memory
    • Make a codecave that looks something like this:
      1: MOV eax, DWORD PTR:[someAddressYouAllocated]
      CMP eax, eax
      JNZ 1
      JMP peekMessageAddress
    • Stick that codecave in place of the main peekMessage call in Tibia. The goal is to keep busy until [someAddressYouAllocated] has a value of 0, then return execution to peekMessage
    • When Beziaks caller creates a codecave, it should set [someAddressYouAllocated] to 1 (This should be done before creating the thread, to allow Tibia time to hit the wait, since there's no reasonable way to ensure it does).
    • When Beziaks caller completes, it should set it to 0. This should be done from the codecave to ensure speed.

    Method 2:
    • Freeze every thread in Tibia
    • Make a backup copy of the memory related to the functions
    • Execute
    • Put old memory back in place
    • Unfreeze threads


    Method 1 will probably be faster from a completely external standpoint, but will freeze Tibia if the code cave doesn't fully complete. I don't think it will be noticeably slower, either.
    Method 2 is what I use in TibiaSock, but will be considerably slower when done externally because there's so much overhead between the processes and threads.

  8. #8
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by negern View Post
    I've compiled it for those who doesn't know how to start it.

    *removed*
    Call me sceptical but this is your first post on the forums and you're trying to get people to download a precompiled binary... What on earth makes you think anyone here would be willing to download that?
    Last edited by Stiju; 07-18-2013 at 01:16 PM.

  9. #9
    Senior Member
    Join Date
    Feb 2013
    Posts
    187
    anyone can help me change to work with custom clients?

  10. #10
    Junior Member
    Join Date
    Dec 2013
    Posts
    9
    Very neat code, thank you

Posting Permissions

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