/* AddMU.cpp
made by: drakelv
Made for: AddictedMu
Visit: .: CoderZ Factory Network :.
*/
#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;
}
// chaos price
[B] bool ChaosPrice( char * inipath )
{
[COLOR=DarkRed] if (GetPrivateProfileInt("GameServerNormal" , "ChaosPrice" , 1 , "./adicted.ini")){
[/COLOR] [COLOR=DarkRed] memset((PBYTE) ChaosPrice ,0xEB,8 )[/COLOR]
return 1;
}
return 0;[/B]
}
// 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 );
}
}