AOChatProxy Problem

Questions, comments, suggestions, and bug reports
equi
Member
Posts: 45
Joined: Sun May 24, 2015 9:39 am
antispam: rimor

Re: AOChatProxy Problem

Postby equi » Sat Dec 17, 2016 2:40 am

I used the latest text.mdb from ao and looked into it, there is no instance id: 264474563 only 258810596, 264895893, 265276023 and there are a few empty strings (specially the last ones, EOFException) which will produce an error trying read it out by readString().
Guess if there is a problem, then it should be located here:

Code: Select all

            case 'l':
            {
               byte[] instanceBytes = new byte[4];
               dataInputStream.readFully(instanceBytes);
               long instanceId = Helper.bytesToLong(instanceBytes);
               long categoryId = 20000;
               params.add(MMDBParser.getMessage(categoryId, instanceId));
               break;
            }

is the instanceID maybe also encoded in b85 (5bytes) and not a normal int (4bytes)?
Just to ignore empty strings maybe catch eof directly...not sure why theyre in the db if theyre empty

Code: Select all

   private static String read_string(RandomAccessFile in) throws IOException {
      String message = "";
      char character;
      try{
         character = (char)in.readByte();
         while (character != 0) {
            message += character;
            //character = (char)in.read(); //-1 if eof, so only check (character>0)
            character = (char)in.readByte();
         }
         return message;
      }catch(EOFException e){
         //System.out.println("EOF");
         return message;
      }
   }

My code also only run smooth for processing params String if i substract -1, like i guess the "length" is in length included :D

Code: Select all

                case 's':
                    stringLength = dataInputStream.readUnsignedByte()-1;
                    buffer = new byte[stringLength];
                    //dataInputStream.readFully(buffer);
                    dataInputStream.read(buffer);
                    params.add(new String(buffer, ENCODING));           
                break;

I added a list with 20000 messages, maybe you will notice something that the message could be:

Code: Select all

Removing %d #1{ 1:buddy | buddies }.
%s has been added to your buddy-list.
You have no active petition with the GM or Advisor you are trying to contact.
To get in touch with an Advisor, please file a petition using /petition <message>.
Before you do, please check known issues and fixes at http://community.anarchy-online.com/
Could not send message to offline player: %s
Available /cc commands:
/cc help [command]
/cc addbuddy <player>
/cc rembuddy <player>
/cc rembuddy ?
%s was not in your buddy-list.
Your ability to talk out loud has been revoked temporarily with a GM gag.
Your ability to talk in private groups has been revoked temporarily with a GM gag.
Currect motd: "%s".
the receivers inbox is full
Illegal argument to help: %s
You can not add/remove yourself.
Client %d does not exist/is not online at the moment.
Your ability to send private messages has been revoked temporarily with a GM gag.
%s is offline, message has been buffered.
You need to add a player name after "/cc addbuddy" and "/cc rembuddy".
Your client is sending a high frequency of chat messages.
The last message you sent has been deleted by flood protection.
Please check your scripts if they include chat messages and remove any loops that might have cause this to happen.'
Offline message from %s (%s)
Motd has been set to "%s".
/cc motd is used to set and clear the message players see when they log in.
"/cc motd" - will show the current motd message.
"/cc motd clear" - will reset the message back to default.
"/cc motd <text>" - will set the message to "text".

You have reached the maximum number of friends (%d) you can have in the buddy list.
The gmdeaf command is used to enable disable a special "deaf" mode for gm's.
When a GM has the gmdeaf mode enabled, ha can only receive /tell messages
from other gm's or from people in his buddy-list. To ease the pain of
adding/removing players from the buddy-list, GM's can use the /cc addbuddy
and /cc rembuddy commands.
/cc gmdeaf - toggles the gmdeaf flags, it's default off.

Could not find any help for that command.
No player with name %s was found.

%s is already in your buddy-list.
Your ability to talk in public groups has been revoked temporarily with a GM gag.
This comand can be used to remove players from you friendslist.
/cc rembuddy <player> - will remove "player" from your list.
/cc rembuddy ? - will remove all unknown friends (those listed under the question-mark in the client)

%s has been removed from your buddy-list.
This comand is used to add other players to your friendslist.
/cc addbuddy <player> - will add "player" to the friendslist.
Current gag will time out in %d #1{ 1:minute | minutes }.
Could not find the player with id %d in the chatserver database.
The /cc [un]gag commands are used to gag players.
/cc gag <player> - Completely gags the player, he will still be able to hear, but he can't say anything.
/cc ungag <player> - Removes all gags from the player.
/cc gag <player> vicinity - The player will not be able to send vicinity chat.
/cc ungag <player> vicinity - Removes the vicinity gag.
/cc gag <player> groups - The player will not be able to send to any king of group chat.
/cc ungag <player> groups - Removes the groups gag.
/cc gag <player> tell - The player will not be able to use the /tell command.
/cc ungag <player> tell - Removes the tell gag.
/cc gag <player> timeout <minutes> - All the players gags will timeout after x minutes.
/cc gag <player> timeout 0 - Disables the timeout.
/cc gag <player> list - Shows what gags a player have.
/cc gag list - Shows a list of all gagged players.
Available /cc commands:
/cc help [command]
/cc gag ...
/cc ungag ...
/cc pinfo <player>
/cc gmdeaf
/cc addbuddy <player>
/cc rembuddy <player>
/cc rembuddy ?
/cc motd ...
Motd has been cleared.
Player %s (id: %d) is currently offline
Last known level: %d, and playfield: %d
the message is too big to fit in the inbox


Edit: If im not wrong, there is the last letter missing in ChannelMessage.java, second parameter in substring() isnt length its endindex. Noticed it while processing towermessages (last coordinate was wrong):

Code: Select all

   public ExtendedMessage getExtendedMessage() throws IOException {
      if (extendedMessage == null && charId.getLongData() == 0 && message.getStringData().startsWith("~&") && message.getStringData().endsWith("~")) {
         // remove leading ~& and trailing ~
         String parseMessage = message.getStringData();
         //this works for me
         parseMessage = parseMessage.substring(2, parseMessage.length() - 1);
         //parseMessage = parseMessage.substring(2, parseMessage.length() - 2);

         extendedMessage = new ExtendedMessage(new DataInputStream(new ByteArrayInputStream(parseMessage.getBytes("UTF-8"))));
      }
      return extendedMessage;
   }

Funny thing that im at the same position in coding for my bot xD Maybe if you fix this, the id will be correctly readout.
Tyrence
Posts: 1908
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Tue Dec 20, 2016 10:55 am

So yeah, they added a new message, but they never added it to the text.mdb file so when it comes across it can't find it in the text.mdb file and crashes. I don't know what the message is, I could never figure out what it was. But yes, the new version of the tyrlib class that reads from the text.mdb file won't crash when it can't find a message, it will just log it.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 1908
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Tue Dec 20, 2016 11:01 am

Intyl, try this copy and see if it works.
Attachments
tyrlib-1.6.jar.zip
(195.96 KiB) Downloaded 11 times
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
equi
Member
Posts: 45
Joined: Sun May 24, 2015 9:39 am
antispam: rimor

Re: AOChatProxy Problem

Postby equi » Tue Dec 20, 2016 9:22 pm

Maybe someone should write a peti and ask funcom for it^^ and also ask if they can remove the empty strings xD
The thing which i added as "edit" doesnt influence the problem since it has nothing to do with it but did you had a look at it, still seems wrong^^
Tyrence
Posts: 1908
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Wed Dec 21, 2016 9:07 am

As far as your edit goes, the start index removes the "~&" from the beginning of the string and the end index removes the "~" at the end. So I think it's correct how it is:

Code: Select all

//before: "~&teststring~"
parseMessage = parseMessage.substring(2, parseMessage.length() - 1);
//after: "teststring"


Admittedly, I haven't run the code, but it should be correct. In this case, "t" is at index 2, so that's where it starts. The length is 13, the last "~" is at index 12, so 13-1=12. However, the substring() method is not inclusive for the end index, so it's really 13-1-1=11. The "g" is at the 11 index.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
equi88
Member
Posts: 3
Joined: Wed Dec 21, 2016 10:37 am
antispam: rimor

Re: AOChatProxy Problem

Postby equi88 » Wed Dec 21, 2016 10:51 am

Hey, thats exactly what i meant^^
Sorry got some problem with the password on other pc so i created a new acc, by the way the antibot question abaout RK2 is a little bit outdated (had to google it to be sure :lol: ).

Code: Select all

         parseMessage = parseMessage.substring(2, parseMessage.length() - 1); //correct way
         parseMessage = parseMessage.substring(2, parseMessage.length() - 2); //your code

Your code has the commented version, thats what i wanted to point out. Your code doesnt throw an exception so i guess thats why you didnt notice it. But the bot will have problems finding the right towerspots since the last byte is missin and filled with 0x00 and always produces a smaller wrong number or shorter text. Sorry, my english is not the best and maybe my expression was a little bit confusing :lol:
Im not sure but i think budabot only uses the tower attack messages from the extmessages.
Tyrence
Posts: 1908
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Wed Dec 21, 2016 8:57 pm

Oh, in that case, it looks like that's a bug. I will update my code.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest