collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: AOChat 1.19 Fix  (Read 10044 times)

0 Members and 1 Guest are viewing this topic.

Offline Neo-Vortex

  • BeBot Rookie
  • *
  • Posts: 11
  • Karma: +0/-0
AOChat 1.19 Fix
« on: October 25, 2006, 11:32:04 am »
Basicly if the charid of a user is over 2^31, AOChat refuses to see that user, this affects all AOChat based bots (perhaps others), a fix is available at http://aodevs.com/index.php/topic,49.msg244.html, it also contains a far more detailed description of the problem and how it was fixed.

Note, it seems the version of AOChat bundeled with bebot formats tower attack messages differently than the latest version on auno.org (which that patch is based off).

Code: [Select]
      if (preg_match("/^([a-zA-Z0-9]+) \((.+), (Clan|Neutral|Omni)\) attacked (.+) \((Clan|Neutral|Omni)\) in (.+) at ([0-9]+), ([0-9]+).$/i", $msg, $info))
      {
        $off_player = $info[1];
        $off_side = ucfirst(strtolower($info[3]));
        $off_guild = $info[2];
        $def_guild = $info[4];
        $def_side = ucfirst(strtolower($info[5]));
        $zone = $info[6];
        $x_coords = $info[7];
        $y_coords = $info[8];
        $attack = true;
      }

That code is what i use with that version in TowerAttack.php fine.

Also it seems that it returns false not "disconnected" for wait_for_packet(), thus that needs to be fixed in main.php or the bot wont reconnect if it gets disconnected.

Code: [Select]
while(true)
{
        if ($aoc -> wait_for_packet() == false)
                $bot -> reconnect();

        $bot -> cron();
}

Is what i use to fix this issue.

(Note, i used a slightly older version of bebot than the current 0.2.x release, so code given may have to be modified slightly in order to work, if someone is able to verify that it works fine on the latest version, that would be cool).

Edit: Added attachments for both diff and full AOChat.php for lazy people (with the small fix for invalid characters)
« Last Edit: November 01, 2006, 01:43:51 pm by Neo-Vortex »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #1 on: October 25, 2006, 01:33:44 pm »
I've never been quite been sure which version of AOChat to use, I think mine is something Xenixa distributed based on 1.17.  As I use php 4 here for org bot (bebot 0.2.x from around December last year but customised quite a bit).  I'm not sure if I should update while things work fine in case the bot breaks.  php 5 is used fine for our raidbot - which is based on bebot 0.2.9.  Several of Xenixa's fixes for guests etc stopped me updating the org bot to bebot 0.2.9, I guess I'll update when 0.3.x is finalised.

On the second issue, will this fix the bot hitting desktop instead of restarting when !restart is used?  That would be good if so :-)  That issue only came up in recent Bebot versions (again, org bot works fine on !restart, raid bot doesn't).

Cheers for letting everyone know anyway!

-jj-

Offline Neo-Vortex

  • BeBot Rookie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #2 on: October 25, 2006, 01:54:06 pm »
As I use php 4 here for org bot

The patch does not work with php4, if you see the thread on aodevs there is a unified diff for the patch also, with any luck someone will port it to the 1.17 version of aochat, so keep an eye on that (unless you're feeling adventurous yourself)

On the second issue, will this fix the bot hitting desktop instead of restarting when !restart is used?  That would be good if so :-)  That issue only came up in recent Bebot versions (again, org bot works fine on !restart, raid bot doesn't).

No, that error would be within start.php somewhere - you are running start.php right :P?

Edit: That said, it might not be much of a problem now, but keep in mind if you're on Atlantean then any newly created toon from about 2-3 weeks ago onwards will be 100% invisible (see other post for more info) so it'll probobly get a tad more pressing... If you can upgrade to PHP5 it should be relatively easy to apply the fix and make the couple of required changes to make the towerattack and auto recon work properly, reguardless of bebot version used.
« Last Edit: October 25, 2006, 01:56:46 pm by Neo-Vortex »

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #3 on: October 25, 2006, 01:58:53 pm »
No, that error would be within start.php somewhere - you are running start.php right :P?

Off hand, I can't check as I'm at work but everthing else works fine, so I'm sure the right file is in use (it is started from batch file) :-P

Grrr on php 5 requirement, looks like I'll have to test update to bebot 0.3 on orgbot then as I don't fancy rechanging all modules to have to change them again soon for final release :-)

Edit on your edit:  Yeah, I understand, I just need to double check what is gonna be broken by PHP5/Bebot 0.2.9 if I did that.  I know last time I tried to upgrade, it wiped my guestlist, a lot of stuff I use is based on Xenixa's modules which involved changed to bot.php etc :-)  Plus this !restart thing is major pain in the ass :-P

-jj-
« Last Edit: October 25, 2006, 02:03:28 pm by jjones666 »

Offline Neo-Vortex

  • BeBot Rookie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #4 on: October 25, 2006, 02:05:14 pm »
Grrr on php 5 requirement, looks like I'll have to test update to bebot 0.3 on orgbot then as I don't fancy rechanging all modules to have to change them again soon for final release :-)

Edit on your edit:  Yeah, I understand, I just need to double check what is gonna be broken by PHP5/Bebot 0.2.9 if I did that.  I know last time I tried to upgrade, it wiped my guestlist, a lot of stuff I use is based on Xenixa's modules which involved changed to bot.php etc :-)

Odd, my upgrade from php4 to php5 went completely seamlessly (i have some pretty heavy modifications on almost everything on my bot - heck, im running 3 bots using the same install ;P, 2 guild and one raid, shared alts and whoiscache, etc etc), best bet would be to backup the db before trying if thats happened in the past... that way if things happen, just revert the backup ;)

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #5 on: October 25, 2006, 02:15:50 pm »
Yeah, I think the main problem was the fixes Xen did to is_member etc, I guess I'd just have to look thru some old threads to find out exactly what was changed.  The guest list and autoinvite (guests only and not spamming members), is essential for me :-)  The problem wasn't with the database, it had actually deleted the buddies from the bot's contactlist :-)

-jj-

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #6 on: October 26, 2006, 02:29:19 am »
seems FC are having some problems with this on their website aswell - Not possible searching for the newest chars :)

Offline Neo-Vortex

  • BeBot Rookie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #7 on: October 26, 2006, 12:58:05 pm »
seems FC are having some problems with this on their website aswell - Not possible searching for the newest chars :)

Completely unrelated, just the people of RK lookup hasnt updated in a little while, Gimp69 for example is lookupable on it fine (and it is affected) as it was one of the earlier ones, also Wirent wasn't at first, but i believe now is on the lookup as well, so its very unlike this has anything to do with it (especially as it seems FC's website for the people of rk lookup dosen't use php)

Offline Lyledesol

  • BeBot Rookie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #8 on: October 26, 2006, 02:01:56 pm »
Tried to use the fixed 1.19 with 0.2.x and 0.3.x bots, no joy here :(

This is the ID for the AOChat.php im using... (works on php4 and 5 btw)
   * $Id: AOChat.php 78 2006-03-03 06:48:50Z shadowmaster $

Neo-Vortex's AOChat is an older version?
   * $Id: AOChat.php,v 1.19-NVX 2005/11/29 23:22:46 os Exp $


Any chance of posting individual changes so I can try and apply to mine?
« Last Edit: October 26, 2006, 02:05:59 pm by Lyledesol »

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #9 on: October 26, 2006, 06:39:31 pm »
Yeah, completely unrelated....

Error
exceptions.ValueError on Invalid integer value for charinstance in ""



They may not be using php, but they are using Integers...
« Last Edit: October 26, 2006, 06:43:17 pm by Nesi »

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: AOChat 1.19 Fix
« Reply #10 on: October 26, 2006, 07:11:27 pm »
but erm, the aochat protocol uses 32bit integers for character IDs.
they magically found a way to fit more into 4 bytes or am I completely misunderstanding the issue?
*scratches head*

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #11 on: October 26, 2006, 07:43:37 pm »
AOChat uses unsigned long afaik, it may convert it to float but assigning a float as an array key, which aoc does, does not yeild the intended results.
« Last Edit: October 26, 2006, 07:57:31 pm by Nesi »

Offline Neo-Vortex

  • BeBot Rookie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #12 on: October 27, 2006, 03:03:05 pm »
but erm, the aochat protocol uses 32bit integers for character IDs.

AOChat uses unsigned long afaik, it may convert it to float but assigning a float as an array key, which aoc does, does not yeild the intended results.

It is 32bit intgers, yes, however AOChat does not uses unsigned longs, that's C, AOChat uses php, php uses signed intgers, it is not possible to specify if it is signed or not, http://php.net/manual/en/language.types.integer.php explains it:

Quote
The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). PHP does not support unsigned integers.

So yeah, its equivilent of a signed long ;) (which on a 32bit machine is 32bit signed, same as php, whose range is (2^31-1) to -(2^31-1), go figure)
« Last Edit: October 29, 2006, 11:18:46 pm by Khalem »

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: AOChat 1.19 Fix
« Reply #13 on: October 27, 2006, 03:04:44 pm »
nesi explained it to me.
i forgot to take in account signed/unsigned.
it wasn't int32 but uint32

Offline Nesi

  • BeBot User
  • **
  • Posts: 55
  • Karma: +0/-0
Re: AOChat 1.19 Fix
« Reply #14 on: October 27, 2006, 03:45:33 pm »
Well the incomming and outgoing packets that AOChat handles have the id's in unsigned long. Problem comes when unpacking those in php, due to the reasons already stated.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 475
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal