Most visitors online was 17251 , on 24 May 2024
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!why need to remove items
how to disable X shop....
//==================================================================================================//===================================== EX-GAMES GAMESERVER PROJECT ================================
//==================================================================================================
// File: Reset.cpp
// Description: Reset System
// Last Edit: 2.04.2013
//==================================================================================================
// Code: DangeR Skype: muonline.bk
//==================================================================================================
#include "USER.h"
#include "Defines.h"
#include "StdAfx.h"
#include "CQuery.h"
#include "Protocol.h"
#include "Message.h"
#include "AddFunctions.h"
#include "Quest_PGW.h"
// Êîíôèãóðàöèè
//==============
int EnableResSys = GetPrivateProfileInt("Common","Enable",0,"..\\EData\\Reset.ini");
int multEn = GetPrivateProfileInt("Common","multEn",0,"..\\EData\\Reset.ini");
int MaxRes = GetPrivateProfileInt("Common","Max.res",100,"..\\EData\\Reset.ini");
int Needlvl = GetPrivateProfileInt("Common","Need.lvl",400,"..\\EData\\Reset.ini");
int Needzen = GetPrivateProfileInt("Common","Need.zen",10000000,"..\\EData\\Reset.ini");
int Dkpoints = GetPrivateProfileInt("Common","Dk.points",600,"..\\EData\\Reset.ini");
int Dwpoints = GetPrivateProfileInt("Common","Dw.points",600,"..\\EData\\Reset.ini");
int Elfpoints = GetPrivateProfileInt("Common","Elf.points",600,"..\\EData\\Reset.ini");
int Mgpoints = GetPrivateProfileInt("Common","Mg.points",700,"..\\EData\\Reset.ini");
int Dlpoints = GetPrivateProfileInt("Common","Dl.points",700,"..\\EData\\Reset.ini");
int AddGemOn = GetPrivateProfileInt("Common","AddGemOn",0,"..\\EData\\Reset.ini");
int AddGem = GetPrivateProfileInt("Common","AddGem",0,"..\\EData\\Reset.ini");
// Ôóíêöèÿ âûïîëíåíèÿ
//===================
void FunctionReset (DWORD gObjId,char UserName[11])
{
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(gObjId);
exQueryUpdate("UPDATE Character SET Resets = Resets + 1 WHERE Name='%s'", UserName);
if(AddGemOn)
{
exQueryUpdate("UPDATE MEMB_INFO SET CashPoint = CashPoint + %d WHERE memb___id='%s'",AddGem,gObj->AccountID);
}
//MySQL.Execute("SELECT Resets FROM Character WHERE Name='%s'",UserName);
//int UserRes = MySQL.GetInt();
int UserRes = ( ExUser[gObjId].Resets + 1 );
int NumRes = 0;
switch(gObj->Class)
{
case 0: NumRes = UserRes*Dwpoints; break;
case 1: NumRes = UserRes*Dkpoints; break;
case 2: NumRes = UserRes*Elfpoints;break;
case 3: NumRes = UserRes*Mgpoints; break;
case 4: NumRes = UserRes*Dlpoints; break;
}
int NewNeedZen(0);
if(multEn)
{
NewNeedZen = UserRes * Needzen;
gObj->Money = gObj->Money - NewNeedZen;
}
else
gObj->Money = gObj->Money - Needzen;
gObj->Level = 1;
gObj->Experience = 0;
//MySQL.Execute("SELECT gr_res FROM Character WHERE Name='%s'",UserName);
//int UserRangs = MySQL.GetInt();
int UserRangs = ExUser[gObjId].GResets;
int EnableRangSys = GetPrivateProfileInt("Common","Enable",0,"..\\EData\\GrandReset.ini");
if(EnableRangSys == 1 && UserRangs > 0)
{
//GRand Reset Configs
int GDkpoints = GetPrivateProfileInt("Common","Dk.points",600,"..\\EData\\GrandReset.ini");
int GDwpoints = GetPrivateProfileInt("Common","Dw.points",600,"..\\EData\\GrandReset.ini");
int GElfpoints = GetPrivateProfileInt("Common","Elf.points",600,"..\\EData\\GrandReset.ini");
int GMgpoints = GetPrivateProfileInt("Common","Mg.points",700,"..\\EData\\GrandReset.ini");
int GDlpoints = GetPrivateProfileInt("Common","Dl.points",700,"..\\EData\\GrandReset.ini");
int GNumRes(0);
switch(gObj->Class)
{
case 0: GNumRes = UserRangs*GDwpoints;break;
case 1: GNumRes = UserRangs*GDkpoints;break;
case 2: GNumRes = UserRangs*GElfpoints;break;
case 3: GNumRes = UserRangs*GMgpoints;break;
case 4: GNumRes = UserRangs*GDlpoints;break;
}
gObj->LevelUpPoint = GNumRes + NumRes + ExUser[gObjId].Ex_FreePoints;
}
else
{
gObj->LevelUpPoint = NumRes + ExUser[gObjId].Ex_FreePoints;
}
}
// Ôóíêöèÿ ïðîâåðêè
//=================
void CheckReset (int aIndex)
{
if(!EnableResSys)
return;
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
if(gObj->MapNumber != 0)
{
MsgNormal(aIndex,"[Reset]: Started In Lorencia");
return;
}
LogAddText(2,"gObj->m_IfState: %d",gObj->m_IfState);
//if(gObj->m_IfState != 384)
//{
// MsgNormal(aIndex,"[Reset]: Interface Disable");
//}
//MySQL.Execute("SELECT Resets FROM Character WHERE Name='%s'",gObj->Name);
//int UserReset = MySQL.GetInt();
int UserReset = ExUser[aIndex].Resets;
int ifNeedzen(0);
if(multEn)
ifNeedzen = (UserReset+1)*Needzen;
else
ifNeedzen = Needzen;
{
if(UserReset<MaxRes)
{
if(gObj->Level >= Needlvl)
{
if(gObj->Money >= ifNeedzen)
{
MsgNormal(aIndex,"[Reset] Start Reset");
FireCracker(aIndex, gObj->X, gObj->Y);
gObjCloseSet(aIndex, 1);
FunctionReset (aIndex,gObj->Name);
GCMoneySend(gObj->m_Index, gObj->Money);
}
else
{
MsgNormal(aIndex,"[Reset] You need above %d Zen to Reset",ifNeedzen);
}
}
else
{
MsgNormal(aIndex,"[Reset] You need above %d lvl to Reset",Needlvl);
}
}
else
{
MsgNormal(aIndex,"[Reset] Max Reset %d",UserReset);
}
}
}