?? cfightzone.cpp
字號:
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 + -