⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamelog.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
}

// 13. 俺牢惑痢 焊扁
void GameLog::WriteViewItemVendor( Player* pPlayer1, int nServerCode, Player* pPlayer2 )
{
	if( !IsRun() )		return;

	m_ItemData.Init();
	m_ItemData.iItemCode = ITEM_WATCHPC;
	m_ItemData.iServerCode = nServerCode;
	WriteBaseData( &m_ItemData, pPlayer1->GetUserID(), pPlayer1->GetCharName() );
	SetOtherPlayerInfo( &m_ItemData, pPlayer2 );
	if( !m_LogMng.WriteItem( m_ItemData, m_bWriteText, NULL ) )
		InsertStatusLog( "WriteViewItemVendor Error" );
}


// 14. 芒绊 沥焊
void GameLog::WriteWareHouseInfo( Player* pPlayer, int nServerCode, SCItemSlot* pItemSlot, DWORD dwMoney )
{
	if( !IsRun() )		return;

	m_ItemData.Init();
	m_ItemData.iItemCode = ITEM_WATCHPC;
	m_ItemData.iServerCode = nServerCode;
	WriteBaseData( &m_ItemData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	SetItemInfo( &m_ItemData, pItemSlot );
	if( !m_LogMng.WriteItem( m_ItemData, m_bWriteText, "%d, %d, Money = %d", pItemSlot->GetRank(), pItemSlot->GetEnchant(), dwMoney ) )
		InsertStatusLog( "WriteWareHouseInfo Error" );
}


// 15. 俺牢惑痢 沥焊(啊拜汲沥)
void GameLog::WriteVendorInfo( Player* pPlayer, int nServerCode, SCItemSlot* pItemSlot, DWORD dwMoney )
{
	if( !IsRun() )		return;

	m_ItemData.Init();
	m_ItemData.iItemCode = ITEM_SETPRICE_PC;
	m_ItemData.iServerCode = nServerCode;
	WriteBaseData( &m_ItemData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	SetItemInfo( &m_ItemData, pItemSlot );
	if( !m_LogMng.WriteItem( m_ItemData, m_bWriteText, "%d, %d, money = %d", pItemSlot->GetRank(), pItemSlot->GetEnchant(), dwMoney ) )
		InsertStatusLog( "WriteVendorInfo Error" );
}

// 16. 珐农诀 矫档
void GameLog::WriteItemRankUpStart( Player* pPlayer, int nServerCode, POSTYPE pos1, POSTYPE pos2 )
{
	if( !IsRun() )		return;

	SCSlotContainer* pInventory = (SCSlotContainer*)pPlayer->GetItemManager()->GetItemSlotContainer( SI_INVENTORY );
	SCItemSlot& rTargetSlot1 = (SCItemSlot &)pInventory->GetSlot(pos1);
	SCItemSlot& rTargetSlot2 = (SCItemSlot &)pInventory->GetSlot(pos2);

	m_ItemData.Init();
	m_ItemData.iItemCode = ITEM_RANKUPTRY;	// 珐农诀 矫档
	m_ItemData.iServerCode = nServerCode;
	WriteBaseData( &m_ItemData, pPlayer->GetUserID(), pPlayer->GetCharName() );

	//1锅掳 荤侩等 酒捞袍
	SetItemInfo( &m_ItemData, &rTargetSlot1 );

	//2锅掳 荤侩等 酒捞袍
	BOOL bRet = m_LogMng.WriteItem( m_ItemData, m_bWriteText, "Second Item : %d, %d, %d, %d, %d", rTargetSlot2.GetCode()
		, rTargetSlot2.GetSerial(), rTargetSlot2.GetNum(), rTargetSlot2.GetRank(), rTargetSlot2.GetEnchant() );

	if( !bRet )
		InsertStatusLog( "WriteItemRankUpStart Error" );

}



//////////////////////////////////////////////////////////////////////////
// 蜡历咀记 肺弊
//1. 何劝 肺弊
void GameLog::WritePlayerResurrection( Player* pPlayer, int nServerCode, DWORD dwExp, int nMapCode, int nPosX, int nPosY, int nPosZ )
{
	if( !IsRun() )		return;

	m_ActionData.Init();
	m_ActionData.iActionCode = ACT_REBIRTH_CHAR;
	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	m_ActionData.siMapCode = nMapCode;
	m_ActionData.siMapX = nPosX;
	m_ActionData.siMapY = nPosY;
	m_ActionData.siMapZ = nPosZ;
	if( !m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, NULL ) )
		InsertStatusLog( "WritePlayerResurrection Error" );
}

void GameLog::WritePlayerDead( Player* pPlayer, int nServerCode, DWORD dwExp, int nMapCode, int nPosX, int nPosY, int nPosZ )
{
	if( !IsRun() )		return;

	m_ActionData.Init();
	m_ActionData.iActionCode = ACT_DEAD_CHAR;
	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	m_ActionData.siMapCode = nMapCode;
	m_ActionData.siMapX = nPosX;
	m_ActionData.siMapY = nPosY;
	m_ActionData.siMapZ = nPosZ;

	if(	!m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, NULL ) )
		InsertStatusLog( "WritePlayerDead Error" );
}

//肺弊牢矫 牢亥配府 沥焊
void GameLog::WriteInvenInfoOnLogin( Player* pPlayer, int nServerCode )
{
	if( !IsRun() )		return;

	WriteSnapShot( pPlayer, nServerCode );
}

//胶泡荤侩
void GameLog::WriteUseStat( Player* pPlayer, int nServerCode, byte byStatType )
{
	if( !IsRun() )		return;

	m_ActionData.Init();
	m_ActionData.iActionCode = ACT_USE_STAT;
	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );

	if( !m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, " STATCODE = %d", byStatType ) )
		InsertStatusLog( "WriteUseStat Error" );
}

//某腐磐 积己/昏力
void GameLog::WriteCharacter( Player* pPlayer, int nServerCode, BOOL bCreate )
{
	if( !IsRun() )		return;

	m_ActionData.Init();
	if( bCreate == TRUE )
		m_ActionData.iActionCode = ACT_CREATE_CHAR;
	else
		m_ActionData.iActionCode = ACT_DELETE_CHAR;

	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );

	if( !m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, NULL ) )
		InsertStatusLog( "WriteCharacter Error" );
}

// 6. 付阑肺 捞悼
void GameLog::WriteMoveVillage( Player* pPlayer, int nServerCode, int nMapCode )
{
	if( !IsRun() )		return;

	m_ActionData.Init();
	m_ActionData.iActionCode = ACT_MOVE_TOWN;
	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	m_ActionData.siMapCode = nMapCode;
	if( !m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, NULL ) )
		InsertStatusLog( "WriteMoveVillage Error" );
}


// 7. 胶懦饭骇诀
void GameLog::WriteSkillLevelUp( Player* pPlayer, int nServerCode, int nSkillCode, BOOL bLevelUp )
{
	if( !IsRun() )		return;

	m_ActionData.Init();

	if( bLevelUp == FALSE )  //饭骇诀捞 酒聪搁, 贸澜 胶懦阑 硅快绰 芭促.
		m_ActionData.iActionCode = ACT_ACQUIRE_SKILL;
	else
		m_ActionData.iActionCode = ACT_SKILLLV_UP;
	m_ActionData.iServerCode = nServerCode;
	WriteBaseData( &m_ActionData, pPlayer->GetUserID(), pPlayer->GetCharName() );

	if( !m_LogMng.WriteUserAction( m_ActionData, m_bWriteText, "SKILL CODE = %d", nSkillCode ) )
		InsertStatusLog( "WriteSkillLevelUp Error" );
}


// 4. 某腐磐 立加
void GameLog::WriteCharConnect( Player* pPlayer, int nServerCode )
{
	if( !IsRun() )		return;

	m_SessionData.Init();

	m_SessionData.iConnectCode = CONN_CHAR_DISCONNECT;
	m_SessionData.iServerCode = nServerCode;
	WriteBaseData( &m_SessionData, pPlayer->GetUserID(), pPlayer->GetCharName() );
	if( !m_LogMng.WriteSession( m_SessionData, m_bWriteText, NULL ) )
		InsertStatusLog( "WriteCharConnect Error" );
}

// 胶忱鸡 肺弊
void GameLog::WriteSnapShot( Player* pPlayer, int nServerCode )
{
	if( !IsRun() )		return;

	int nSize = 0;
	m_SnapShotData.Init();

	// 扁夯沥焊
	WriteBaseData( &m_SnapShotData, pPlayer->GetUserID(), pPlayer->GetCharName() );

	/************************************************************************/
	/* 某腐磐 沥焊                                                          */
	/************************************************************************/
	BASE_PLAYERINFO* pCharInfo = NULL;
	pCharInfo = pPlayer->GetCharInfo();
	if( pCharInfo )
	{
		nSize = sizeof(BASE_PLAYERINFO);
		if( nSize <= sizeof(m_SnapShotData.byCharStat) )
			CopyMemory( m_SnapShotData.byCharStat, pCharInfo, nSize );	
	}

	/************************************************************************/
	/* 固记沥焊                                                             */
	/************************************************************************/
	nSize = sizeof( m_SnapShotData.byMission );
	pPlayer->GetMissionManager()->SerializeStream( m_SnapShotData.byMission, nSize, SERIALIZE_LOAD );

	/************************************************************************/
	/* 涅胶飘                                                               */
	/************************************************************************/
	// 涅胶飘绰 眠饶 眠啊..

	/************************************************************************/
	/* 厘厚                                                                 */
	/************************************************************************/
	//Inventory
	nSize = sizeof(m_SnapShotData.byEquipItem);
	ITEMSTREAMEX* pEquipItemStrem = (ITEMSTREAMEX*)m_SnapShotData.byEquipItem;
	SCItemSlotContainer* pEquipContainer = (SCItemSlotContainer*)pPlayer->GetItemManager()->GetItemSlotContainer( SI_EQUIPMENT );
	pEquipContainer->SerializeItemStreamAll( pEquipItemStrem, nSize, SERIALIZE_LOAD );

	/************************************************************************/
	/* 胶懦                                                                 */
	/************************************************************************/
	nSize = sizeof(m_SnapShotData.bySkill);
	SKILLSTREAM* pSkillStrem = (SKILLSTREAM*)m_SnapShotData.bySkill;
	SCSkillSlotContainer* pSkillContainer = (SCSkillSlotContainer*)pPlayer->GetSkillManager()->GetSkillSlotContainer();
	pSkillContainer->SerializeSkillStreamAll( pSkillStrem, nSize, SERIALIZE_LOAD );

	/************************************************************************/
	/* 牢亥配府		                                                        */
	/************************************************************************/
	// 牢亥配府 沥焊
	//Inventory
	nSize = sizeof(m_SnapShotData.byInventory);
	ITEMSTREAMEX* pItemStrem = (ITEMSTREAMEX*)m_SnapShotData.byInventory;
	SCItemSlotContainer* pItemContainer = (SCItemSlotContainer*)pPlayer->GetItemManager()->GetItemSlotContainer( SI_INVENTORY );
	pItemContainer->SerializeItemStreamAll( pItemStrem, nSize, SERIALIZE_LOAD );

	// 袍橇牢亥配府
	nSize = sizeof(m_SnapShotData.byTmpInventory);
	ITEMSTREAMEX* pTempItemStrem = (ITEMSTREAMEX*)m_SnapShotData.byTmpInventory;
	SCItemSlotContainer* pTempItemContainer = (SCItemSlotContainer*)pPlayer->GetItemManager()->GetItemSlotContainer( SI_TEMPINVENTORY );
	pTempItemContainer->SerializeItemStreamAll( pTempItemStrem, nSize, SERIALIZE_LOAD );

	if( !m_LogMng.WriteCharSnap( m_SnapShotData, NULL ) )
		InsertStatusLog( "WriteSnapShot Error" );
}


// 沥扁利栏肺 霸烙 肺弊甫 巢变促.
// 咯扁辑 角青登瘤 臼栏搁, 肺弊单捞磐甫 捞 努贰胶肺 逞败档, 扁废登瘤 臼绰促.
void GameLog::StartRegularLog( int nLogType )
{
	if( nLogType == REGULAR_SKILL )  //胶懦肺弊甫 矫累矫挪促搁..
	{
		// 咯扁辑 静饭靛甫 角青矫虐绊,
		// 静饭靛 郴俊辑 Timer甫 角青矫挪促.
		unsigned int nThreadID = 1;
		HANDLE hSkillThread = (HANDLE)_beginthreadex( NULL, 0, SkillWorkThread, NULL, 0, &nThreadID );
	}
}

//酒捞袍 扁夯沥焊甫 掘绰促.
bool GameLog::SetItemInfo( ItemData* pData, SCItemSlot* pItemSlot )  
{
	if( !pData || !pItemSlot )
		return false;

	pData->iItemBaseCode = pItemSlot->GetCode();
	pData->iItemSeq = pItemSlot->GetSerial();
	pData->iItemCount = pItemSlot->GetNum();
	return true;
}

//敲饭捞绢狼 困摹沥焊(甘内靛, 困摹)甫 掘绰促.
bool GameLog::SetPlayerPosInfo( ItemData* pData, Player* pPlayer)
{
	if( !pData || !pPlayer )
		return false;

	WzVector vecPos;
	pPlayer->GetPos( &vecPos );

	pData->siMapCode = (short)pPlayer->GetField()->GetMap()->GetMapCode();
	pData->siMapX = (short)vecPos.x;
	pData->siMapY = (short)vecPos.y;
	pData->siMapZ = (short)vecPos.z;

	return true;
}

//pPlayer : 惑措规 敲饭捞绢 沥焊
void GameLog::SetOtherPlayerInfo( ItemData* pData, Player* pPlayer )
{
	if( pPlayer->GetUserID() == NULL )		_tcsncpy( pData->szToUserID, "", MAX_USER_ID_STR_SIZE );
	else									_tcsncpy( pData->szToUserID, pPlayer->GetUserID(), MAX_USER_ID_STR_SIZE );

	if( pPlayer->GetCharName() == NULL )	_tcsncpy( pData->szToCharName, "", MAX_PARTNER_CHAR_STR_SIZE );
	else 									_tcsncpy( pData->szToCharName, pPlayer->GetCharName(), MAX_PARTNER_CHAR_STR_SIZE );
}



//Thread Argument
unsigned int __stdcall SkillWorkThread(void* pArg)
{
	GameLog* pLog = (GameLog*)pArg;

	while(TRUE)
	{

	}
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -