Coding

From Anarchy Online Wiki [AOWiki]

Anarchy Online Chat Protocol[edit]

Anarchy Online has its own chat protocol for communicating between the Chat Client and the Chat Servers. The game client has its own chat client for communication with the chat server and third party programs created to interact with the chat server or provide automated functions are called Bots

AO Chat Packet Types[edit]

Packet names are from a unofficial attempt at standardizing the names to make it easier for developers to work on other projects. The standardization for the packet names was discussed in a Thread on AODevs

Packet makeup[edit]

  • Short - packet type
  • Short - packet length in bytes
  • byte[] - packet data as laid out below

For example a ping packet with the string "ping" will come in as 64 06 00 04 70 69 6e 67

Bi-Directional Types - ToServer[edit]

  • 21: CharacterLookupRequest
    • String - Character Name
  • 30: PrivateMessage
    • int - Character ID
    • String - Message
    • String - ???
  • 40: FriendUpdate
    • int - Character ID
    • byte - Flags (0 means temporary, anything else means permanent)
  • 41: FriendRemove
    • int - Character ID
  • 50: PrivateChannelInvite
    • int - Character ID
  • 51: PrivateChannelKick
    • int - Character ID
  • 57: PrivateChannelMessage
    • int - Character ID
    • String - Message
    • String - ???
  • 60: ChannelUpdate (Used for muting channels, but is not used much anymore because it is not reliable)
    • byte[] - Channel ID (40bit)
    • String - Channel Name
    • int - Channel Status
  • 65: ChannelMessage
    • byte[] - Channel ID (40bit)
    • int - Character ID
    • String - Message
    • String - ???
  • 100: Ping
    • String - ???

Bi-Directional Types - ToClient[edit]

  • 21: CharacterLookupReply
    • int - Character ID
    • String - Character Name
  • 30: PrivateMessage
    • int - Character ID
    • String - Message
    • String - ???
  • 40: FriendUpdate
    • int - Character ID
    • bool - Online
    • byte - Flags (0 means temporary, anything else means permanent)
  • 41: FriendRemove
    • int - Character ID
  • 50: PrivateChannelInvite
    • int - Character ID
  • 51: PrivateChannelKick
    • int - Character ID
  • 57: PrivateChannelMessage
    • int - Character ID
  • 60: ChannelUpdate
    • byte[] - Channel ID (40bit)
    • String - Channel Name
    • int - Channel Status
  • 65: ChannelMessage
    • byte[] - Channel ID (40bit)
    • int - Character ID
    • String - Message
    • String - ???
  • 100: Ping
    • String - ???

To Client[edit]

  • 0: LoginSeed
    • String - Seed
  • 5: LoginOk
    • No data
  • 6: LoginError
    • String - Error Message
  • 7: CharacterList
    • int[] - Array of character ID's
    • String[] - Array of character Names
    • int[] - Array of character levels
    • int[] - Array of to determine if the character is already logged on
  • 10: CharacterUnknown
    • int - ???
  • 20: CharacterUpdate
    • int - Character ID
    • String - Character Name
  • 34: VicinityMessage
    • int - Character ID
    • String - Message
    • String - ???
  • 35: BroadcastMessage
    • String - Source
    • String - Message
    • String - ???
  • 36: SimpleSystemMessage
    • String - Message
  • 37: SystemMessage
    • int - Client ID
    • int - Window ID
    • int - Message ID
    • String - Message
  • 55: PrivateChannelCharacterJoin
    • int - Character ID (of the channel)
    • int - Character ID
  • 56: PrivateChannelCharacterLeave
    • int - Character ID (of the channel)
    • int - Character ID
  • 61: ChannelLeave
    • byte[] - Channel ID (40bit)

To Server[edit]

  • 2: LoginRequest
    • int - Version
    • String - Account Name
    • String - Key
  • 3: LoginSelect
    • int - Character ID
  • 52: PrivateChannelAccept
    • int - Character ID (of the channel)
  • 53: PrivateChannelLeave
    • int - Character ID (of the channel)
  • 54: PrivateChannelKickAll
    • No data
  • 120: ChatCommand
    • String - Command

Logging in[edit]

Authentication[edit]

Login Sequence[edit]

  • Client connects to the loggin server
  • Server sends the client a login seed (packet 0)
  • Client will then use the seed to generate a login key and then sends a login request (packet 2)
  • Sever will then send a character list (packet 7) or loggin error (packet 6)
  • Client sends a login select packet (packet 3)
  • Server will then send a login ok (packet 5) or loggin error (packet 6)

At this point the client is logged into the server and will start receiving packets and be able to send packets across the server.

Post Login[edit]

After logging in the client will receive packets in no particular order to initialize the channels it has access to, and the friends list.

These packets can include the following.

  • BroadcastMessagePacket[35] to display the welcome message such as "Welcome to AnarchyOnline"
  • ChannelUpdatePacket[60] to notify of the existence of a channel and its status
  • CharacterUpdatePacket[20] to give the client a Name/ID pair for friends
  • FriendUpdatePacket[40] to notify if a friend is currently online or offline