Making the dragonflyff source work for you

Joined
Sep 9, 2008
Messages
1,947
Reaction score
390
I know some of you are having trouble getting the source to work so let me make some suggestions on how to get it to work for you.

The files are coded in C++ which a lot of you know. Now, some of you think you need Visual C++. You don't, there are a number of other compilers out there that will work as well as VS. Also you can edit the files directly in notepad, but I don't recommend Word or wordpad as these add unnecessary formatting characters. I will leave it up to you to decide.

Now here is where you go to change the IP address and the database files.

In the login server files, open the MySQLM.cpp file and change the following:

Code:
MYSQL MySQL:[COLOR=Red][I]:maple_db;[/I][/COLOR]

long lastaccess;

int MySQL::connectToMySQL(){
    setLastAccess(GetTickCount());
    if(!mysql_real_connect(&maple_db,[COLOR=Red] "localhost", "root", "pass", "flyff"[/COLOR], 3306, NULL, 0)){
        Log(MSG_ERROR,(char*)(mysql_error(&maple_db)));
        printf("\n");
        return 0;
    }
    return 1;
}

You may edit the red italicized words. But be warned. If you change maple_db. You will need to change all of the instances of it throughout the file or it will not compile.

the rest of the red words are editied to your liking they are in this order: "server location", "user", "pass", "db name". After that there is no need to change anything else. Plus you won't need to change this file in the gameserver because its a shared file.

Next we will look at how to change the starting items for a created character.

Open the Characters.cpp file and edit the following:
Code:
void Characters::createEquip(int owner, int gender){
    char query[1024]; 
    if(gender) {
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(504, %d, 44, 2,9000000,1);", owner);
        MySQL::insert(query);
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(508, %d, 46, 4,5850000,1);", owner);
        MySQL::insert(query);
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(512, %d, 47, 5,4500000,1);", owner);
        MySQL::insert(query);
    } else {
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(502, %d, 44, 2,9000000,1);", owner);
        MySQL::insert(query);
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(506, %d, 46, 4,5850000,1);", owner);
        MySQL::insert(query);
        sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(510, %d, 47, 5,4500000,1);", owner);
        MySQL::insert(query);
    } 

    sprintf_s(query, 255, "insert into equips(equipid,owner,slot,type,durability,equipped) values(21, %d, 52, 10,7200000,1);", owner);
    MySQL::insert(query);
}

As you can see this function adds the equipment to the character based on the gender and then adds a weapon. Change this to whatever you like.

That is all needed to be done to the login/charserver.

Next time we will look at the Gameserver which is where you will spend most of your time.


===============================
Update 11/20/2008
===============================

OK I am getting tired of people asking the same problem for the compile error for the config.h file. Here is the answer to all your problems.

Open your Server.cpp and search for this function
Code:
connectToWorldServer

change whatever it is to this
Code:
connectToWorldServer("127.0.0.1",23000)

Next look for this
Code:
sendWorldServerAuth

and change it to this:
Code:
sendWorldServerAuth("DragonFlyff")

The problem is the conversion of a string to a char array. I never got around to getting a converter to do it so just leave it out. Everything else should be in order.

And make a backup of your file before you edit the file first.
 
Last edited:
Yeees glaphan you are the best, but it's is possible to change the default equip in database or in a file.

Like it we can change it when we want, we can add item for event for exemple. It could be a good solution i think
 
Yeees glaphan you are the best, but it's is possible tu change do default equip in database or in a file.

Like it we can change it when we want, we can add item for event for exemple. It could be a good solution i think

Yes, it is possible.
Maybe using a .txt file and fopen, reading each line as a item and make something unique to separate each part, make a FOR to run into all lines and into each line, getting all the parameters needed to make the insert into database.
 
yes i know it must use

int readding_file()
{
// le constructeur de ifstream permet d'ouvrir un fichier en lecture
std::ifstream fichier( "config.ini" );

if ( fichier ) // ce test
 
not good idea it's for read database log lol.

You will have a problem for this, the best it's read the config.ini with source. with the command adapt for the appli
 
@Glaphan What do you mean by Server Location, do you mean like localhost or can it be your WAN-IP/ NO-IP? Also the MySQLM File is Located in the /Common/Database/MySQLM.cpp directory.
 
I am a newb to server development, and I am not a leecher (hopefully :P), I am an aspiring C++ programmer. I can look through functions and guess what they do, but if the work isn't my own I usually get lost on the details. I am also not that good at decrypting error messages :P

When I try to compile LoginServer, I get an error :

Unhandled exception at 0x1000a260 in LoginServer.exe: 0xC0000005: Access violation reading location 0x00000000.

Can you please explain why? O_O
 
Back