NS_IMETHODIMP
nsMimeBaseEmitter::Write(const nsACString &buf, uint32_t *amountWritten)
{
  unsigned int        written = 0;
  nsresult rv = NS_OK;
  uint32_t            needToWrite;

#ifdef DEBUG_BenB
  // If you want to see libmime output...
  printf("%s", buf);
#endif

  PR_LOG(gMimeEmitterLogModule, PR_LOG_ALWAYS, ("%s", PromiseFlatCString(buf).get()));
  //
  // Make sure that the buffer we are "pushing" into has enough room
  // for the write operation. If not, we have to buffer, return, and get
  // it on the next time through
  //
  *amountWritten = 0;

  needToWrite = mBufferMgr->GetSize();
  // First, handle any old buffer data...
  if (needToWrite > 0)
  {
    rv = WriteHelper(mBufferMgr->GetBuffer(), &written);

    mTotalWritten += written;
    mBufferMgr->ReduceBuffer(written);
    *amountWritten = written;

    // if we couldn't write all the old data, buffer the new data
    // and return
    if (mBufferMgr->GetSize() > 0)
    {
      mBufferMgr->IncreaseBuffer(buf);
      return rv;
    }
  }


  // if we get here, we are dealing with new data...try to write
  // and then do the right thing...
  rv = WriteHelper(buf, &written);
  *amountWritten = written;
  mTotalWritten += written;

  if (written < buf.Length()) {
    const nsACString &remainder = Substring(buf, written);
    mBufferMgr->IncreaseBuffer(remainder);
  }

  return rv;
}
Exemplo n.º 2
0
BOOL ClientEngine::OnCmdConnectNotify(UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper)
{
	StConnectNotify ConnectNotify;

	pBufferHelper->Read(ConnectNotify);

	UINT32 ConType = ConnectNotify.btConType;

	ConnectNotify.btConType =  TYPE_CLT_PLAYER;

	ConnectNotify.u64ConnID = m_u64ClientID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);

	WriteHelper.BeginWrite(CMD_CONNECT_NOTIFY, CMDH_SVR_CON, 0, 0);

	WriteHelper.Write(ConnectNotify);

	WriteHelper.EndWrite();

	SendData(m_WriteBuffer.GetData(), m_WriteBuffer.GetDataLenth());

	if(ConType == TYPE_SVR_PROXY)
	{
		StCharEnterGameReq CharEnterGameReq;

		CharEnterGameReq.u64CharID = m_u64ClientID;

		CharEnterGameReq.dwIdentifyCode = m_dwIdentifyCode;

		CHECK_PAYER_ID(m_u64ClientID);

		CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);

		WriteHelper.BeginWrite(CMD_CHAR_ENTER_GAME_REQ, CMDH_SENCE, 0, CharEnterGameReq.u64CharID);

		WriteHelper.Write(CharEnterGameReq);

		WriteHelper.EndWrite();

		SendData(m_WriteBuffer.GetData(),m_WriteBuffer.GetDataLenth());
	}
	else if(ConType == TYPE_SVR_LOGIN)
	{
		SetConnectState(Succ_Connect);
	}

	return 0;
}
Exemplo n.º 3
0
BOOL CDBCmdHandler::OnCmdDBLoginReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{	
	StDBCharLoginReq DBCharLoginReq;
	pBufferHelper->Read(DBCharLoginReq);

	StDBCharLoginAck DBCharLoginAck;
	DBCharLoginAck.u64ConnID = DBCharLoginReq.u64ConnID;
	
	UINT32 dwAccountID = m_DBProcManager.VerifyAccount(DBCharLoginReq.CharLoginReq.szAccountName, DBCharLoginReq.CharLoginReq.szPassword);
	if(dwAccountID == 0)
	{
		DBCharLoginAck.CharLoginAck.nRetCode = E_FAILED;
	}
	else
	{
		m_DBProcManager.LoadAccountCharInfo(dwAccountID, DBCharLoginAck.CharLoginAck);
		DBCharLoginAck.CharLoginAck.nRetCode = E_SUCCESSED;
		DBCharLoginAck.CharLoginAck.dwAccountID = dwAccountID;

		//如果这个己有登录角色,则直接把原来的踢掉
	}

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_LOGIN_ACK, 0, 0, 0);
	WriteHelper.Write(DBCharLoginAck);
	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 4
0
BOOL CDBCmdHandler::OnCmdDBNewCharReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StDBNewCharReq DBNewCharReq;
	pBufferHelper->Read(DBNewCharReq);

	StDBCharNewCharAck DBCharNewCharAck;
	DBCharNewCharAck.u64ConnID = DBNewCharReq.u64ConnID;

	if(!m_DBProcManager.CreateNewChar(DBNewCharReq.CharNewCharReq, DBCharNewCharAck.CharNewCharAck))
	{
		DBCharNewCharAck.CharNewCharAck.nRetCode = E_FAILED;
	}
	else
	{
		DBCharNewCharAck.CharNewCharAck.nRetCode = E_SUCCESSED;
	}

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_NEW_CHAR_ACK, 0, 0, 0);
	WriteHelper.Write(DBCharNewCharAck);
	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 5
0
BOOL CSceneManager::OnCmdCreateSceneReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StSvrCreateSceneReq CreateSceneReq;
	pBufferHelper->Read(CreateSceneReq);

	StSvrCreateSceneAck CreateSceneAck;
	CreateSceneAck.dwCreateParam = CreateSceneReq.CreateParam;
	CreateSceneAck.dwSceneID = CreateSceneReq.dwSceneID;
	CreateSceneAck.dwServerID= CGameService::GetInstancePtr()->GetServerID();

	if (!CreateScene(CreateSceneReq.dwSceneID))
	{
		ASSERT_FAIELD;

		CreateSceneAck.dwAckCode = E_FAILED;
	}
	else
	{
		CreateSceneAck.dwAckCode = E_SUCCESSED;
	}
	
	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_SVR_CREATE_SCENE_ACK, 0, 0);
	WriteHelper.Write(CreateSceneAck);
	WriteHelper.EndWrite();

	ServiceBase::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 6
0
BOOL CGameService::OnCloseConnect( CConnection *pConnection )
{
	CLog::GetInstancePtr()->AddLog("收到连接断开的事件!!!!!!");

	//以下是向各个系统投递连接断开的消息
	StDisConnectNotify DisConnectNotify;
	DisConnectNotify.u64ConnID = pConnection->GetConnectionID();
	DisConnectNotify.btConType = pConnection->GetConnectionType();
	IDataBuffer *pDataBuff = CBufferManagerAll::GetInstancePtr()->AllocDataBuff(500);
	CBufferHelper WriteHelper(TRUE, pDataBuff);
	WriteHelper.BeginWrite(CMD_DISCONNECT_NOTIFY, 0,  0);
	WriteHelper.Write(DisConnectNotify);
	WriteHelper.EndWrite();

	IDataBuffer *pDataBuff2 = CBufferManagerAll::GetInstancePtr()->AllocDataBuff(pDataBuff->GetTotalLenth());
	if(pDataBuff2 == NULL)
	{
		ASSERT_FAIELD;
		return FALSE;
	}

	pDataBuff2->CopyFrom(pDataBuff);

	m_ServerCmdHandler.AddMessage(DisConnectNotify.u64ConnID, pDataBuff);

	m_SceneManager.AddMessage(DisConnectNotify.u64ConnID, pDataBuff2);

	//pDataBuff->Release();

	return TRUE;
}
Exemplo n.º 7
0
BOOL CDBCmdHandler::OnCmdDBNewAccountReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StDBNewAccountReq DBNewAccountReq;
	pBufferHelper->Read(DBNewAccountReq);

	StDBNewAccountAck DBNewAccountAck;

	if(m_DBProcManager.CreateAccount(DBNewAccountReq.CharNewAccountReq.szAccountName, DBNewAccountReq.CharNewAccountReq.szPassword))
	{
		DBNewAccountAck.CharNewAccountAck.nRetCode = E_SUCCESSED;
	}
	else
	{
		DBNewAccountAck.CharNewAccountAck.nRetCode = E_FAILED;
	}

	DBNewAccountAck.u64ConnID = DBNewAccountReq.u64ConnID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_NEW_ACCOUNT_ACK, 0, 0, 0);
	WriteHelper.Write(DBNewAccountAck);
	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 8
0
BOOL CDBCmdHandler::OnCmdDBLoadCharReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StDBLoadCharInfoReq DBLoadCharInfoReq;
	pBufferHelper->Read(DBLoadCharInfoReq);


	StDBLoadCharInfoAck DBLoadCharInfoAck;
	DBLoadCharInfoAck.dwProxySvrID = DBLoadCharInfoReq.dwProxySvrID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_LOAD_CHAR_ACK, 0, DBLoadCharInfoReq.dwSceneID, DBLoadCharInfoReq.u64CharID);

	WriteHelper.Write(DBLoadCharInfoAck);

	CDBPlayerObject *pDBPlayer = m_DBPlayerMgr.GetPlayer(DBLoadCharInfoReq.u64CharID);
	if(pDBPlayer == NULL)
	{
		//读取一条记录,
		//读出成功
		pDBPlayer = m_DBPlayerMgr.InsertAlloc(DBLoadCharInfoReq.u64CharID);

		pDBPlayer->Init();

		pDBPlayer->m_u64ObjectID = DBLoadCharInfoReq.u64CharID;

		CHAR szSql[MAX_PATH];
		sprintf(szSql, "select * from t_charinfo where F_CharID = '%lld'", DBLoadCharInfoReq.u64CharID);

		CppSQLite3Query QueryRes = m_DBProcManager.m_DBConnection.execQuery(szSql);

		if(!QueryRes.eof())
		{
			pDBPlayer->m_dwFeature = QueryRes.getIntField("F_Feature", 0);
			strncpy(pDBPlayer->m_szObjectName, QueryRes.getStringField("F_Name", ""), 32);
			pDBPlayer->m_dwLevel = QueryRes.getIntField("F_Level", 0);
	
		}

		//if(!pDBPlayer->LoadFromDB())
		//{
		//	return TRUE;
		//}
	}

	pDBPlayer->WriteToPacket(&WriteHelper);

	WriteHelper.EndWrite();
	
	CGameService::GetInstancePtr()->SendCmdToConnection(DBLoadCharInfoReq.dwGameSvrID, &m_WriteBuffer);
	
	return TRUE;
}
Exemplo n.º 9
0
BOOL CWorldCmdHandler::OnCmdEnterGameReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StCharEnterGameReq CharEnterGameReq;
	pBufferHelper->Read(CharEnterGameReq);

	StDBLoadCharInfoReq DBLoadCharInfoReq;
	DBLoadCharInfoReq.u64CharID		= CharEnterGameReq.u64CharID;
	DBLoadCharInfoReq.dwProxySvrID	= u64ConnID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_LOAD_CHAR_REQ, CMDH_OTHER, 0, 0);
	WriteHelper.Write(DBLoadCharInfoReq);
	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToDBConnection(&m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 10
0
BOOL CGameService::OnDisconnect( CConnection *pConnection )
{
	//以下是向各个系统投递连接断开的消息
	StDisConnectNotify DisConnectNotify;
	DisConnectNotify.u64ConnID = pConnection->GetConnectionID();
	DisConnectNotify.btConType = pConnection->GetConnectionType();
	IDataBuffer *pDataBuff = CBufferManagerAll::GetInstancePtr()->AllocDataBuff(500);
	CBufferHelper WriteHelper(TRUE, pDataBuff);
	WriteHelper.BeginWrite(CMD_DISCONNECT_NOTIFY, CMDH_SVR_CON, 0,  0);
	WriteHelper.Write(DisConnectNotify);
	WriteHelper.EndWrite();

	m_ServerCmdHandler.AddMessage(DisConnectNotify.u64ConnID, pDataBuff);

	pDataBuff->Release();

	return TRUE;
}
Exemplo n.º 11
0
BOOL CClientCmdHandler::SendNewAccountReq( LPCTSTR szAccountName, LPCTSTR szPassword )
{
	StCharNewAccountReq CharNewAccountReq;
	strncpy(CharNewAccountReq.szAccountName, szAccountName, 32);
	strncpy(CharNewAccountReq.szPassword, szPassword, 32);

	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	WriteHelper.BeginWrite(CMD_CHAR_NEW_ACCOUNT_REQ, 0, 0, 0);

	WriteHelper.Write(CharNewAccountReq);

	WriteHelper.EndWrite();

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 12
0
BOOL CClientCmdHandler::SendNewCharReq( UINT32 dwAccountID , LPCTSTR szCharName, UINT32 dwFeature)
{
	StCharNewCharReq CharNewCharReq;
	CharNewCharReq.dwFeature = dwFeature;
	CharNewCharReq.dwAccountID = dwAccountID;
	strncpy(CharNewCharReq.szCharName, szCharName, 32);
	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	WriteHelper.BeginWrite(CMD_CHAR_NEW_CHAR_REQ, 0, 0, 0);

	WriteHelper.Write(CharNewCharReq);

	WriteHelper.EndWrite();

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 13
0
BOOL CClientCmdHandler::SendLeaveGameReq( UINT64 u64CharID )
{
	StCharLeaveGameReq CharLeaveGameReq;

	CharLeaveGameReq.dwLeaveReason = LGR_Quit;

	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	WriteHelper.BeginWrite(CMD_CHAR_LEAVE_GAME_REQ, CMDH_SENCE, 0, u64CharID);

	WriteHelper.Write(CharLeaveGameReq);

	WriteHelper.EndWrite();

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 14
0
BOOL CDBCmdHandler::OnCmdDBPickCharReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StDBCharPickCharReq DBCharPickCharReq;
	pBufferHelper->Read(DBCharPickCharReq);

	StDBCharPickCharAck DBCharPickCharAck;
	DBCharPickCharAck.u64ConnID = DBCharPickCharReq.u64ConnID;
	DBCharPickCharAck.CharPickCharAck.u64CharID = DBCharPickCharReq.CharPickCharReq.u64CharID;
	DBCharPickCharAck.CharPickCharAck.nRetCode = E_SUCCESSED;


	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_PICK_CHAR_ACK, 0, 0, 0);
	WriteHelper.Write(DBCharPickCharAck);
	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 15
0
BOOL CClientCmdHandler::SendDelCharReq( UINT32 dwAccountID,UINT64 dwCharID )
{
	StCharDelCharReq CharDelCharReq;
	CharDelCharReq.dwAccountID = dwAccountID;
	CharDelCharReq.u64CharID    = dwCharID;
	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	CHECK_PAYER_ID(dwCharID);

	WriteHelper.BeginWrite(CMD_CHAR_DEL_CHAR_REQ, 0, 0, 0);

	WriteHelper.Write(CharDelCharReq);

	WriteHelper.EndWrite();

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 16
0
BOOL CClientCmdHandler::SendPickCharReq( UINT64 u64CharID )
{
	StCharPickCharReq CharPickCharReq;
	CharPickCharReq.u64CharID = u64CharID;

	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	CHECK_PAYER_ID(u64CharID);

	WriteHelper.BeginWrite(CMD_CHAR_PICK_CHAR_REQ, 0, 0, 0);

	WriteHelper.Write(CharPickCharReq);

	WriteHelper.EndWrite();

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 17
0
BOOL CWorldCmdHandler::OnCmdEnterGameReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StCharEnterGameReq CharEnterGameReq;
	pBufferHelper->Read(CharEnterGameReq);

	StDBLoadCharInfoReq DBLoadCharInfoReq;
	DBLoadCharInfoReq.u64CharID		= CharEnterGameReq.u64CharID;
	DBLoadCharInfoReq.dwProxySvrID	= (UINT32)u64ConnID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_DB_LOAD_CHAR_REQ, CMDH_OTHER, 0, 0);
	WriteHelper.Write(DBLoadCharInfoReq);
	WriteHelper.EndWrite();
	ASSERT(m_WriteBuffer.GetDataLenth() >= (sizeof(DBLoadCharInfoReq)+22));
	if (!CGameService::GetInstancePtr()->SendCmdToDBConnection(&m_WriteBuffer))
	{
		ASSERT_FAIELD;
	}

	return TRUE;
}
Exemplo n.º 18
0
BOOL CServerCmdHandler::OnCmdConnectNotify(UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper)
{
	StConnectNotify ConnectNotify;

	pBufferHelper->Read(ConnectNotify);

	//如果是中心服务器,就先发请求其它服务器信息和注删自己的信息
	if(ConnectNotify.btConType == TYPE_SVR_CENTER)
	{
		// 发送其它服务器的请求信息	

		StSvrServerInfo RegisterToCenterSvr;

		RegisterToCenterSvr.dwSvrID = CGameService::GetInstancePtr()->GetServerID();
		RegisterToCenterSvr.dwType = CGameService::GetInstancePtr()->GetServerType();
		strncpy(RegisterToCenterSvr.szIpAddr, CGlobalConfig::GetInstancePtr()->m_strIpAddr.c_str(), 32);
		RegisterToCenterSvr.sPort = CGlobalConfig::GetInstancePtr()->m_sPort;

		CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);

		WriteHelper.BeginWrite(CMD_SVR_REGISTER_TO_CENTER, CMDH_SVR_CON, 0, 0);

		WriteHelper.Write(RegisterToCenterSvr);

		WriteHelper.EndWrite();

		CGameService::GetInstancePtr()->SendCmdToConnection(u64ConnID,  &m_WriteBuffer);
	}
	else
	{
		//连接成功,将此服务器信息从待连列中删除
		m_WaitConSvrList.erase(ConnectNotify.u64ConnID);
		if(m_WaitConSvrList.empty())
		{
			CLog::GetInstancePtr()->AddLog("************所有的服务器己全部连接完成************");
		}
	}

	return TRUE;
}
Exemplo n.º 19
0
BOOL CClientCmdHandler::SendMoveReq( FLOAT x, FLOAT y, FLOAT z, UINT16 nDir)
{
	StCharMoveReq _MoveGs;
	_MoveGs.x = x;
	_MoveGs.y = y;
	_MoveGs.z = z;
	_MoveGs.sDir = nDir;

	CBufferHelper WriteHelper(TRUE, m_ClientConnector.GetWriteBuffer());

	WriteHelper.BeginWrite(CMD_CHAR_MOVE_REQ, CMDH_SENCE, 12, m_HostPlayer.GetObjectID());

	WriteHelper.Write(_MoveGs);

	WriteHelper.EndWrite();

	CHECK_PAYER_ID(m_HostPlayer.GetObjectID());

	m_ClientConnector.SendData(m_ClientConnector.GetWriteBuffer()->GetData(), m_ClientConnector.GetWriteBuffer()->GetDataLenth());

	return TRUE;
}
Exemplo n.º 20
0
BOOL CWorldCmdHandler::OnCmdDBLoadCharAck( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
	StDBLoadCharInfoAck DBLoadCharInfoAck;
	pBufferHelper->Read(DBLoadCharInfoAck);

	CPlayerObject *pPlayerObject = m_PlayerObjectMgr.CreatePlayerByID(DBLoadCharInfoAck.u64CharID);
	CHECK_AND_RETURN_ASSERT(pPlayerObject, TRUE);

	if(!pPlayerObject->LoadFromDBPacket(pBufferHelper))
	{
		ASSERT_FAIELD;
		return TRUE;
	}

	UINT32 dwGameSvrID = m_GameSvrMgr.GetServerIDBySceneID(pPlayerObject->m_dwSceneID);
	if(dwGameSvrID == 0)
	{
		ASSERT_FAIELD;
		return TRUE;
	}

	//继续往游戏服转移
	StSvrEnterSceneReq SvrEnterSceneReq;
	SvrEnterSceneReq.dwGameSvrID  = dwGameSvrID;
	SvrEnterSceneReq.dwProxySvrID = DBLoadCharInfoAck.dwProxySvrID;
	SvrEnterSceneReq.dwSceneID    = pPlayerObject->m_dwSceneID;
	SvrEnterSceneReq.u64CharID    = DBLoadCharInfoAck.u64CharID;

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
	WriteHelper.BeginWrite(CMD_SVR_ENTER_SCENE_REQ, CMDH_OTHER, SvrEnterSceneReq.dwSceneID, DBLoadCharInfoAck.u64CharID);
	WriteHelper.Write(SvrEnterSceneReq);

	pPlayerObject->SaveDataToPacket(&WriteHelper);

	WriteHelper.EndWrite();
	CGameService::GetInstancePtr()->SendCmdToConnection(SvrEnterSceneReq.dwGameSvrID, &m_WriteBuffer);

	return TRUE;
}
Exemplo n.º 21
0
BOOL ClientEngine::Login(const char *pszAccountName, const char *pszPassword)
{
	if((pszPassword == NULL)||(pszAccountName == NULL))
	{
		return FALSE;
	}

	StCharLoginReq CharLoginReq;
	strncpy(CharLoginReq.szAccountName, pszAccountName, 32);
	strncpy(CharLoginReq.szPassword, pszPassword, 32);

	CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);

	WriteHelper.BeginWrite(CMD_CHAR_LOGIN_REQ, 0, 0, 0);

	WriteHelper.Write(CharLoginReq);

	WriteHelper.EndWrite();

	SendData(m_WriteBuffer.GetData(), m_WriteBuffer.GetDataLenth());

	return TRUE;
}