Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Adding New Option C++ Source Code + Full Tutorial [Updated & Fixed]

IGCN Co-Founder
Joined
Jun 26, 2006
Messages
303
Reaction score
487
Hi, i got boored and decided to release little source code of examples for adding new options in GameServer 1.00.16:
.CPP File
Code:
/* AddMU.cpp
made by: drakelv
Made for: AddictedMu
Visit: [URL="http://www.coderzfactory.org/"].: CoderZ Factory Network :.[/URL]
*/
#include "AddMU.h"
//////////////////////////////////////////////////////////////////////
// Source Start
//////////////////////////////////////////////////////////////////////
#include <string.h>
#include <windows.h>
 
extern "C" __declspec(dllexport) void OptionAndBugFix();
// Fixing Potion Bug in GS
bool PotBugFix( char * inipath ) 
{
if (GetPrivateProfileInt("GameServerNormal" , "PotionBugFix" , 1 , "./Addicted.ini")){
memset((PBYTE) FixPotionBug1 ,0x90,8 ) ; //warehouse
memset((PBYTE) FixPotionBug2 ,0x90,8 ) ; //inventory
memset((PBYTE) FixPotionBug3 ,0x90,8 ) ; 
return 1;
}
return 0;
}
// Fixing ID Code in GS for characters
bool NoIDChar( char * inipath)
{
if (GetPrivateProfileInt("GameServerNormal" , "DeleteCharWithoutID" , 1 , "./Addicted.ini")){
memset((PBYTE) FixDeleteChar, 0xEB , 1 ); //Dzēst čaru bez ID.
return 1;
}
return 0;
}
// Fixing ID Code in GS for Guilds
bool NoIDGuild( char * inipath )
{
if (GetPrivateProfileInt("GameServerNormal", "DeleteGuildWithoutID", 1, "./Addicted.ini")){
memset((PBYTE) FixDeleteGuild ,0x90 , 6 ); //Dzēst ģildi bez ID
memset((PBYTE) FixLeaveGuild ,0x90 , 2 ); //Pames ģildi bez ID
return 1;
}
return 0;
}
// Party Zen Bug Fix
// transformation ring change
 
bool TransRing( char * inipath ){
int TransformationRing = GetPrivateProfileInt("GameServerNormal", "TransformationRingInit", 0, "Addicted.ini");
DWORD dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing1",2, "Addicted.ini") ;
*(unsigned int *) TransformationRing1 = dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing2",7, "Addicted.ini") ;
*(unsigned int *) TransformationRing2 = dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing3",14, "Addicted.ini") ;
*(unsigned int *) TransformationRing3 = dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing4",8, "Addicted.ini") ;
*(unsigned int *) TransformationRing4 = dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing5",9, "Addicted.ini") ;
*(unsigned int *) TransformationRing5 = dwTmp ;
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing6",41, "Addicted.ini") ;
*(unsigned int *) TransformationRing6 = dwTmp ;
return 1 ;
}
bool NotifyIfDllLoaded( char * inipath ){
if (GetPrivateProfileInt("GameServerNormal", "NotifyIfDllLoaded", 1, "./Addicted.ini") )
{
MessageBox ( 0 , "Addicted.Dll by drakelv has been successfully loaded. Enjoy the Game!" , "DLL Loaded!" , MB_OK );
return 1;
}
else return 0;
}
void OptionAndBugFix()
{
char inipath[] = "./Addicted.ini";
bool bResult ;
DWORD dwOld1,dwOld2;
LPVOID lpAddress1,lpAddress2 ;
lpAddress1 = (LPVOID) 0x00401000 ; //fix96
lpAddress2 = (LPVOID) 0x0C296000 ; //fix96
if ( VirtualProtect (lpAddress1,0x246000+0x1D000,PAGE_EXECUTE_READWRITE,&dwOld1 ) ) //fix96
{ 
if (VirtualProtect(lpAddress2,0x4000,PAGE_EXECUTE_READWRITE, &dwOld2) ) //fix96
{
bResult =FixPotionNumber( inipath );
bResult =NoIDChar( inipath );
bResult =NoIDGuild( inipath );
bResult =TransRing( inipath );
bResult =NotifyIfDllLoaded( inipath );
bResult =PartyZenFix( inipath );
}
// Gs is VirtualProtected so we need to use Vprotect function.
VirtualProtect (lpAddress1,0x246000+0x1D000,PAGE_EXECUTE_READ,&dwOld1 ); 
VirtualProtect (lpAddress2,0x4000 ,PAGE_EXECUTE_READ,&dwOld2 ); 
}
}
.h file
Code:
#define FixDeleteGuild 0x004431CA
#define FixLeaveGuild 0x00443320
#define FixDeleteChar 0x004328E4
#define FixPotionBug1 0x00427A71
#define FixPotionBug3 0x004CD0FF
#define FixPotionBug2 0x004CD0AE
#define FixZenParty 0x004DD318
#define TransformationRing1 0x004B472E
#define TransformationRing2 0x004B4737
#define TransformationRing3 0x004B4740
#define TransformationRing4 0x004B4749
#define TransformationRing5 0x004B4752
#define TransformationRing6 0x004B475B
 char inipath[] = "./Addicted.ini";
Now Explanation:
Lets take NoIDChar

bool (this means its true or false) NoIDChar( char * inipath)
{
//If Addicted.ini has DeleteCharWithoutID value setted to 1 code will execute
if (GetPrivateProfileInt("GameServerNormal" , "DeleteCharWithoutID" , 1 , "./Addicted.ini")){
//We set in Gameservers memory 0xEB on FixDeleteCharacter offset (defined in .h file)
memset((PBYTE) FixDeleteChar, 0xEB , 1 ); //Dzēst čaru bez ID.
return 1;
}
return 0;
}
// Option Value changing
dwTmp=GetPrivateProfileInt("GameServerNormal", "TransformationRing1",2, "Addicted.ini") ;
*(unsigned int *) TransformationRing1 = dwTmp ;
TransformationRing1 is defined on .h file
#define TransformationRing1 0x004B472B (offset in olly)
For adding new options you must find the offset of the option you want to change and define it on .h file.
p.s this source code may have some errors, i didnt tested all parts.
Credits:
[CzF]drakelv
[CzF]eRRoR (Helped me alot)
Cahir (Member of CzF forum)(Correcting issues)
WzAg coders (bet0x, Blurcode and more.)
WebZen
 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Nov 3, 2006
Messages
648
Reaction score
2
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

NIce , good job!
 
Newbie Spellweaver
Joined
Oct 20, 2005
Messages
56
Reaction score
6
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

:vegeta: Hats off to you mate thanks, it helps a lot.
 
IGCN Co-Founder
Joined
Jun 26, 2006
Messages
303
Reaction score
487
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

feel free to ask if you dont understand something
 
Experienced Elementalist
Joined
Apr 29, 2007
Messages
260
Reaction score
4
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

is that going to work on every 1.00.16 gameserver

10x very good :)
 
IGCN Co-Founder
Joined
Jun 26, 2006
Messages
303
Reaction score
487
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

yes it will work on any 1.00.16 gs, cuz they all are the same, just diffrent modifications..
 
Newbie Spellweaver
Joined
Mar 20, 2007
Messages
5
Reaction score
0
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

:D so... do you know how to hook new commands in PChatProc?
 
IGCN Co-Founder
Joined
Jun 26, 2006
Messages
303
Reaction score
487
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

its only for options and bugfixes not commands.
 
Junior Spellweaver
Joined
Dec 13, 2004
Messages
164
Reaction score
12
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

awesome, time to fresh up my vc++ skills :p
 
Experienced Elementalist
Joined
May 29, 2006
Messages
241
Reaction score
20
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

in olly to load your own dll use:

CALL LoadLibraryA
CALL ProcAddress

etc etc etc.
 
Experienced Elementalist
Joined
Sep 14, 2006
Messages
229
Reaction score
0
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

is this source created for Visual C++ 6 or 9 ?
 
Newbie Spellweaver
Joined
May 13, 2007
Messages
6
Reaction score
0
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

New Offset

.h
#define ChaosPrice 0x00508489
#define SoulPrice 0x00508446
#define BlessPrice 0x00508467
#define CreationPrice 0x005084CC
#define GuardianPrice 0x005085AA
#define LifePrice 0x005084AB
#define BlessPotionPrice 0x005085E1
#define SoulPotionPrice 0x00508607
 
TitansTech / SCFMT
Joined
Mar 23, 2004
Messages
129
Reaction score
388
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

eRRoR will agree with this, there is a "hidden" name begin that sources, where are really, and who code it? ;)
 
Junior Spellweaver
Joined
May 16, 2007
Messages
112
Reaction score
0
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

Thanks this very usefull :) ... but u can post a guide for change protocols in gs? kor, vtm, chs ? :construct
 
IGCN Co-Founder
Joined
Jun 26, 2006
Messages
303
Reaction score
487
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

Thx RabbiT, bet0x there is in credits part WZAG coders, i dunno names.
 
Legendary Battlemage
Loyal Member
Joined
Nov 3, 2006
Messages
648
Reaction score
2
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

drakelv can you add me on Y!M ? deniedk1d is the id ..

Please , i really wanna talk with you
 
Legendary Battlemage
Loyal Member
Joined
Nov 3, 2006
Messages
648
Reaction score
2
Re: [Release] Adding New Option C++ Source Code + Full Tutorial

I have added you ...
 
Back
Top