Exemple #1
0
void CPartyQuestProcessor::RemoveAllDynamicObj( DWORD dwWorldID, D3DXVECTOR3 vPos, int nRange  )
{
	CWorld* pWorld	= g_WorldMng.GetWorld( dwWorldID );

	if( !pWorld )
		return;

	CObj*		pObj;
	D3DXVECTOR3 vDist;

	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkDynamic, nTempLayer )
	{
		if( pObj )
		{
			if( pObj->GetType() == OT_MOVER && ((CMover *)pObj)->IsPeaceful() == FALSE )
			{
				pObj->Delete();
			}
		}
	}
	END_LINKMAP

	D3DXVECTOR3 vPos2	= D3DXVECTOR3( 6968.0f, 0, 3328.8f );
	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkPlayer, nTempLayer )
	{
		if( pObj )
		{
			CUser* pUser = (CUser*)pObj;
			pUser->AddQuestTextTime( 0, 0, 0xffffffff );			
			( (CUser*)pObj )->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, vPos2, REPLACE_NORMAL, nDefaultLayer );
		}
	}
	END_LINKMAP
}
CWorld* __GetWorld( int nPcId, int nSrcId, int nCaller )
{
	CWorld* pWorld = NULL;
	if( nCaller == WES_DIALOG )
	{
		CUser* pUser = prj.GetUser( nPcId );
		pWorld = pUser->GetWorld();
	}
	else
	if( nCaller == WES_WORLD )
		pWorld = g_WorldMng.GetWorld( nSrcId );

	return pWorld;
}
Exemple #3
0
void CQuiz::CloseQuizEvent()
{
	SetRun( FALSE );
	SetNextTime( 0 );
	SetState( QE_CLOSE );
	m_bSelectLog = FALSE;
	m_nQuizCount = 0;
	Clear();
	RemoveNPC();
	g_dpDBClient.SendQuizEventState( QE_CLOSE, g_uIdofMulti, 0, m_nQuizCount );
	CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
	if( pWorld )
	{
		for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
		{
			if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
				GoOut( static_cast<CUser*>( pWorld->m_apObject[i] ) );
		}
	}
}
Exemple #4
0
void CQuiz::SetNPC()
{
	CMover* pMover	= (CMover*)CreateObj( D3DDEVICE, OT_MOVER, m_sNPC.dwNPCId );
	if( !pMover )
	{
		Error( "CQuiz::SetNPC() - pMover is NULL - %d, %s", m_sNPC.dwNPCId, m_sNPC.strCharKey.c_str() );
		return;
	}
	lstrcpy( pMover->m_szCharacterKey, m_sNPC.strCharKey.c_str() );
	pMover->InitNPCProperty();
	pMover->InitCharacter( pMover->GetCharacter() );
	pMover->SetPos( m_sNPC.vPos );
	pMover->InitMotion( MTI_STAND );
	pMover->UpdateLocalMatrix();
	pMover->AddItToGlobalId();
	m_sNPC.idNpc = pMover->GetId();
	CWorld* pWorld	= g_WorldMng.GetWorld( WI_WORLD_MADRIGAL );
	if( pWorld )
		pWorld->ADDOBJ( pMover, FALSE, nDefaultLayer );
}
Exemple #5
0
// 대기실로 텔레포트(입장시, 대전종료시)
void	CGuildCombat1to1::SetTeleportToWaitStage( CUser* pUser )
{
	int nIndex = g_GuildCombat1to1Mng.GetTenderGuildIndexByUser( pUser );
	if( !g_WorldMng.GetWorld( m_vecTenderGuild[nIndex].dwWorldId ) )
	{
		pUser->AddText( "Not Exist World" );
		return;
	}
	pUser->m_nGuildCombatState = 2; // 관전자 모드
	g_UserMng.AddGuildCombatUserState( pUser );
	
	int nRandx = xRandom(4) - 2;
	int nRandz = xRandom(4) - 2;
	if( m_vecTenderGuild[nIndex].nPosition == 0 )
	{
		pUser->SetAngle( 0 );
		pUser->REPLACE( g_uIdofMulti, m_vecTenderGuild[nIndex].dwWorldId, D3DXVECTOR3( (float)( 256+nRandx ), 90.0f, (float)( 277+nRandz ) ), REPLACE_NORMAL, nDefaultLayer );
	}
	else
	{
		pUser->SetAngle( 180 );
		pUser->REPLACE( g_uIdofMulti, m_vecTenderGuild[nIndex].dwWorldId, D3DXVECTOR3( (float)( 272+nRandx ), 90.0f, (float)( 212+nRandz ) ), REPLACE_NORMAL, nDefaultLayer );
	}
}
Exemple #6
0
void CQuiz::DropOutWrongUser( int nQuizId, int nCorrect, int nItemId, int nItemNum )
{
	int nCorrectUser = 0;
	CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
	if( pWorld )
	{
		for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
		{
			if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
			{
				if( m_bSelectLog )
				{
					int nSelect = GetUserSelectExample( static_cast<CUser*>( pWorld->m_apObject[i] ) );
					if( nSelect )
						g_dpDBClient.SendQuizEventSelect( static_cast<CUser*>( pWorld->m_apObject[i] )->m_idPlayer, g_uIdofMulti, nQuizId, nSelect, nCorrect );
				}
				static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_DROP_OUT ), QE_DROP_OUT );
				if( PtInCorrectZoneRect( static_cast<CUser*>( pWorld->m_apObject[i] ), nCorrect ) )
				{
					++nCorrectUser;
					// 091014 - mirchang : 시스템 부하 발생 가능성이 있어 보류
					//if( nItemId > 0 )	// Item Id가 있을시 정답자에게 해당 아이템 지급
					//	g_dpDBClient.SendPostPrizeItem( static_cast<CUser*>( pWorld->m_apObject[i] )->m_idPlayer, nItemId, nItemNum );
				}
			}
		}
		if( nCorrectUser <= LIMIT_USER_COUNT )
			m_bSelectLog = TRUE;
	}
	// 정답자 수가 2명 이상이고 문제가 남아있으면 문제 풀이 단계로 이동
	if( nCorrectUser > 1 && m_vecQuizList.size() > 1 )
	{
		SetNextTime( GetTickCount() + m_dwWaitTime );
		SetState( QE_QUESTION );
		g_dpDBClient.SendQuizEventState( QE_QUESTION, g_uIdofMulti );
	}
	// 우승자 상금 지급 후 진행 여부 판단
	else
	{
		CString strMessage;
		strMessage.Format( prj.GetText( TID_GAME_QUIZ_WINNERCOUNT ), nCorrectUser );
		if( pWorld )
		{
			for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
			{
				if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
				{
					static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( strMessage, QE_CLOSE_WAIT );
					// 스크립트에 정해진 아이템 지급
					if( PtInCorrectZoneRect( static_cast<CUser*>( pWorld->m_apObject[i] ), nCorrect ) )
						g_dpDBClient.SendPostPrizeItem( static_cast<CUser*>( pWorld->m_apObject[i] )->m_idPlayer, m_dwPrizeItemId, m_nPrizeItemNum );
				}
			}
			g_dpDBClient.SendQuizEventState( QE_WINNER, g_uIdofMulti, nCorrectUser, m_nQuizCount );
		}
		SetState( QE_CLOSE_WAIT );
	}
/*	// 유저 이동 가능 - object
	pWorld->DeleteObj( m_pVObj );
	m_pVObj = NULL;
	if( GetType() == TYPE_4C )
	{
		pWorld->DeleteObj( m_pHObj );
		m_pHObj = NULL;
	}*/
}
Exemple #7
0
void CQuiz::Process()
{
	DWORD dwTick = GetTickCount();
	vector<QUIZLIST>::iterator it = m_vecQuizList.begin();
	
	switch( m_nState )
	{
	case QE_CLOSE:
		// 퀴즈 이벤트 종료. 모든 유저 밖으로 이동
		if( dwTick > GetNextTime() )
			CloseQuizEvent();

		break;

	case QE_OPEN:
		{
			if( dwTick > GetNextTime() )
			{
				if( !m_vecQuizList.size() )
				{
					Error( "Quiz List Load Failed!" );
					CloseQuizEvent();
					return;
				}
				if( (int)( m_vecQuizList.size() ) < m_nQuizSize )
					break;
				BOOL bAble = FALSE;
				int nUser = 0;
				CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
				if( pWorld )
				{
					for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
					{
						if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
						{
							static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_WAIT_QUESTION ) );
							bAble = TRUE;
							++nUser;
						}
					}
				}
				if( !bAble )
				{
					CloseQuizEvent();
					return;
				}

				if( nUser <= LIMIT_USER_COUNT )
					m_bSelectLog = TRUE;

				SetNextTime( dwTick + m_dwWaitTime );
				SetState( QE_QUESTION );
				g_dpDBClient.SendQuizEventState( QE_QUESTION, g_uIdofMulti );
			}
		}
		
		break;

	case QE_QUESTION:
		// 문제 출제
		if( dwTick > GetNextTime() )
		{
			// UI
			CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
			if( pWorld )
			{
				for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
				{
					if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
					{
						static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_QUESTION ), QE_QUESTION );
						static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizQuestion( GetType(), it->strQuestion, m_dwQuestionTime / SEC(1) );
					}
				}
			}

			SetNextTime( dwTick + m_dwQuestionTime );
			SetState( QE_CORRECT_ANSWER );
			g_dpDBClient.SendQuizEventState( QE_CORRECT_ANSWER, g_uIdofMulti );
			++m_nQuizCount;
		}
		
		break;
		
	case QE_CORRECT_ANSWER:
		// 정답 공개
		if( dwTick > GetNextTime() )
		{
/*			// 유저 이동 불가 - object
			DWORD dwId	= NULL;
			
			if( GetType() == TYPE_OX )
				dwId = 1116;
			else
				dwId = 1115;
			
			m_pVObj = CreateObj( D3DDEVICE, OT_OBJ, dwId );
			if( !m_pVObj )
				return;
			
			m_pVObj->SetPos( m_sQuizData.vQuizZonePos );
			m_pVObj->UpdateLocalMatrix();
			CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
			if( pWorld )
				pWorld->ADDOBJ( m_pVObj, TRUE, nDefaultLayer );
			
			if( GetType() == TYPE_4C )
			{
				m_pHObj = CreateObj( D3DDEVICE, OT_OBJ, dwId );
				if( !m_pHObj )
					return;
				
				m_pHObj->SetPos( m_sQuizData.vQuizZonePos );
				m_pHObj->SetAngle( 90 );
				m_pHObj->UpdateLocalMatrix();
				CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
				if( pWorld )
					pWorld->ADDOBJ( m_pHObj, TRUE, nDefaultLayer );
			}*/

			// 문제 풀이 종료 메세지
			CString str_Message;
			str_Message.Format( prj.GetText( TID_GAME_QUIZ_END_SOLVE_QUESTION ), m_nQuizCount );

			// 정답 메세지
			CString strMessage;
			if( GetType() == TYPE_OX )
			{
				if( it->nCorrect == 1 )
					strMessage.Format( prj.GetText( TID_GAME_QUIZ_CORRECT_ANSWER_OX ), 'O' );
				else
					strMessage.Format( prj.GetText( TID_GAME_QUIZ_CORRECT_ANSWER_OX ), 'X' );
			}
			else if( GetType() == TYPE_4C )
				strMessage.Format( prj.GetText( TID_GAME_QUIZ_CORRECT_ANSWER_4C ), it->nCorrect );

			D3DXVECTOR3 vPos = m_sQuizData.aExamplePos[(*it).nCorrect - 1];
			g_UserMng.AddWorldCreateSfxObj( XI_QUIZCORRECTANSWER, vPos.x, vPos.y, vPos.z, FALSE, WI_WORLD_QUIZ );
			
			CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
			if( pWorld )
			{
				for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
				{
					if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
					{
						static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( str_Message, QE_CORRECT_ANSWER );
						static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( strMessage );
					}
				}
			}

			SetNextTime( dwTick + m_dwWaitTime );
			SetState( QE_DROP_OUT );
			g_dpDBClient.SendQuizEventState( QE_DROP_OUT, g_uIdofMulti );
		}
		
		break;
		
	case QE_DROP_OUT:
		if( dwTick > GetNextTime() )
		{
			// 탈락자 대기존으로 이동
			DropOutWrongUser( (*it).nQuizId, (*it).nCorrect );
			m_vecQuizList.erase( it );
		}
		
		break;
		
	case QE_CLOSE_WAIT:
		{
			// 문제가 요구치 보다 많이 남아있을 시 대기존 개방
			if( m_vecQuizList.size() > REMAIN_QUIZ )
			{
				CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
				if( pWorld )
				{
					for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
					{
						if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
						{
							static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_WATCHINGZONE_OPEN ), QE_WATCHINGZONE_OPEN );
							static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_TELEPORT_QUIZZONE ) );
						}
					}
				}
				
				SetNextTime( dwTick + m_dwWatchingZoneOpenTime );
				SetState( QE_WATCHINGZONE_OPEN );
				m_bSelectLog = FALSE;
				m_nQuizCount = 0;
				g_dpDBClient.SendQuizEventState( QE_WATCHINGZONE_OPEN, g_uIdofMulti );
			}
			// 문제가 요구치 보다 적을 시 퀴즈 이벤트 종료
			else
			{
				g_DPCoreClient.SendQuizSystemMessage( TID_GAME_QUIZ_CLOSING, TRUE, g_uIdofMulti );
				SetNextTime( dwTick + m_dwCloseWaitTime );
				SetState( QE_CLOSE );
				g_dpDBClient.SendQuizEventState( QE_CLOSE_WAIT, g_uIdofMulti );
			}
		}
		
		break;

	case QE_WATCHINGZONE_OPEN:
		// 대기존 개방
		if( dwTick > GetNextTime() )
		{
			BOOL bAble = FALSE;
			int nUser = 0;
			CWorld* pWorld = g_WorldMng.GetWorld( WI_WORLD_QUIZ );
			if( pWorld )
			{
				for( DWORD i = 0; i < pWorld->m_dwObjNum; ++i )
				{
					if( IsInQuizEventPlayer( pWorld, nDefaultLayer, i ) )
					{
						static_cast<CUser*>( pWorld->m_apObject[i] )->AddQuizEventMessage( prj.GetText( TID_GAME_QUIZ_WAIT_QUESTION ) );
						//if( static_cast<CUser*>( pWorld->m_apObject[i] )->IsAuthHigher( AUTH_GAMEMASTER ) == FALSE )
						if( GetZoneType( static_cast<CMover*>( pWorld->m_apObject[i] ) ) == ZONE_QUIZ )
						{
							bAble = TRUE;
							++nUser;
						}
					}
				}
			}
			if( bAble )
			{
				SetNextTime( dwTick + m_dwWaitTime );
				SetState( QE_QUESTION );
				if( nUser <= LIMIT_USER_COUNT )
					m_bSelectLog = TRUE;
			}
			else
			{
				CloseQuizEvent();
				return;
			}
		}

		break;
	}
}