1 Attachment(s)
[Share] Flyff Packet Information
Well, Although I dont want a source to be released, I also dont want to limit other developers - who like me may have trouble figuring out the packets... Took me a while to understand them too.
So I'll list here packet information as I figure it out, that way someone with enough coding knowledge can create a private server, and we still keep the private server numbers rather low.
I'm starting to day with the Login server, I'll post the Character server, and known packets of the world server tomorrow as I'm lazy... LOL
Key
4 Bytes - Integer, Hash
2 Bytes - Short
8 Bytes - Long
* - When I have a * before INT, it means the integer is little edianed. (http://en.wikipedia.org/wiki/Endianness#Little-endian), this is on server packets and client packets, if I use the * on a server packet, it means you need to make it little edian, if I use it on a client packet, it means its already little edian, so you gotta change it back to normal. Not sure if ALL intergers are like this, I dont think I've come across one that isnt yet, but I'll let you know in the future.
When I use "INT-Length" it means the length of the data following those 4 bytes (As an Integer).
When I use "##-Command" it means the as 4 bytes, ## being the command.
Comments made by me for extra info (like the one about capacitys on eFlyff) are bold, followed by italics.
Common Packets
First thing the server does after receiving a connection is it sends a session key.
Length: 13
Structure
Code:
[5E] [INT-Length] [00] [00] [00] [00] [00] [00] [00] [00]
The last for bytes can be changed to whatever you want, the session key is then used for creating hashes in future packets, thought I might also mention that this is the case for all the servers, (Login, Characters & World).
Login Server
Remember, after receiving a connection, the server sends the session key.
Login packet (Client -> Server)
Structure
Code:
[5E] [HASH-Length] [INT-Length] [HASH-Data] [INT-Data] [FC-Command] [INT-Length] [Date-Reversed] [*INT-Length] [Data-Note#1] [*INT-Length] [Username] [*INT-Length] [Password]
Note #1: I think its a hash of the flyff.a file, might be wrong though.
Incorrect Login (Server -> Client)
Length: 13
Structure
Code:
[5E] [INT-Length] [FE] [00] [00] [00] [Data-Note#2] [00] [00] [00]
Note #2: Its the type of incorrect login (Wrong password, wrong ID, Banned etc...)
Types
Code:
[27] - Opps try again.
[77] - This ID has been blocked
[78] - Wrong password
[79] - Wrong ID
[80] - Your time is up
[81] - Other DB Error
[83] - You cannot connect after 22:00
[84] - You cannot connect from outside the service for Flyff.
[85] - Your character is being checked at the moment. Please login after a while.
[86] - Wrong password, cannot log into account for 15 seconds.
[87] - Wrong password three times, cannot log into account for 15 minutes.
[88] - Server verification error.
[89] - Session is over. please try again.
[6D] - Service is currently unavailable, please check Flyff site for details.
[FF] - Connecting please wait...
[67] - This account is already connected. (Yes/No)
Correct Login (Server -> Client)
Ok so they logged in correctly, YAY lets send the server list.
Structure
Code:
[5E] [INT-Length] [FD-Command] [Note#3] [INT-Length] [Username] [0B] [00] [00] [00] [FF] [FF] [FF] [FF] [*INT-Server ID] [*INT-Length] [Server Name] [*INT-Length] [Server IP] [00] [00] [00] [00] [00] [00] [00] [00] [01] [00] [00] [00] [00] [00] [00] [00] [*INT-Cluster ID] [*INT-Channel ID] [*INT-Length] [Channel Name] [00] [00] [00] [00] [00] [00] [00] [00] [*INT-Online Players] [01] [00] [00] [00] [*INT- Channel Capacity]
Ok, after the first channel is finished, you can continue more channels, just repeat from INT-Cluster ID, once you've added all the channels to that cluster, you can repeat the next cluster & its channels by repeating the bytes, starting from [FF] [FF] [FF] [FF]
Note #3: I dont know what these 5 bytes are, never really looked into it, chances are its a hash of some sort of the following data, anyway eFlyff uses [FE] [CE] [84] [B0] [01] (and so do I, and it works :P)
Handy Info
Flyff channels can store 1100 players each (Maybe they're done that to optimize lag? Presuming they have the money for the best servers... they've limited it to that for a reason, where FlyForFame (havent checked exactly) have gone waaaay over 1100 (GM Notices boasting about 2k+) and its VERY laggy...
Also thought I'd mention, if you sit on the server selection screen doing nothing, client sends (roughly every minute) this packet:
Code:
[5E] [94] [A7] [D8] [58] [04] [00] [00] [00] [0B] [F0] [C1] [08] [14] [00] [00] [00]
I dont reply to it, and the client doesnt D/C, im unsure on what it does... eFlyff doesnt seem to reply to it either... Currently I'm using it to update the logged in timestamp, and if I dont receive activity from a client without 2 minutes, I close the connection (Presuming they closed, lagging/etc you know that annoying "Disconnected message" on eFlyff... it could also be used to send updated Players online data (for the (Normal) (Busy) (Full))...
Its totally up to you xD
Database
At this point, I (think) my database was structured like this (may be wrong cause I cant exactly go back in time :(.
Accounts
- ID
- Username
- Password
- Banned
- Last_IP
Clusters
- ID
- Name
- IP
Channels
- ID
- Cluster
- Name
- Capacity
----------------------------------------------------------------------------------------------------------------------------
Righteo, and to start the Character server, I'll see how far I get before I get bored of typing, also I'm not sure on the order of these packets, but then you shouldn't be coding your server to run in order anyway.
First things first, dont forget on connection to send the session key.
Authentication
I'm not going to explain Authentication, its alot of information and I'm to lazy to post it, check the other thread here about the Flyff Packet structure, it explains Authentication.
Server Select (Client -> Server)
After selecting a server, it then connects to the Character server, and authenticates. Character server packets are identified by the 17th byte.
Packet command: [F6]
This packet contains date, verification hash, username & password.
Your server should check this information is correct, and then send back the characters that belong to this person.
Character Display (Server -> Client)
Structure
Code:
[5E] [INT-Size] [F3] [00] [00] [00] [Data - Note #4] [00] [00] [00] [00] [*INT-Slot] [INT-Length] [INT-Map ID] [0B] [00] [00] [00] [*INT-Length] [Char-Name] [Float-X] [Float-Y] [Float-Z] [*Char-ID] [00] <- x 16 [*INT-HairStyle] [INT-HairColor] [*INT-Face] [INT-Gender (0/1)] [*INT-Job] [*INT-Level] [00] [00] [00] [00] [*INT-STR] [*INT-STA] [*INT-DEX] [*INT-INT] [00] [00] [00] [00] [INT-Note#5] [INT-Note#6] .....
From there you can repeat it again for the next char, if they have another char (Start again from the INT-Slot).
Once you've added all your chars...
Code:
[*INT-LastCharSlot] [*INT-Note#7]
Note #4: 4 Byte verification that you get from the authentication hash.
Note #5: This is an INT, of how many items the person has equiped (Only counting... helmet, suit, gaunlets, boots, cs helmet, cs boots, cs gaunlets, cs suit, cloak, weapon & shield/weapon 2.
Note #6: This is the ID's of each item, 1 after the other.
Note #7: Depending on how many chars there were you add this times char amount.
Code:
[*INT-Char #] [00] [00] [00] [00] [00]
Of course the first INT in that lot would either be the amount of chars loaded, so if you loaded slots 0 & 2, it would have 2 of that set of bytes, first being 0 second being 1.
... Hope thats helpful to someone, and that it makes some sense x_X I dont think I'll be posting anymore as its rather hard to change my code back into packets xD... but if I do I'll take you guys right up to the World spawn, cause that packet is insanely large and I dont want to explain it...
Good Luck ^_^
------------------------------------------------------------
Note
If you want to learn how to code a server, heres some stuff packages to look up in java: (These are the imports im currently using).
java.net.ServerSocket
java.net.Socket
java.util.Vector
java.util.Enumeration
java.io.*
- ByteArrayOutputStream
- OutputStream
- IOException
java.sql.*
java.util.zip.CRC32
Enjoy, and have fun coding ;)
P.S Sorry about my spelling & grammer, I know its not the greatest, but hopefully its readable :|
Edit: Attached is the document I used to figure out the structure of the Clusters list, got to the second cluster before I saw the pattern, someone might find it handy... maybe? Also - someone needs to add ".docx" to the valid uploads list x_X
*** UPDATED ***
Re: Flyff Packet Information
Reserved for more information - Not sure if theres a character limit in 1 post - Delete this if there isn't :)
Re: Flyff Packet Information
Woow.
Really helpfull if you don't know anything about it.
Re: Flyff Packet Information
AMG this is going to help me alot =D Thanks!
@avernikas
have you tough of making the server files in java and javascript and stuff?
Re: Flyff Packet Information
Re: Flyff Packet Information
Quote:
Originally Posted by
FilixXx
AMG this is going to help me alot =D Thanks!
@avernikas
have you tough of making the server files in java and javascript and stuff?
I already have... I'm up to the spawn packet for the world server, but its like 100k, maybe even 150k...
So I dont think I'll be figuring it out anytime soon x_X
Re: Flyff Packet Information
dude i sent you a PM its not nice to ignore.....I can help you.
Re: [Share] Flyff Packet Information
I've been looking for the server list packet structure for a while since I couldn't figure it to the fullest. Thank you.
I suggest you add a new column in accounts table in your database which determines if the user is online or offline, and if online, in which server and cluster.
Looking forward to the character server packet structures.
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
OverWaR
dude i sent you a PM its not nice to ignore.....I can help you.
I dont check my PM's very often, and I get so many I dont reply to alot of them... I'll look for yours soon.
Quote:
Originally Posted by
adidishen
I've been looking for the server list packet structure for a while since I couldn't figure it to the fullest. Thank you.
I suggest you add a new column in accounts table in your database which determines if the user is online or offline, and if online, in which server and cluster.
Looking forward to the character server packet structures.
I thought of that, but I decided not to, I create a new object for every client which stores all their information, including there status/cluster/channel, that way if the server crashes when its restarted the status is offline, my db only updates every 2-3 minutes with the information stored in the client objects.
Also makes it easier to disconnect that client.
--> Sorry guys Character server will be written tonight, might to half for today, its alot compared to the login, theres character display, add, delete, and the authentication T___T
Re: [Share] Flyff Packet Information
Might be helpfull to me soon. I plan on testing my luck on developing a flyff server when i have some time.
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
DaOdin
Might be helpfull to me soon. I plan on testing my luck on developing a flyff server when i have some time.
Welcome to the Flyff section.
Dev population, 4.
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
Organic
Welcome to the Flyff section.
Dev population, 4.
I always was here, I just don't post often like the maplestory section.
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
DaOdin
I always was here, I just don't post often like the maplestory section.
Ah. I've been waiting a while for this section.
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
Organic
Ah. I've been waiting a while for this section.
Same actually, the other thread at the general server files forums was getting too long for me to keep up. :/
Re: [Share] Flyff Packet Information
Quote:
Originally Posted by
DaOdin
Same actually, the other thread at the general server files forums was getting too long for me to keep up. :/
Ah.
Well if you need anything non-coding related help via Flyff info, just ring me up.