Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server > Flyff PServer Guides & Releases
You last visited: Today at 06:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Release DragonFlyFF Server Source

Discussion on Release DragonFlyFF Server Source within the Flyff PServer Guides & Releases forum part of the Flyff Private Server category.

Closed Thread
 
Old   #1
 
elite*gold: 80
Join Date: Nov 2007
Posts: 656
Received Thanks: 107
Release: DragonFlyFF Server Source [UPDATE Fixes & How to Work Server]

Quote:
Originally Posted by GlaphanKing
You can now see the source of the dragonflyff server. There are a few things to remember before you start claiming this as your own.

  1. I am the original creator of dragonflyff server.
  2. Original shell work goes to Kiki
  3. Show some respect by not stealing this as your own.
  4. Let's start acting like a developing community
  5. If you use this source to make a server for yourself, you will put my name as the original creator.
  6. I am as serious as the days are long, if I see or hear of people stealing my hard work and passing it off as their own, I will not hesitate to put the hammer down and remove any and all remnants from the forum. It is my work and I can have the work banned. Your choice.
  7. You must release any milestones or additions to the community uncompiled. you may add errors if you wish but that is my rule.

Can everyone follow that? Good. Let's keep it clean and people for god's sake lets get a server up and running. I mean we gotta be the last popular MMO w/o a pserver (excluding fame of course).


Source
=================



Thank you and you are welcome. This is no joke and not a leak, this is the real deal. I am still continuing my work.
From ********

Wie bekomm ich den server zum Laufen ?

Quote:
Originally Posted by GlaphanKing
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.
Ein Paar Fixes

Quote:
Originally Posted by BBim
//Salvar inventario
//Senha 3 tentativas
//nao permitir login se jah esta logado
Here I will post somethings to this source file:
Use them as a learn to keep on developing it.
__________________________________________________ _____________________________________________
Contents:
"Fixing" the mp, hp and fp recovery(it runs once in a second);
Giving Skill Points when level Up;
Ban command;
Saving on logout;
UPDATE #1 First step into fixing memory leaks problem;
UPDATE #2 Error "This id has been blocked" instead of "Your time is up";
UPDATE #2 Not crashing client when GameServer isnt online;
UPDATE #2 Login Error IDs;
UPDATE #3 Changing exes place;

__________________________________________________ _____________________________________________
"Fixing" the mp, hp and fp recovery(it runs once in a second):
go into Player.h, put this after "public:" inside "class Player: public Mover, public AbstractPlayer {":
Code:
unsigned long getLastCheck(){
		return lastRecovery;
	}
	void setLastCheck(unsigned long value){
		lastRecovery = value;
	}
those functions will take when it was recovered and the other one sets a new time when it recovery again

now, inside the same class, but in "private:" add this:
Code:
unsigned long lastRecovery;
this is to store the time when it last recovered.

now, at WorldThread.cpp, in "checkStats" function, add this as the first line:
Code:
player->setLastCheck(GetTickCount());
this will update the last check each time it recoverys.

then, inside PlayerThread function, find "checkStats(thisplayer);" and put:
Code:
if (GetTickCount() - thisplayer->getLastCheck() > 2000)
before it, this code will garante to just run the functions each 2000 miliseconds(2 seconds).


END OF SECTION
__________________________________________________ _____________________________________________

Giving Skill Points when level Up:
go into Levels.cpp, into the giveExp function, add this
Code:
int player_level = player->getLevel();
			int skp = player->getSp();
			if (player_level <= 20)
				skp += 2;
			else if (player_level <= 40)
				skp += 3;
			else if (player_level <= 60)
				skp += 4;
			else if (player_level <= 80)
				skp += 5;
			else if (player_level <= 100)
				skp += 6;
			else if (player_level <= 120)
				skp += 7;
			player->setSp(skp);
after "player->setFp(player->getMaxFp(),true);"
it takes the player level(see it is after the setLevel, so it will get the new level of the player), then get the current SkillPoints, then checks for the player level until it find the level and add the proper sp for it level, then set it to the player.
note: you will have skillpoints but wont be able to distribute since the packet to it wasnt made yet.


END OF SECTION
__________________________________________________ _____________________________________________

Ban command:
at Players.cpp, find chatProcessor function, find the last "else if" and it last "}", after it, insert this:
Code:
else if(_stricmp(command, "ban") == 0){ //check if it is the ban command
			char* who = strtok_s(NULL, " ",&next_token); //take the next part just after the space after the ban word, wich is the player name
			Player* who2 = getPlayerByName(who); //take the player by player name
			int acc_id; 
			if (who2 != NULL) //if who2 is different of NULL, the player is online
			{
				who2->setAccessLevel(0); //sets it accesslevel ingame to 0
				acc_id = who2->getOwner(); //takes the account id of that char
				MySQL::setInt("accounts", "accesslvl", acc_id, 0); //update the accounts table changing its accesslevel to 0
			}
			else
			{
				char * sAcc_id = new char[]; //variable to store the account id from the characters table
				MySQL::getString("characters", "name", who, "owner", sAcc_id); //takes the account id
				acc_id = strval(sAcc_id); //take account id as integer
				MySQL::setInt("accounts", "accesslvl", acc_id, 0); //update the accounts table changing its accesslevel to 0
				delete[] sAcc_id; //delete sAcc_id from the memory(if you dont do, nobody will do for you in this case)
			}
			return true; //dont let !ban <player name> appears at the screen
		}

END OF SECTION
__________________________________________________ _____________________________________________

Saving on logout:
inside MySQLM.cpp, find the setInt function, after it, add this:
Code:
void MySQL::setInt64(char* table, char* wht, int id, __int64 value){
	setLastAccess(GetTickCount());
	char query[255]; 
    sprintf_s(query, 255, "update %s set %s='%u' where ID='%d';", table, wht, value, id);
	mysql_real_query(&maple_db, query, strlen(query));
}

void MySQL::setFloat(char* table, char* wht, int id, float value){
	setLastAccess(GetTickCount());
	char query[255]; 
    sprintf_s(query, 255, "update %s set %s='%f' where ID='%d';", table, wht, value, id);
	mysql_real_query(&maple_db, query, strlen(query));
}
this is some code to put at the database floats and int64 values.

now, go to MySQLM.h and after the setInt declaration, put this:
Code:
static void setInt64(char* table, char* wht, int id, __int64 value);
	static void setFloat(char* table, char* wht, int id, float value);
I dont know why and glaphan didnt answer but, the save function is declared as static, change it:
go to Player.h, find
Code:
static void save();
change to
Code:
void save();
now, at WorldThread.cpp, find
Code:
Player::save();
change to
Code:
thisplayer->save();
finally, go to Player.cpp and find the save function, put this inside:
Code:
setLastSave(GetTickCount());
	MySQL::setInt("characters", "penya", getServerId(), inv->getPenya());
	MySQL::setInt("characters", "haircolor", getServerId(), getHairColor());
	MySQL::setInt("characters", "hair", getServerId(), getHair());
	MySQL::setInt("characters", "face", getServerId(), getFace());
	MySQL::setInt("characters", "gender", getServerId(), getGender());
	MySQL::setInt("characters", "class", getServerId(), getJob());
	MySQL::setInt64("characters", "exp", getServerId(), getExp());
	MySQL::setInt("characters", "mp", getServerId(), getMP());
	MySQL::setInt("characters", "fp", getServerId(), getFP());
	MySQL::setInt("characters", "hp", getServerId(), getHp());
	MySQL::setInt("characters", "level", getServerId(), getLevel());
	MySQL::setInt("characters", "sta", getServerId(), getSta());
	MySQL::setInt("characters", "intt", getServerId(), getIntt());
	MySQL::setInt("characters", "dex", getServerId(), getDex());
	MySQL::setInt("characters", "str", getServerId(), getStr());
	MySQL::setFloat("characters", "posx", getServerId(), getPos(true).x);
	MySQL::setFloat("characters", "posy", getServerId(), getPos(true).y);
	MySQL::setFloat("characters", "posz", getServerId(), getPos(true).z);
	MySQL::setInt("characters", "ap", getServerId(), getAp());
	MySQL::setInt("characters", "sp", getServerId(), getSp());
this will get the values and update into the database.
Note: this is not saving inventory yet, I got some problems on making it and Im trying to figure it out.
Also, you can take the first tip on this guide(The fixing mp, fp and hp thing) and put it to save from time to time, but I think you can figure it out ;]

__________________________________________________ _____________________________________________
First step into fixing memory leaks problem
There is a problem that when you use, for example: "int x = new int;", you must do when you finish using it "delete x;", that happens because using the "new" keyword, it will create a space into the memory and unless you "delete" it, it wont get out of there(maybe when closing the program it does, I dont know). There is, for example at MySQLM.cpp, at the function that gets the items, it uses Equip* equip = new Equip(); inside a while statement. Lets say each Equip variable uses 13 bytes of memory...its not that much, but wait up. Since its inside a while statement that goes into all inventory slots, there can be a max of 74(I think its 74) items, making it take 962 bytes for each players that logins with a inventory full of equips. So, its almost 1kb for each player. But, its still not THAT much. Now, take a look at how many "new"'s dont have a "delete", it may get your memory full of crap and get it out of space.
Now that you now the theory, try to fix it search for each "new" and see if it have a delete.
One tip to make your look for "new"'s easier:
Google for "notepad++", install and run it, open all files at once inside it, ctrl+f(search box will appear), then right "new"(without quotes) and click search all opened files. Or you can use ctrl+f inside visual C++.
P.S.: If you dont know what you are doing, dont put any delete at your source.

__________________________________________________ _____________________________________________

Error "This id has been blocked" instead of "Your time is up":
When someone account is banned and he tryes to login, he gets a "Your time is up" message instead of "This id has been blocked", its a packet error(sending the wrong error ID).
To fix it, go to your login_server, go to login.cpp at loginUser function, find
Code:
case 2:		LoginPacket::loginError(player, 0x80); break;
change the 0x80 to 0x77.

__________________________________________________ _____________________________________________
Not crashing client when GameServer isnt online:
This happens because even if there is no game server, it tryes to connect to it, making client crash if there isnt any game server. Lets add a check and a message for the user:
into your loginServer, go to LoginPacket.cpp, find the showWorld function, at the end, there is:
Code:
packet.packetSendLogin(player);
change it to
Code:
if (worlds.size() != 0)
		packet.packetSendLogin(player);
	else
		LoginPacket::loginError(player, 0x88);
see about the login errors IDs at next section and change 0x88 to the error you want to be displayed.

__________________________________________________ _____________________________________________
Login Error IDs:
I tested all numbers between 100 and 255, didnt tested any before 100 so I dont know if there is any other error message.

__________________________________________________ _____________________________________________
Changing exes place:
Open your sources folder, make a new folder called exe, copy your config file inside. Now open gameServer and loginServer. At yhe left side of the screen you will see "solution explorer", if you dont see look for it at the view menu(or press ctrl+alt+L), right click GameServer and then left click properties. Into configurations properties, click in "general" and find Output directory, change it value to "$(SolutionDir)\exe"(without quotes). Make this for both loginServer and gameServer. Now go to Build > build solution.
__________________________________________________ _____________________________________________
UPDATES
UPDATE #1: 13/11/2008(dd/mm/YYYY)
Added "fixing memory leaks problem"
UPDATE #2: 15/11/2008(dd/mm/YYYY)
Added "Correcting client error message", not crashing when no GameServer is running and Login Error IDs
UPDATE #3: 15/11/2008(dd/mm/YYYY)
How to get yours exe
__________________________________________________ _____________________________________________
Thats a good start for everyone, lets get it to 100%!
I tryied to made it clear, I wish you guys got it.
Credits: The source credits is at it pages, go to it at the begining of the post, this guide and its content is credit to me
Ich werde Öfters Updates Machen
d0xs is offline  
Thanks
15 Users
Old 11/11/2008, 19:07   #2
 
elite*gold: 0
Join Date: Aug 2008
Posts: 476
Received Thanks: 113
Danke fürs posten!

EDIT:

Quote:
Originally Posted by karl511 View Post
well i think its fine for them to release this source file in the release section since..they release something that we can start to if you cant really understand how to code..or to fix simple problem then you should not be messing with the files..but if you attempt to try and learn from it..then just ask for help..

to make the gameserver compilable just try this

Code:
worldServerSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if(worldServerSock!=INVALID_SOCKET){
		//char serverip[50];
		//config.readInto(serverip, "ip");
		if(connectToWorldServer("127.0.0.1",23000)){
			//char servername[50];
			//config.readInto(servername, "servername");
			sendWorldServerAuth("Lionheart");
			fd_set fds;
it means try to make things hardcoded first..well sooner or later if you know how to fix this problem then get back to this

btw vote4sticky
Darkdevil1 is offline  
Old 11/11/2008, 20:00   #3
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
vote4sticky
cstyler is offline  
Old 11/11/2008, 20:02   #4
 
rolloaden's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 145
Received Thanks: 2
was ist das wenn ich fragen darf ^^ sry bin noob
rolloaden is offline  
Old 11/11/2008, 20:09   #5
 
elite*gold: 0
Join Date: Aug 2008
Posts: 476
Received Thanks: 113
Quote:
Originally Posted by rolloaden View Post
was ist das wenn ich fragen darf ^^ sry bin noob
Das ist ein Source Code eines Servers... Kannst du dran rumcoden und (eigene) Files bauen.
Allerdings, wenn du die files verwendest, solltest du schon GlaphanKing's Namen bzw den projektnamen erwähnen.. auf der HP oder im Server selbst xD
Darkdevil1 is offline  
Thanks
1 User
Old 11/11/2008, 20:17   #6
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
sourccodes für eigene serverfiles
cstyler is offline  
Old 11/11/2008, 20:41   #7
 
nono101's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 526
Received Thanks: 86
Guter Source Habe mal etwas Rumgetüfftelt damit :P
nono101 is offline  
Old 11/11/2008, 20:43   #8
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
Quote:
Originally Posted by nono101 View Post
Guter Source Habe mal etwas Rumgetüfftelt damit :P
hast du die auch zum laufen bekommen?
cstyler is offline  
Old 11/11/2008, 23:21   #9
 
elite*gold: 0
Join Date: Oct 2008
Posts: 212
Received Thanks: 21
Ist doch nicht schwer die zum laufen zu kriegen :> Und wenn du es nicht hinbekommst dann GIDF ^^

greetings,
Darkslayi
Darkslayii is offline  
Old 11/11/2008, 23:33   #10
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
ne habe die zum laufen bekommen, wollte nur fragen ob du es auch hast^^
cstyler is offline  
Old 11/12/2008, 07:25   #11
 
nono101's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 526
Received Thanks: 86
Habe ich auch Hinbekommen Azria wäre auch möglich nur Muss man dann viel im Source ändern
nono101 is offline  
Old 11/12/2008, 07:55   #12
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
schick mir ma deine nummer per pm(icq)
cstyler is offline  
Old 11/12/2008, 14:17   #13
 
elite*gold: 0
Join Date: Aug 2008
Posts: 476
Received Thanks: 113
ihr könnt hier auch Snippets (Codeschnippsel) zum Server posten, wenn ihr wollt.
ich habs geschafft, einzubauen, dass man per command die EXP Rate verändern kann.
Darkdevil1 is offline  
Old 11/12/2008, 14:22   #14
 
elite*gold: -1500
Join Date: Mar 2008
Posts: 496
Received Thanks: 167
lol?egal zeig ma
cstyler is offline  
Old 11/12/2008, 14:40   #15
 
elite*gold: 0
Join Date: Aug 2008
Posts: 476
Received Thanks: 113
Quote:
Originally Posted by cstyler View Post
lol?egal zeig ma
editiert XD

naja , ich kann so gesehen die Sprache C++ nicht, aber ich schaffs trotzdem, da was funzend verändern
Darkdevil1 is offline  
Closed Thread


Similar Threads Similar Threads
[Release] Server Pack!! 14 Source !!
09/22/2009 - CO2 PServer Guides & Releases - 32 Replies
This is all Source Have in my computer, osrry for my bad english (I speak french) -Tcwnn Source -Steals Server Pack -ShadowCo Source -PrownageCo Source -PowerSource Co -Megamax Source Co -Loft Source
[Release] Account Server Source
06/19/2009 - CO2 PServer Guides & Releases - 30 Replies
Hello Guy's I'm Releasing As i said a Source for The Account Server and the price is if u could run it up or fix it please post here .... this is the price. Don't Forget to Press THANKS EDIT: Link Removed Sorry it wasn/t For CO
[Release]How To Make Tq Source Work + Working Source + Server ByBass + Commands
12/08/2008 - CO2 PServer Guides & Releases - 15 Replies
1: How To Make The Server Work In fact, before other people did not just let ACC now with hi EACC Columbia landing on the settlement of the issue, and the rest is our own how to improve the content of those interested can improve the next. MY MY set and the same. INI MAP INI files and MAP with the client-to-date coverage of the account. server.dat ! And then as long as the client will be able to modify server.dat! 127.0.0.1 192.168.0.1 192.168.1.1 IP。 Please do generally use...
DragonFlyff Prototype Server Release 0.01a
09/28/2008 - Flyff PServer Guides & Releases - 5 Replies
Es gibt neue Server fieles! Sie kommen nicht von mir aber ich wollte sie euch mal zeigen: In case anyone wants to know, I am going to release a taste of my server I am working on. Based off of Kiki's Server Code, I was able to make a stable server. This is how the Full Server is going. You will NOT see this now. ======== TO DO LIST ========= Psykeeper Float Spawn NPC and mobs in range



All times are GMT +2. The time now is 06:15.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.