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

📄 cfightzone.cpp

📁 韩国英雄王座倒闭后流出来部分源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	if( NULL == (lpMatch = Find_Match(nMatchSeq)))
	{
		return false ;
	}
		
	if( NULL == lpMatch->m_lpFightZone) return false ;

	// 版扁啊 场车促.
	if(lpMatch->m_lpFightZone->bIsFightEnd) return false ;

	if ( lpSocketFD->pPlayer->m_nMapLayer == lpMatch->m_lpFightZone->nLayer )
	{
		return true ;
	}

	return false ;
}


////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
bool CFightzoneManager::bTeleportZone(_LPSOCKET_FD lpSocketFD,_POINT p,DWORD dwMatchSEQ ,int nTeam)
{
	/*
	if( !lpSocketFD								) return false ;
	if( lpSocketFD->dwMagicNum	!=	MAGIC_NUM	) return false ;
	if( lpSocketFD->bClose						) return false ;
	if( lpSocketFD->socket == INVALID_SOCKET	) return false ;
	*/
	if( !IsSocketValidity( lpSocketFD )	) return false;	

	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(dwMatchSEQ)))
	{
		return false ;
	}
	
	if( NULL == lpMatch->m_lpFightZone) return false ;

	// 版扁啊 矫累登菌促. 
	// 可历滚绰 版扁 矫累苞 包拌绝捞 甸绢哎荐 乐促.
	if( nTeam != DEF_OBSERVER && lpMatch->m_lpFightZone->bIsStartMatch)	return false ;

	
	if (NULL == lpSocketFD->pPlayer)		return false ;

	lpSocketFD->pPlayer->m_bIsFightZone		= true ;
	lpSocketFD->pPlayer->m_dwMatchSEQ		= dwMatchSEQ ;
	lpSocketFD->pPlayer->m_nTeam			= nTeam ;

	lpSocketFD->pPlayer->m_nMatchTeamType	= lpMatch->m_lpFightZone->Team ;
	lpSocketFD->pPlayer->m_nUsePotion		= lpMatch->m_lpFightZone->UsePotion ;

	lpSocketFD->pPlayer->m_bIsFightMode		= false ;

	lpMatch->JoinTeam(lpSocketFD,nTeam ) ;

	ErrorMsg("(FZ) PlayerTeleport (%s) Match(%d) Killed(%d) Member(%d) TeamCount(%d) Team(%d)",
		lpSocketFD->pPlayer->m_strPlayerID, lpSocketFD->pPlayer->m_dwMatchSEQ, lpMatch->m_lpFightZone->KilledCount[lpSocketFD->pPlayer->m_nTeam]
		, lpMatch->m_lpFightZone->MemberCount[lpSocketFD->pPlayer->m_nTeam] ,  lpMatch->m_lpFightZone->sTeamCount ,lpSocketFD->pPlayer->m_nTeam);

	g_pServer->Teleport(lpSocketFD, p) ;

	return true ;

}

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void  CFightzoneManager::PlayerDead(PlayerInfo * lpPlayer,char * lpAttackerName)
{
	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(lpPlayer->m_dwMatchSEQ )))
	{
		return  ;
	}

	if( NULL == lpMatch->m_lpFightZone) 	return  ;

	ErrorMsg("(FZ) PlayerDead (%s) Match(%d) Killed(%d) Member(%d) TeamCount(%d) Team(%d)",
		lpPlayer->m_strPlayerID, lpPlayer->m_dwMatchSEQ, lpMatch->m_lpFightZone->KilledCount[lpPlayer->m_nTeam] , lpMatch->m_lpFightZone->MemberCount[lpPlayer->m_nTeam] 
		,  lpMatch->m_lpFightZone->sTeamCount ,lpPlayer->m_nTeam);
	
	if(lpMatch->m_lpFightZone->Team != PVP_TEAM_PERSON) 
	{
		char cMsg[200] = {0,} ;
		wsprintf(cMsg,MSG_PK_FIGHTZONE,lpPlayer->m_strPlayerID,lpAttackerName ) ;
		lpMatch->m_lpFightZone->Send_NoticeMsg(cMsg) ;
	}
	
	
	if(lpMatch->bIsLoseTeam(lpPlayer) )
	{
		if(--lpMatch->m_lpFightZone->sTeamCount <= 1 )
		{
			lpMatch->CheckWinTeam() ;
			// 碍妮 矫埃阑 持绰促.

			if(lpMatch->m_lpFightZone->Team == PVP_TEAM_GUILD) 
				lpMatch->m_lpFightZone->dwTime = m_dwTimeTick + DEF_RECALLTIME ;
			else
				lpMatch->m_lpFightZone->dwTime = m_dwTimeTick + 5  ; 
				
		}
	}

	lpMatch->m_lpFightZone->Send_Score();
}




////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void  CFightzoneManager::PlayerLogout(PlayerInfo * lpPlayer,bool bForceLogout)
{
	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(lpPlayer->m_dwMatchSEQ )))
	{
		return  ;
	}
	
	if( NULL == lpMatch->m_lpFightZone) 	return  ;

	--lpMatch->m_lpFightZone->nPlayer ;

	if((bForceLogout == false) && (!lpMatch->m_lpFightZone->bIsStartMatch || lpMatch->m_lpFightZone->bIsFightEnd) )
	{
		lpMatch->LogOutTeam( lpPlayer->m_pSocketFD, lpPlayer->m_nTeam )  ;
		return  ;
	}

	// 版扁 吝老锭父 眉农茄促.
	if(lpMatch->bIsLogoutTeam(lpPlayer) )
	{
		if(--lpMatch->m_lpFightZone->sTeamCount <= 0 )
		{	// 傈何 唱埃 版快 
			lpMatch->m_lpFightZone->GameEnd() ;

		} // 茄评父 巢篮 版快 
		else if(lpMatch->m_lpFightZone->sTeamCount <= 1 )
		{
			lpMatch->CheckWinTeamForLogout() ;
			// 碍妮 矫埃阑 持绰促.
			if(lpMatch->m_lpFightZone->Team == PVP_TEAM_GUILD) 
				lpMatch->m_lpFightZone->dwTime = m_dwTimeTick + DEF_RECALLTIME  ;
			else 
				lpMatch->m_lpFightZone->dwTime = m_dwTimeTick + 5  ; 
		}
	}

	ErrorMsg("(FZ) PlayerLogout (%s) Match(%d) Killed(%d) Member(%d) TeamCount(%d) Team(%d)"
		,lpPlayer->m_strPlayerID, lpPlayer->m_dwMatchSEQ, lpMatch->m_lpFightZone->KilledCount[lpPlayer->m_nTeam] 
		,lpMatch->m_lpFightZone->MemberCount[lpPlayer->m_nTeam] ,lpMatch->m_lpFightZone->sTeamCount ,lpPlayer->m_nTeam);

	lpMatch->m_lpFightZone->Send_Score();
}


////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
bool  CFightzoneManager::bCheckRevive(PlayerInfo * lpPlayer, _POINT & p,bool & bIsHidden)
{
	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(lpPlayer->m_dwMatchSEQ )))
	{
		return false ;
	}

	if( NULL == lpMatch->m_lpFightZone) 	return  false ;

	ErrorMsg("(FZ) PlayerRevive (%s) Match(%d) Team(%d) TeamCount(%d) WinTeam(%d)",
	lpPlayer->m_strPlayerID, lpPlayer->m_dwMatchSEQ, lpMatch->m_lpFightZone->Team  , lpMatch->m_lpFightZone->sTeamCount ,lpMatch->sWinTeam );


	// 措厘 荤成荐客 Kill count 绰 府胶迄 等促. 
	// 矫累等 版扁父 眉农茄促.
	if ( lpMatch->m_lpFightZone->bIsStartMatch &&(lpMatch->Rule == PVP_RULE_MASTERKILLCOUNT || lpMatch->Rule == PVP_RULE_KILLCOUNT)  )
	{
		memcpy( &p , &lpMatch->m_lpFightZone->lpZoneInfor.Point[lpPlayer->m_nTeam ], sizeof(_POINT)) ;
		
		if(lpMatch->m_lpFightZone->bIsHidden)
		{
			bIsHidden = true ;
		}

		return true ;
	}
	else
	{
		// 登混酒 唱搁 肺厚肺 埃促. 
		lpMatch->LogOutTeam( lpPlayer->m_pSocketFD, lpPlayer->m_nTeam )  ;

		lpPlayer->MatchClear() ;
	}



	return false ;
}

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void CFightzoneManager::SetLobby(short nLayer,DWORD dwMapSEQ, _POINT p, bool bIsHidden )
{
	memcpy(&LobbyPoint , &p ,sizeof(_POINT)) ;

	if(bIsHidden)
	{
		nHiddenLobbyLayer = nLayer ;
		dwHiddenLobbyMapSEQ = dwMapSEQ ;
	}
	else
	{
		nLobbyLayer = nLayer ;
		dwLobbyMapSEQ = dwMapSEQ ;
	}

}

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void CFightzoneManager::CheckTick()
{
	_LPCFIGHTZONE lpFightZone = NULL; 

	// 1檬俊 茄锅究 龋免等促.
	++m_dwTimeTick ;
	
	char cMsg[100] ={0,} ;

	MAP_VOIDPTR::iterator iEnd  = lpMapFightZone->End() ;

	for (MAP_VOIDPTR::iterator it = lpMapFightZone->Begin(); it != iEnd; ++it)
	{
		lpFightZone = static_cast <_LPCFIGHTZONE> (it->second) ;

		if(lpFightZone == NULL) continue ;
		
		// 荤捧厘俊 柳青吝牢 版扁啊 绝促.
		if(lpFightZone->m_lpMatch == NULL) continue ;

		// 版扁啊 矫累 窍瘤 臼疽栏搁 
		if (lpFightZone->bIsStartMatch == false)
		{
			 if(m_dwTimeTick  ==  (lpFightZone->dwTime ))
			{
				 // 版扁 矫累傈 敲饭捞绢啊 甸绢客 乐瘤 臼栏搁 版扁 辆丰
				if(lpFightZone->nPlayer <= 0 ) 
				{
					lpFightZone->GameEnd() ;
				}
				else
				{
					lpFightZone->bIsStartMatch = true ;
				}
				
			}
			else if( m_dwTimeTick  >  (lpFightZone->dwTime - 6))
			{
				lpFightZone->Send_Time(DEF_GAMESTARTTIME) ;
			}

		}
		else  //  版扁绰 矫累 
		{
			// 辆丰等 霸烙
			if(lpFightZone->bIsFightEnd == true) 
			{
				// 版扁 辆丰 3盒饶 肺厚肺 碍力 家券茄促.
				if( m_dwTimeTick > lpFightZone->dwTime )
				{
					lpFightZone->SendToLobbyAll() ;
					lpFightZone->GameEnd() ;
				}
				continue ;
			}

			if(lpFightZone->bIsFightStart == false )
			{
				lpFightZone->GameStart() ;
				continue ;
			}

			// 版扁 辆丰 5檬傈 何磐 矫埃阑 焊郴霖促.
			if(m_dwTimeTick >= (lpFightZone->dwTime + lpFightZone->wTime*60) - 6)
			{
				if( m_dwTimeTick == (lpFightZone->dwTime + lpFightZone->wTime*60) )
				{
					// 版扁 辆丰茄促 
					lpFightZone->m_lpMatch->CheckWinTeam() ;
					// 碍妮 矫埃阑 持绰促.
					if(lpFightZone->Team == PVP_TEAM_GUILD) 
						lpFightZone->dwTime = m_dwTimeTick + DEF_RECALLTIME  ;
					else 
						lpFightZone->dwTime = m_dwTimeTick + 5  ; 
				}
				else if(m_dwTimeTick == (lpFightZone->dwTime + lpFightZone->wTime*60) - 6)
				{
					lpFightZone->Send_Time(DEF_GAMETIME) ;
				}
				else if(m_dwTimeTick > (lpFightZone->dwTime + lpFightZone->wTime*60) - 6)
				{
					lpFightZone->Send_Time(DEF_GAMEENDTIME) ;
				}
			} // 版扁 盒付促 矫埃阑 舅妨霖促.
			else if((m_dwTimeTick - lpFightZone->dwTime) % 60 ==  0 )
					lpFightZone->Send_Time(DEF_GAMETIME) ;


			lpFightZone->CheckProtectTime(); 

		}
	}
}


////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
bool CFightzoneManager::bGet_MatchInfor(DWORD dwMatchHandle, _LPZW_FIGHTZONERESERVE lpPacket) 
{
	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(dwMatchHandle)))
	{
		return false ;
	}
	
	if( NULL == lpMatch->m_lpFightZone) 	return  false ;

	// 矫累等 版扁 沥焊绰 鞘夸 绝促.
	if(lpMatch->m_lpFightZone->bIsStartMatch) 	return  false;

	lpPacket->lpInfor.dwFromPlayerHande = lpMatch->MasterHandle[0] ;
	lpPacket->lpInfor.dwToPlayerHande	= lpMatch->MasterHandle[1] ;

	lpPacket->lpInfor.Type				=  lpMatch->m_lpFightZone->Type ;

	memcpy(lpPacket->lpInfor.strFightZoneName, lpMatch->m_lpFightZone->lpZoneInfor.strFightZoneName,20) ;

	lpPacket->lpInfor.Team				= lpMatch->m_lpFightZone->Team ;
	lpPacket->lpInfor.Rule				= lpMatch->Rule ;
	lpPacket->lpInfor.UsePotion			= lpMatch->m_lpFightZone->UsePotion ;

	memcpy(lpPacket->Point,  lpMatch->m_lpFightZone->lpZoneInfor.Point,sizeof(_POINT) *DEF_MAXTEAM ) ;

	lpPacket->dwMapSEQ					= lpMatch->m_lpFightZone->dwMapSEQ ;
	lpPacket->wSEQ						= lpMatch->m_lpFightZone->wSeq ;

	lpPacket->dwMatchSEQ				= dwMatchHandle ;

	return true ;
}

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void CFightzoneManager::MatchEnd(DWORD dwMatchHandle)
{
	_LPCMATCH lpMatch = NULL ;

	if( NULL == (lpMatch = Find_Match(dwMatchHandle)))
	{
		return  ;
	}
	
	if( NULL == lpMatch->m_lpFightZone) 	return   ;

	lpMatch->m_lpFightZone->SendToLobbyAll() ;
	lpMatch->m_lpFightZone->GameEnd();
	
}

////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////
void CFightzoneManager::GetHiddenFightZone(DWORD &dwMatchSeq , DWORD &dwMapSeq, _POINT & p)
{
	WORD wFightZoneCount = 0 ;

	_LPCFIGHTZONE lpFightZone = NULL; 

	MAP_VOIDPTR::iterator iEnd  = lpMapFightZone->End() ;

	for (MAP_VOIDPTR::iterator it = lpMapFightZone->Begin(); it != iEnd; ++it)
	{
		lpFightZone = static_cast <_LPCFIGHTZONE> (it->second) ;

		if(lpFightZone == NULL) continue ;
			
		if(lpFightZone->m_lpMatch == NULL) continue ;

		if(lpFightZone->bIsHidden)
		{
			dwMatchSeq = lpFightZone->m_lpMatch->m_dwMatchSEQ ;

			dwMapSeq = lpFightZone->dwMapSEQ ;

			memcpy( &p , &lpFightZone->lpZoneInfor.Point[0], sizeof(_POINT)) ;

			return ;
		}
	}

}

⌨️ 快捷键说明

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