Beispiel #1
0
void CPartyQuestProcessor::SetPartyQuest( int nQuestId, int nState, int ns, int nf, u_long idParty, OBJID objidWormon )
{
	if( nQuestId >= MAX_PARTY_QUEST )
	{
		Error( "" );
		return;
	}
	PARTYQUESTPROP* pProp	= prj.GetPartyQuestProp( nQuestId );
	if( !pProp )
	{
		Error( "" );
		return;
	}

	TRACE( "SET_PARTY_QUEST, %d, %d, %d\n", nQuestId, idParty, objidWormon );
	PPARTYQUESTELEM	pElem	= &m_pElem[nQuestId];
	pElem->nId	= nQuestId;
	pElem->nState	= nState;
	pElem->idParty	= idParty;
	pElem->dwEndTime	= GetTickCount() + MIN( 60 );
	
	pElem->nProcess		= PQP_WORMON;
	pElem->ns	= ns;
	pElem->nf	= nf;
	pElem->objidWormon	= objidWormon;
	pElem->nCount	= 0;

	// 유저에게 공략시간을 넘겨준다...
	SendQuestLimitTime( PQP_WORMON, MIN( 60 ), idParty );

	// 파티퀘스트시작시 정보를 파일에 기록한다.
	CString strFileName = "StartPartyQuestInfo.txt";
	CString strQuestInfo;
	CString strMemberName;
	CString strDateTime;
	
	CTime time = CTime::GetCurrentTime();
	strDateTime.Format( "DATE : %d%.2d%.2d\nTIME : %d::%d::%d\n", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond() );
	strQuestInfo.Format( "QUEST ID = %d, PARTY ID = %d, WORMON ID = %d\n", nQuestId, idParty, objidWormon );
	
	CParty* pParty	= g_PartyMng.GetParty( idParty );
	if( pParty )
	{
		int i; for( i = 0 ; i < pParty->GetSizeofMember() ; ++i )
		{
			CUser* pUsertmp = (CUser *)prj.GetUserByID( pParty->GetPlayerId( i ) );
			if( IsValidObj( pUsertmp ) )
			{
				strMemberName += pUsertmp->GetName();
				strMemberName += "\n";
			}
		}
	}

	FILEOUT( strFileName, "%s%s%s\n", strDateTime, strQuestInfo, strMemberName );
	////////////////////////////////////////////////////////////////////////////////////////////
}
Beispiel #2
0
void CPartyMng::PartyMapInfo( )
{
	const float PARTY_MAP_AROUND = 32.0f * 32.0f;	// m_nVisibilityRange에 영향을 받는다.

	if( ++m_nSecCount < PARTY_MAP_SEC )
		return;

	m_nSecCount = 0;

	D3DXVECTOR3 vPosBuf;
	float fDist;
	for( C2PartyPtr::iterator i	= m_2PartyPtr.begin(); i != m_2PartyPtr.end(); ++i )
	{
		CParty* pParty = (CParty*)i->second;
		for( int j = 0 ; j < pParty->GetSizeofMember() ; ++j )
		{
			CMover* pMover = prj.GetUserByID( pParty->GetPlayerId( j ) );
			if( !IsValidObj( pMover ) )
				continue;
			
			vPosBuf = pMover->GetPos() - pParty->GetPos( j );
			fDist = D3DXVec3LengthSq( &vPosBuf );
			if( 0.0f < fDist )
			{
				pParty->SetPos( j, pMover->GetPos() );
				
				CMover* pSendMover;
				for( int k = 0 ; k < pParty->GetSizeofMember() ; ++k )
				{
					if( k == j )
						continue;
					pSendMover = prj.GetUserByID( pParty->GetPlayerId( k ) );
					if( !IsValidObj( pSendMover ) )
						continue;

					vPosBuf = pSendMover->GetPos() - pMover->GetPos();
					fDist = D3DXVec3LengthSq( &vPosBuf );
					if( fDist > PARTY_MAP_AROUND )
						((CUser*)pSendMover)->AddPartyMapInfo( j, pMover->GetPos() );		
				}
			}
		}
	}
}
Beispiel #3
0
void CPartyQuestProcessor::SendQuestLimitTime( int nState, DWORD dwTime, u_long idParty )
{
	CParty* pParty	= g_PartyMng.GetParty( idParty );
	if( pParty )
	{
		int i; for( i = 0 ; i < pParty->GetSizeofMember() ; ++i )
		{
			CUser* pUsertmp = (CUser *)prj.GetUserByID( pParty->GetPlayerId( i ) );
			if( IsValidObj( pUsertmp ) )
			{
				pUsertmp->AddQuestTextTime( 1, nState, dwTime );
			}
		}
	}
}
Beispiel #4
0
void CPartyQuestProcessor::Process()
{
	DWORD dwTickCount	= GetTickCount();
	int i; for( i = 0; i < MAX_GUILD_QUEST; i++ )
	{
		PPARTYQUESTELEM pElem = &m_pElem[i];
		if( pElem->nId == i )
		{
			CParty* pParty	= g_PartyMng.GetParty( pElem->idParty );
//			if( !pGuild )
//				continue;

			PARTYQUESTPROP* pProp	= prj.GetPartyQuestProp( pElem->nId );
			if( !pProp )
				continue;

			// 제한 시간 지났다...
			if( pElem->dwEndTime < dwTickCount )
			{
				switch( pElem->nProcess )
				{
					case PQP_WORMON:
						{
							TRACE( "PQP_WORMON - r\n" );

							CRect rect;
							rect.SetRect( pProp->x1, pProp->y2, pProp->x2, pProp->y1 );

//							if( pParty )
//							{
//								pParty->ReplaceLodestar( rect );
//							}
/*
							CMover* pWormon	= prj.GetMover( pElem->objidWormon );
							if( pWormon )
								pWormon->Delete();
*/
							CPoint		point;
							D3DXVECTOR3 vPos;
							point  = rect.CenterPoint();
							vPos.x = (float)( point.x );
							vPos.z = (float)( point.y );
							vPos.y = 100.0f;
							RemoveAllDynamicObj( pProp->dwWorldId, vPos, 500 );

							RemovePartyQuest( pElem->nId );
						}
						break;
					case PQP_GETITEM:
						{
							TRACE( "PQP_GETITEM - r\n" );

							CRect rect;
							rect.SetRect( pProp->x1, pProp->y2, pProp->x2, pProp->y1 );

//							if( pParty )
//							{
//								pParty->ReplaceLodestar( rect );
//							}
							CPoint		point;
							D3DXVECTOR3 vPos;
							point  = rect.CenterPoint();
							vPos.x = (float)( point.x );
							vPos.z = (float)( point.y );
							vPos.y = 100.0f;
							RemoveAllDynamicObj( pProp->dwWorldId, vPos, 500 );

							RemovePartyQuest( pElem->nId );
						}
						break;
					default:
						break;
				}
			}
			else
			// 아직 열시미 잡고있는중이다~
			{
				switch( pElem->nProcess )
				{
					case PQP_WORMON:
						{
							TRACE( "PQP_WORMON - p\n" );
							
							if( ++pElem->nCount < 10 )
								continue;

							CRect rect;
							rect.SetRect( pProp->x1, pProp->y2, pProp->x2, pProp->y1 );
							BOOL bsurvivor	= FALSE;	// is survivor exists?

							if( pParty )
							{
								CUser* pUser;
								
								for( int k = 0 ; k < pParty->GetSizeofMember() ; k++ )
								{
									u_long idPlayer = pParty->GetPlayerId( k );
									pUser = (CUser*)prj.GetUserByID( idPlayer );
									if( IsValidObj( pUser ) )
									{										
										POINT point = { (int)pUser->GetPos().x, (int)pUser->GetPos().z	};
										if( rect.PtInRect( point ) && pUser->IsLive() )
										{
											bsurvivor	= TRUE;
											break;
										}
										else
										{
											pUser->AddQuestTextTime( 0, 0, 0xffffffff );											
										}
									}
								}

								for( int k = 0 ; k < pParty->GetSizeofMember() ; k++ )
								{
									u_long idPlayer = pParty->GetPlayerId( k );
									pUser = (CUser*)prj.GetUserByID( idPlayer );
									if( IsValidObj( pUser ) )
									{										
										POINT point = { (int)pUser->GetPos().x, (int)pUser->GetPos().z	};
										if( !rect.PtInRect( point ) )
										{
											pUser->AddQuestTextTime( 0, 0, 0xffffffff );											
										}
									}
								}
								
							}

							if( !bsurvivor  )
							{
//								if( pParty )
//								{
//									pParty->ReplaceLodestar( rect );
//								}
/*
								CMover* pWormon	= prj.GetMover( pElem->objidWormon );
								if( pWormon )
									pWormon->Delete();
*/
								CPoint		point;
								D3DXVECTOR3 vPos;
								point  = rect.CenterPoint();
								vPos.x = (float)( point.x );
								vPos.z = (float)( point.y );
								vPos.y = 100.0f;
								RemoveAllDynamicObj( pProp->dwWorldId, vPos, 500 );
								
								RemovePartyQuest( pElem->nId );
							}
						}
						break;
					case PQP_GETITEM:
						{
							TRACE( "PQP_GETITEM - p\n" );
							CRect rect;
							rect.SetRect( pProp->x1, pProp->y2, pProp->x2, pProp->y1 );
							BOOL bexist	= FALSE;	// is member here?

							if( pParty )
							{
								CUser* pUser;
								
								for( int k = 0 ; k < pParty->GetSizeofMember() ; k++ )
								{
									u_long idPlayer = pParty->GetPlayerId( k );
									pUser = (CUser*)prj.GetUserByID( idPlayer );
									if( IsValidObj( pUser ) )
									{
										POINT point = { (int)pUser->GetPos().x, (int)pUser->GetPos().z	};
										if( rect.PtInRect( point ) )
										{
											bexist	= TRUE;
											break;
										}
									}
								}

								for( int k = 0 ; k < pParty->GetSizeofMember() ; k++ )
								{
									u_long idPlayer = pParty->GetPlayerId( k );
									pUser = (CUser*)prj.GetUserByID( idPlayer );
									if( IsValidObj( pUser ) )
									{
										POINT point = { (int)pUser->GetPos().x, (int)pUser->GetPos().z	};
										if( !rect.PtInRect( point ) )
										{
											pUser->AddQuestTextTime( 0, 0, 0xffffffff );											
										}
									}
								}
							}

							if( !bexist )
							{
//								if( pParty )
//								{
//									pParty->ReplaceLodestar( rect );
//								}
								CPoint		point;
								D3DXVECTOR3 vPos;
								point  = rect.CenterPoint();
								vPos.x = (float)( point.x );
								vPos.z = (float)( point.y );
								vPos.y = 100.0f;
								RemoveAllDynamicObj( pProp->dwWorldId, vPos, 500 );

								RemovePartyQuest( pElem->nId );
							}
						}
						break;
					default:
						break;
				}
			}
		}
	}
}
Beispiel #5
0
void CPartyMng::Worker( void )
{
	CPlayer* pMember;

	HANDLE hHandle	= m_hCloseWorker;
	while( WaitForSingleObject( hHandle, 1000 ) == WAIT_TIMEOUT )
	{
		CTime timeCurr	= CTime::GetCurrentTime();

		CMclAutoLock	Lock( g_PlayerMng.m_AddRemoveLock );
		CMclAutoLock	Lock2( m_AddRemoveLock );

		for( C2PartyPtr::iterator i	= m_2PartyPtr.begin(); i != m_2PartyPtr.end(); )
		{
			CParty* pParty = (CParty*)i->second;
			++i;
			if( pParty->m_nReferens > 0 )
			{
				for( int j = 1; j < pParty->m_nSizeofMember; j++ )
				{
					if( pParty->m_aMember[j].m_uPlayerId != 0 && pParty->m_aMember[j].m_bRemove )
					{
						if( timeCurr.GetTime() - pParty->m_aMember[j].m_tTime.GetTime() > 60 * 10 )	// 10분 : 60 * 10 // 지금은 1분
						{
							u_long idMember		= pParty->GetPlayerId( j );
							if( pParty->DeleteMember( idMember ) )
							{
								pParty->m_nReferens--;
								
								g_dpCoreSrvr.SendRemoveParty( pParty->m_uPartyId, pParty->m_aMember[0].m_uPlayerId, idMember );
								
								if( pParty->GetSizeofMember() < 2 )
								{
									pMember		= g_PlayerMng.GetPlayer( pParty->GetPlayerId( 0 ) );
									if( pMember )
										pMember->m_uPartyId	= 0;
									DeleteParty( pParty->m_uPartyId );
									break;
								}

								if( pParty->m_nReferens == 0 )
									break;
							}
						}
					}
				}	// for
			}	// if

			// 파티모드를 체크
			for( int j = 0 ; j < MAX_PARTYMODE ; j++ )
			{
				if( pParty->m_nModeTime[j] )
				{
#if __VER >= 12 // __PARSKILL1001	//12차 파스킬 아이템 수정  world,core,neuz
					if( j == PARTY_PARSKILL_MODE)
						continue;
#endif //__PARSKILL1001	//12차 파스킬 아이템 수정  world,core,neuz
					pParty->m_nModeTime[j] -= 1000;
					if( pParty->m_nModeTime[j] <= 0 )
					{
						pParty->m_nModeTime[j] = 0;
						g_dpCoreSrvr.SendSetPartyMode( pParty->m_uPartyId, j, FALSE );
					}
				}
			}
		}	// for
//		TRACE( "Worker Party\n" );
	}
}