📄 dragonloginserver.cpp
字号:
case CMD_RARE_ITEM_MAKE_LOG :
{
RecvRareItemMakeLog( &packet->u.rare_item_make_log );
}
break;
case CMD_SET_COMMANDER : // 010915 LTS
case CMD_SET_WARFIELD_POSSESSION :
case CMD_DELETE_EVENT_JOIN : // 020115 LTS
case CMD_SAVE_WARNO : // LTS NEW NATIONWAR
CheckHandleByNationWar(packet,c,cn);
break;
//<soto-030504
case CMD_NEW_EVENT: if(LottoDBMgr())LottoDBMgr()->RecvNewEvent(&packet->u.Lotto_Info,cn);
break;
case CMD_WINNER_CHECK: if(LottoDBMgr())LottoDBMgr()->RecvWinnerCheck(&packet->u.Check_Winner,cn);
break;
case CMD_DEL_LOTTO_USER:
{
if (LottoDBMgr())
{
LottoDBMgr()->RecvDelUser(&packet->u.Check_Winner, cn); // BBD 040127 牢磊眠啊
}
break;
}
case CMD_LOTTERY_INFO: if(LottoDBMgr())LottoDBMgr()->RecvLottery(&packet->u.Lotto_Info,cn);
break;
case CMD_CHECK_WINNER_MENU: if(LottoDBMgr())LottoDBMgr()->RecvCheckOpenWinnerMenu(&packet->u.Lotto_Winner_Menu,cn);
break;
//>soto-030504
//<soto-HK
case CMD_CAN_BUY: if(LottoDBMgr())
{
if(LocalMgr.IsAbleNation(TAIWAN | HONGKONG | CHINA))
{
if(GetShopDemon() != NULL)
{
DebugPrintf("GetShopDemon() Request CMD_CAN_BUY");
GetShopDemon()->RecvCanBuyLotto(&packet->u.Lotto_Buy,cn);
}
else
{
DebugPrintf("GetShopDemon() is NULL =====> CMD_CAN_BUY");
}
}
else
{
LottoDBMgr()->RecvCanBuyLotto(&packet->u.Lotto_Buy,cn);
}
}
break;
case CMD_LOTTO_BUY: if(LottoDBMgr())
{
if(LocalMgr.IsAbleNation(TAIWAN | HONGKONG | CHINA))
{
if(GetShopDemon() != NULL)
{
DebugPrintf("GetShopDemon() Request CMD_LOTTO_BUY");
GetShopDemon()->RecvLottoBuy(&packet->u.Lotto_Buy,cn);
}
else
{
DebugPrintf("GetShopDemon() is NULL =====> CMD_LOTTO_BUY");
}
}
else
{
LottoDBMgr()->RecvLottoBuy(&packet->u.Lotto_Buy);
}
}
else
{
}
break;
//>soto-HK
//<soto-Lotto眠啊
case CMD_LOTTO_SEEK:
{
if(LottoDBMgr())
{
LottoDBMgr()->RecvLottoSeek(&packet->u.Lotto_Seek,cn);
}
}
break;
//>soto-Lotto眠啊.
default :
{ // 0308 YGI
int msg = CheckHandleByKein( packet, c, cn );
if(msg == 1)
{
break;
}
else
{
if(HandleCommand2(c, dwIndex, packet, dwUserID, cn))//020505 lsw
{
break;
}
else
{
MyLog( LOG_NORMAL, "ERROR : Unknown Protocol(%d) dwIndex:%d, dwUserID:%d, cn:%d ", packet->h.header.type, dwIndex, dwUserID, cn );
return msg;
}
}
}
}
if( debug_SavePacketExeTimeIng() )
{
if( ttype != CMD_NONE )
{
{
DWORD t = ViewCheckRoutine( 9999 );
if( t < 30 )
{
Debug( "%2d:%d:%d %20s[%20s] Recv : %5d- %3d\n", g_hour,g_min,g_sec, c[cn].id, c[cn].name, ttype, t );
}
else if( t < 100 )
{
Debug( "%2d:%d:%d %20s[%20s] Recv : %5d--- %3d\n", g_hour,g_min,g_sec, c[cn].id, c[cn].name, ttype, t );
}
else if( t < 200 )
{
Debug( "%2d:%d:%d %20s[%20s] Recv : %5d------ %3d\n", g_hour,g_min,g_sec,c[cn].id, c[cn].name, ttype, t );
}
else
{
Debug( "%2d:%d:%d %20s[%20s] Recv : %5d---------- %3d\n", g_hour,g_min,g_sec, c[cn].id, c[cn].name, ttype, t );
}
}
}
}
return(1);
}
//-----------------------------------------------------------------------------
//acer7
int CheckMyCode( int code, char *mystring )
{
static int count = strlen( MY_STRING );
if(!LocalMgr.IsAbleMyCode(code)) {return false;}//021007 lsw
if( strncmp( MY_STRING, mystring, count ) != 0 ) return false;
return true;
}
void SendCMD_ACCEPT_LOGIN(const int cn, const int iRemainDay)
{
if( cn < 0 || cn >= LOGIN_MAX_CONNECTIONS){return;}
t_connection *pCN = &connections[cn];
t_packet packet;
packet.h.header.type = CMD_ACCEPT_LOGIN;
packet.h.header.size = sizeof(t_server_accept_login);
packet.u.server_accept_login.server_id = cn;
packet.u.server_accept_login.remained_day = iRemainDay;
::strcpy( packet.u.server_accept_login.id, pCN->id );
GetCharactersBasicInfoInID_SQL( pCN->id, &packet );
pCN->state = CONNECT_LOGIN;
::Log_LogIn( g_mon+1, g_day, g_hour, g_min, g_sec, pCN->id );
::QueuePacket(connections, cn, &packet, 1);
}
void SendCMD_USED_ID(const int cn, const int iCallType)
{
if( cn < 0 || cn >= LOGIN_MAX_CONNECTIONS){return;}
t_connection *pCN = &connections[cn];
t_packet packet;
packet.h.header.type = CMD_USED_ID;
packet.h.header.size = 0;
::MyLog( 0, "ID('%s'):IP('%s') is Using Now!! (CallType = %d)", pCN->id, pCN->ip_address, iCallType);
::QueuePacket(connections, cn, &packet, 1);
WORD wPort = 0;
DWORD dwID = 0;
DWORD dwServerSetNum = 0;
if( CheckUsedID_SQL(pCN->id, &wPort, &dwID, &dwServerSetNum ) == 1 )
{ // Modified by chan78 at 2000/02/19 :: 辑滚技飘啊 老摹窍绰 版快俊父 俊捞傈飘肺 立加辆丰甫 夸备茄促.
// 辑滚技飘啊 老摹窍瘤 臼绰 版快俊绰 弊 荤侩磊啊 促弗 辑滚技飘俊辑 唱哎锭鳖瘤 立加捞 阂啊瓷秦柳促.
if( dwServerSetNum == g_pServerTable->GetServerSetNum() )
{
if( !SendRemoveUserToAgent( pCN->id, wPort, dwID ) )
{
::MyLog(0, "FAILED : SendRemoveUserToAgent %d, %d, %d", pCN->id, wPort, dwID);
}
}
}
::closeconnection( connections, cn, CCT_ID_USING_NOW ); // Try to Access with Using ID..
}
int CheckIDAutherizing(t_packet &packet, const int cn)
{
if(cn >= LOGIN_MAX_CONNECTIONS){return 0;}//目池记
t_connection *pCN = &connections[cn];
const int code = packet.u.ClientAccessLogin.mycode;
char *szMyString = packet.u.ClientAccessLogin.mystring;
const int version = packet.u.ClientAccessLogin.version;
const WORD port = packet.u.ClientAccessLogin.wPort;
::memcpy(pCN->id, packet.u.ClientAccessLogin.id, ID_LENGTH);
::memcpy(pCN->pw, packet.u.ClientAccessLogin.pw, PW_LENGTH);
::strcpy(pCN->ip_address, packet.u.ClientAccessLogin.ip);
pCN->myconnectedagentport = port;
const bool bIsGMTool = ((version != GM_TOOL_VERSION)?true:false);
if(bIsGMTool)
{
if(!::CheckGameMakeTool(pCN->id, pCN->ip_address)) // 020830 YGI
{
packet.h.header.type = CMD_INVALID_VERSION;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_INVALID_CLIENT );
MyLog( 0, "Not GM_TOOL ip MY_CODE : ID[ %s ] - IP[ %s ] ", pCN->id, pCN->ip_address );
return 0;
}
}
if( !::CheckMyCode( code, szMyString ) )
{
packet.h.header.type = CMD_INVALID_VERSION;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_INVALID_CLIENT );
::MyLog( 0, "Not match MY_CODE : ID[ %s ] - IP[ %s ] ", pCN->id, pCN->ip_address );
return 0;
}
DWORD id_index = 0;
LoginInfoPay in ={0,};
in.index = id_index;
::memcpy(in.UserID, packet.u.ClientAccessLogin.User_ID ,ID_LENGTH);
::strcpy(in.id, pCN->id);
::strcpy(in.pw, pCN->pw);
::strcpy(in.ip, pCN->ip_address);
// 030929 kyo <<
if( LocalMgr.IsAbleNation(THAI) )
{
if( onepass.CheckLimitedAgeAndTime(in.id) )
{// he is underage.
::MyLog(0, "ID Is Not permited. ID:('%s') AGE:('%d')", in.id, ::GetUserAge(in.id) );
packet.h.header.type = CMD_INVALID_AGE;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_AGE_NOT_PERMIT );
return 0;
}
}
// 030929 kyo >>
OUTPUT Output = onepass.OnePassID(cn,in,bIsGMTool);
int ret = Output.nRet;//肺弊牢 且 荐 乐促 绝促狼 魄喊
const int iBillType = Output.nType;
if(LocalMgr.IsFreeBeta())//021007 lsw
{
if(COnePass::BT_NEED_PAY == ret)
{
ret = COnePass::BT_FREE;
}
}
switch(ret)
{
case COnePass::BT_WRONG_ID:
{
::MyLog(0, "ID Is Not Exist. ID:('%s') PW:('%s')", pCN->id, pCN->pw);
packet.h.header.type = CMD_INVALID_ID;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_ID_NOT_EXIST );
}break;
case COnePass::BT_WRONG_PW:
{
::MyLog(0, "User Enter Wrong PassWord ID:('%s') PW:('%s')", pCN->id, pCN->pw);
packet.h.header.type = CMD_INVALID_PW;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_WRONG_PASSWORD );
}break;
case COnePass::BT_NEED_PAY: // -3 : 捣郴!... //2001/01/28 ZHH
{
::MyLog(0, "User Payment Need!! ID:('%s') PW:('%s') Called by CheckIDAutherizing()", pCN->id, pCN->pw);
packet.h.header.type = CMD_INVALID_PAY;
packet.h.header.size = 0;
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_PAYMENT_NEED );
}break;
case COnePass::BT_WAIT_BILLING_MSG:
{ //呼傅 皋技瘤甫 扁促赋聪促. 酒公 贸府档 窍瘤 臼嚼聪促.
break;
}
case COnePass::BT_FREE:
default:
{
const int ret_checkusedid = onepass.InsertUsedID_SQL_ForPay(" ", in.id, in.ip, in.UserID, iBillType, port, pCN->dwUserID);
if( !ret_checkusedid )//荤侩吝牢 蜡历
{
::SendCMD_USED_ID(cn,0);
return 0;
}
else
{
::SendCMD_ACCEPT_LOGIN(cn,ret);
return 1;
}
}break;
}
return 0;
}
int SendYesorNo( char *ID, //[11]; //user'ID
char *type, //[2]; //type=P or M
long point, //user's Points(using in type=P)
char *expiredata, //[9]; //User's expire data(using in type=M) EX:20001220
int success) //if login or logout success
{
t_packet packet;
char UserID[20]= {0,};
::strcpy(UserID,ID);
int cn,ret=10;
for(cn=2;cn<LOGIN_MAX_CONNECTIONS;cn++)
{
if(strlen(connections[cn].id)>0)
{
if(!strcmp(connections[cn].id,UserID))
{
break;
}
}
}
if(cn==LOGIN_MAX_CONNECTIONS)
{
return 0;
}
t_connection *pCN = &connections[cn];
if(success==1) //肺弊牢 己傍.( 穿焙啊 静瘤 臼绰促搁)
{
const int port = pCN->myconnectedagentport;
const int ret_checkusedid = onepass.InsertUsedID_SQL_ForPay(" ", pCN->id, pCN->ip_address , " " , (int)type, port, pCN->dwUserID );
if( !ret_checkusedid )
{
::SendCMD_USED_ID(cn,1);
return 0;
}
else
{
::SendCMD_ACCEPT_LOGIN(cn,ret);
return 1;
}
}
else//肺弊牢 角菩. 酒捞叼客 菩胶况靛绰 嘎栏骨肺 巢篮巴篮 捣郴绰 巴 挥.
{
::MyLog(0, "User Payment Need!! ID:('%s') PW:('%s') Cause = '%d' Called by SendYesorNo()", pCN->id, pCN->pw, success);
packet.h.header.type = CMD_LOGIN_FAIL_MASSAGE;
packet.h.header.size = sizeof( client_login_fail_reason );
packet.u.client_login_fail_reason.cPaytype = memicmp("P",type,2) == 0 ? 0 : 1; //Point搁 0 沥咀捞搁 1
packet.u.client_login_fail_reason.cReserverdData = 0;
packet.u.client_login_fail_reason.dwType = success;
packet.u.client_login_fail_reason.dwPoint = point;
::sprintf( packet.u.client_login_fail_reason.szExpireDate, expiredata);
::QueuePacket(connections, cn, &packet, 1);
::closeconnection( connections, cn, CCT_PAYMENT_NEED ); // 捣 救陈澜
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -