int CQuiz::TeleportToQuizEvent( CUser* pUser, int nZone ) { if( !IsValidObj( pUser ) ) return TID_GAME_QUIZ_DO_NOT_TELEPORT; if( ZONE_1 <= nZone && nZone <= ZONE_4 ) { if( GetState() == QE_DROP_OUT || GetZoneType( (CMover*)pUser ) == ZONE_WATCHING ) return TID_GAME_QUIZ_DO_NOT_TELEPORT; } if( nZone == ZONE_QUIZ ) { if( GetState() != QE_OPEN && GetState() != QE_WATCHINGZONE_OPEN ) return TID_GAME_QUIZ_DO_NOT_TELEPORT; } if( nZone == ZONE_EXIT ) { GoOut( pUser ); return 0; } D3DXVECTOR3 vPos = GetTeleportPos( nZone ); if( vPos == D3DXVECTOR3( 0, 0, 0 ) ) return TID_GAME_QUIZ_DO_NOT_TELEPORT; int nRandx = xRandom(4) - 2; int nRandz = xRandom(4) - 2; vPos += D3DXVECTOR3( (float)( nRandx ), (float)( 0 ), (float)( nRandz ) ); pUser->REPLACE( g_uIdofMulti, WI_WORLD_QUIZ, vPos, REPLACE_NORMAL, nDefaultLayer ); return 0; }
D3DXVECTOR3 CQuiz::GetTeleportPos( int nZone ) { switch( nZone ) { case ZONE_QUIZ: { int nRand = 0; if( GetType() == TYPE_OX ) nRand = xRandom(2); else nRand = xRandom(4); return m_sQuizData.aExamplePos[nRand]; } case ZONE_1: return m_sQuizData.aExamplePos[0]; case ZONE_2: return m_sQuizData.aExamplePos[1]; case ZONE_3: return m_sQuizData.aExamplePos[2]; case ZONE_4: return m_sQuizData.aExamplePos[3]; case ZONE_WATCHING: return m_sQuizData.vWatchingZonePos; default: return D3DXVECTOR3( 0, 0, 0 ); } }
void CAIMonster2::OnBeginState( int nInput, DWORD dwParam1, DWORD dwParam2 ) { CMover* pMover = GetMover(); switch( GetState() ) { case AI2_MOVE: { D3DXVECTOR3 vPos = m_vPosBegin; int x = xRandom( 20 ); int z = xRandom( 20 ); vPos.x += (float)(x - 10); vPos.z += (float)(z - 10); MoveToDst( vPos ); // y는 어떻게 되나? } break; case AI2_IDLE: //m_dwReattack = GetTickCount() + xRandom( 0, 2000 ); m_dwReattack = GetTickCount() + 2000; m_idTarget = NULL_ID; m_vTarget.x = m_vTarget.y = m_vTarget.z = 0.0f; pMover->SetStop(); MoveToDst( pMover->GetPos() ); break; case AI2_ATTACK: if( BeginAttack() == FALSE ) // 공격 SendAIMsg( AIMSG_END_MELEEATTACK, 0, 0 ); // 실패할 경우 공격완료 메세지는 오지 않는다. break; case AI2_TRACKING: if( m_idTarget == NULL_ID ) { m_idTarget = m_idLastAttacker; ASSERT( m_idTarget != NULL_ID ); } #ifdef __TRAFIC_1222 if( pMover->GetDestId() == m_idTarget ) break; #endif // __TRAFIC_1222 // 이동할 목표물을 idTarget으로 설정. pMover->SetDestObj( m_idTarget, m_fAttackRange ); g_UserMng.AddMoverSetDestObj( pMover, m_idTarget, m_fAttackRange ); break; case AI2_SEARCH: break; } }
// mulcom BEGIN100405 각성 보호의 두루마리 //short CRandomOptionProperty::DetermineRandomOptionAdj( RANDOM_OPTION* pRandomOption ) short CRandomOptionProperty::DetermineRandomOptionAdj( RANDOM_OPTION* pRandomOption, bool bDecreaseAdj /* = false */ ) // mulcom END100405 각성 보호의 두루마리 { ASSERT( pRandomOption ); DWORD dwRand = xRandom( 1000000000 ); // 0 - 9999999 for( DWORD i = 0; i < pRandomOption->aAdjData.size(); i++ ) { AdjData ad = pRandomOption->aAdjData[i]; if( dwRand < ad.dwProb ) { // mulcom BEGIN100405 //return ad.nAdj; if( bDecreaseAdj == true && i > 0 ) { return ( pRandomOption->aAdjData[i-1].nAdj ); } else { return ad.nAdj; } // mulcom END100405 } } Error( "CRandomOptionProperty.DetermineRandomOptionAdj: 0" ); return 0; }
// 1:1길드대전 오픈시 각 대전장 생성 void CGuildCombat1to1Mng::CreateGuildCombat1to1() { multimap<int, int> mapRandom; int i = 0; for( i=0; i<(int)( m_vecTenderGuild.size() ); i++ ) { mapRandom.insert( make_pair( xRandom(m_vecTenderGuild.size()), i/2 ) ); } i = 0; for( multimap<int, int>::iterator it=mapRandom.begin(); it!=mapRandom.end(); it++ ) { m_vecTenderGuild[i].nStageId = it->second; // 각 대전장의 WorldID를 저장 m_vecTenderGuild[i].dwWorldId = WI_WORLD_GUILDWAR1TO1_0 + it->second; i++; } m_vecGuilCombat1to1.clear(); for( i=0; i<(int)( m_vecTenderGuild.size()/2 ); i++ ) { CGuildCombat1to1 GuildCombat1to1( m_vecTenderGuild, i ); m_vecGuilCombat1to1.push_back( GuildCombat1to1 ); } }
CNpcProperty::CNpcProperty() { m_dwTick = ::GetTickCount() + MIN( 1 ) + xRandom( SEC( 30 ) ); #if defined(__REMOVE_SCIRPT_060712) m_szName[0] = '\0'; #endif }
int CRandomOptionProperty::DetermineRandomOptionSize( int nRandomOptionKind ) { int nUpper = m_anRandomOptionProb[nRandomOptionKind][MAX_RANDOM_OPTION - 1]; DWORD dwRand = xRandom( nUpper ); for( int i = 0; i < MAX_RANDOM_OPTION; i++ ) { if( (int)( dwRand ) < m_anRandomOptionProb[nRandomOptionKind][i] ) return i + 1; } return 0; }
DWORD CCollectingProperty::GetItem( void ) { // DWORD dwRand = xRandom( 10000 ); // 0 ~ 9999 DWORD dwRand = xRandom( 1000000000 ); // 0 ~ 999999999 for( int i = 0; i < (int)( m_aItem.size() ); i++ ) { COLLECTING_ITEM item = m_aItem[i]; if( dwRand < item.dwProb ) return item.dwItemId; } return 0; }
CCommonCtrl::CCommonCtrl() { m_dwType = OT_CTRL; ///////////////////////////////////////////////////////////////////////////////////////// ZeroMemory( &m_CtrlElem, sizeof( m_CtrlElem ) ); ///////////////////////////////////////////////////////////////////////////////////////// /* m_CtrlElem.m_dwMinItemNum = 1; //-최소 발생 아이템 수 m_CtrlElem.m_dwMaxiItemNum = 3; //-최대 발생 아이템 수 m_CtrlElem.m_dwInsideItemKind[0] = II_WEA_SWO_FLOWER; m_CtrlElem.m_dwInsideItemPer [0] = 1500000000; m_CtrlElem.m_dwInsideItemKind[1] = II_WEA_CHEE_ZANNE; m_CtrlElem.m_dwInsideItemPer [1] = 1500000000; m_CtrlElem.m_dwInsideItemKind[2] = II_WEA_WAN_BLUEBOW; m_CtrlElem.m_dwInsideItemPer [2] = 1500000000; m_CtrlElem.m_dwInsideItemKind[3] = II_ARM_ARM_SHI_FURY; m_CtrlElem.m_dwInsideItemPer [3] = 1500000000; m_CtrlElem.m_dwMonResKind [0] = MI_DEMIAN2; m_CtrlElem.m_dwMonResNum [0] = 0; m_CtrlElem.m_dwMonActAttack[0] = 0; m_CtrlElem.m_dwMonResKind [1] = MI_BURUDENG2; m_CtrlElem.m_dwMonResNum [1] = 0; m_CtrlElem.m_dwMonActAttack[1] = 0; m_CtrlElem.m_dwMonResKind [2] = MI_MIA2; m_CtrlElem.m_dwMonResNum [2] = 0; m_CtrlElem.m_dwMonActAttack[2] = 0; m_CtrlElem.m_dwTrapOperType = xRandom(2); m_CtrlElem.m_dwTrapRandomPer = 2000000000; m_CtrlElem.m_dwTrapDelay = 1000; m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNSINGLE; //m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNGROUP; m_CtrlElem.m_dwTrapLevel[0] = 3; m_CtrlElem.m_dwTrapKind [1] = SI_GEN_FLASH; //m_CtrlElem.m_dwTrapKind [0] = SI_GEN_STUNGROUP; m_CtrlElem.m_dwTrapLevel[1] = 3; #ifdef __Y_EXPBOX m_CtrlElem.m_dwExp = 0; m_CtrlElem.m_idPlayer = NULL_ID; #endif //__Y_EXPBOX */ ///////////////////////////////////////////////////////////////////////////////////////// SetAngle( (float)( xRandom(360) ) ); Init(); }
void CreateFlyParticle( CMover *pMover, float fAngX, int nType ) { FLOAT fAngXZ, fAngH, fDist, fSpeed; D3DXVECTOR3 vVel; D3DXVECTOR3 vPos = pMover->GetPos(); if( nType == 0 ) vPos.y += 0.8f; fAngXZ = pMover->GetAngle(); fAngXZ += 180.0f; fAngXZ = D3DXToRadian( fAngXZ ); vPos.x += (xRandom(100) / 100.0f) - 0.50f; vPos.y += (xRandom(100) / 100.0f) - 0.50f; vPos.z += (xRandom(100) / 100.0f) - 0.50f; for( int i = 0; i < 2; i ++ ) { fAngXZ = (float)(-45.0f + xRandomF(90)); fAngXZ += pMover->GetAngle(); fAngXZ += 180.0f; fAngXZ = D3DXToRadian( fAngXZ ); fAngH = (float)(fAngX + xRandomF(10)); fAngH = D3DXToRadian( fAngH ); fSpeed = xRandomF(0.02f); fDist = cosf(-fAngH) * fSpeed; vVel.x = sinf(fAngXZ) * fDist; vVel.z = -cosf(fAngXZ) * fDist; vVel.y = -sinf(-fAngH) * fSpeed; if( nType == 1 ) // 근두운용. g_ParticleMng.CreateParticle( 10 + xRandom(3), vPos, vVel, CMover::GetActiveMover()->GetPos().y + 0.5f ); else g_ParticleMng.CreateParticle( 2 + xRandom(3), vPos, vVel, CMover::GetActiveMover()->GetPos().y + 0.5f ); } }
RANDOM_OPTION* CRandomOptionProperty::DetermineRandomOptionDst( int nRandomOptionKind, int nParts ) { int iRandomOptionKindIndex = GetRandomOptionKindIndex( nRandomOptionKind, nParts ); DWORD dwRand = xRandom( GetUpperProbability( iRandomOptionKindIndex ) ); for( DWORD i = 0; i < m_aRandomOption[iRandomOptionKindIndex].size(); i++ ) { RANDOM_OPTION* pRandomOption = &m_aRandomOption[iRandomOptionKindIndex][i]; if( (int)( dwRand ) < pRandomOption->nProb ) { return pRandomOption; } } return NULL; }
XSkillDat* XESkillMng::FindByRandomActive( void ) { int size = m_listSkillDat.size(); int select = xRandom(size); int i = 0; XArrayLinearN<XSkillDat*, 1024> ary; for( auto pSkillDat : m_listSkillDat ) { if( pSkillDat->IsActiveCategory() ) ary.Add( pSkillDat ); } return ary.GetFromRandom(); }
// 대기실로 텔레포트(입장시, 대전종료시) 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 ); } }
// mulcom BEGIN100405 각성 보호의 두루마리 //BOOL CRandomOptionProperty::GenRandomOption( __int64* pnRandomOptItemId, int nRandomOptionKind, int nParts ) BOOL CRandomOptionProperty::GenRandomOption( __int64* pnRandomOptItemId, int nRandomOptionKind, int nParts, bool bDecreaseFlag /* = false */ ) // mulcom END100405 각성 보호의 두루마리 { if( GetRandomOptionSize( *pnRandomOptItemId ) > 0 ) { return FALSE; } int nRandomOptionSize = DetermineRandomOptionSize( nRandomOptionKind ); // mulcom BEGIN100405 각성 보호의 두루마리 int nDecreaseNumber = -1; if( bDecreaseFlag == true ) { nDecreaseNumber = xRandom( nRandomOptionSize ); } // mulcom END100405 각성 보호의 두루마리 while( nRandomOptionSize-- > 0 ) { RANDOM_OPTION* pRandomOption = DetermineRandomOptionDst( nRandomOptionKind, nParts ); ASSERT( pRandomOption ); // mulcom BEGIN100405 각성 보호의 두루마리 //short nAdj = DetermineRandomOptionAdj( pRandomOption ); bool bDecreaseAdj = false; if( nRandomOptionSize == nDecreaseNumber ) { bDecreaseAdj = true; } else { bDecreaseAdj = false; } short nAdj = DetermineRandomOptionAdj( pRandomOption, bDecreaseAdj ); // mulcom END100405 각성 보호의 두루마리 SetParam( pnRandomOptItemId, pRandomOption->nDst, nAdj ); } return TRUE; }
DWORD CCreateMonster::GetCreateMonster(DWORD dwItemId) { int nMax = 0; int nRandom = xRandom( 100 ); map<DWORD, vector<__MONSTERPERSENT> >::iterator i = pMonsterItem.find( dwItemId ); if( i != pMonsterItem.end() ) { vector<__MONSTERPERSENT> OneItem = i->second; for( vector<__MONSTERPERSENT>::iterator itv = OneItem.begin() ; itv != OneItem.end() ; ++itv ) { int nPersent = ((__MONSTERPERSENT)*itv).nPersent; nMax += nPersent; if( nRandom <= nMax ) return ((__MONSTERPERSENT)*itv).dwMonsterId; } } return 0; }
BOOL CMiniGameGawibawibo::Excute( CUser* pUser, __MINIGAME_PACKET* pMiniGamePacket ) { BOOL bReturn = FALSE; // 미니게임 완료 상태 __MINIGAME_PACKET MP( pMiniGamePacket->wNowGame ); if( pMiniGamePacket->nState == MP_OPENWND ) { MP.nState = MP_OPENWND; m_nWinCount = 0; // 창을 새로 열면 연승 초기화.. MP.nParam1 = m_nWinCount; SendPacket( pUser, MP ); return bReturn; } int nRandom = xRandom( 100 ); if( nRandom < m_nWinProb ) { MP.nState = MP_TRUE; m_nWinCount++; // 연승 추가 } else if( nRandom < m_nWinProb + m_nDrawProb ) MP.nState = MP_FALSE; else { MP.nState = MP_FAIL; m_nWinCount = 0; // 연승 초기화 } MP.nParam1 = m_nWinCount; if( m_nWinCount == 3 ) // 3연승이면 완료... { MP.nState = MP_FINISH; bReturn = TRUE; } SendPacket( pUser, MP ); return bReturn; }
u_long CArena::GetPointMultiplierFactor( void ) { return( xRandom( Arena::Point::nMultiplierFirst, Arena::Point::nMultiplierSecond ) ); }
BOOL CAIMonster2::SelectTarget() { CMover *pMover = GetMover(); CWorld *pWorld = GetWorld(); int nAttackFirstRange = pMover->GetProp()->m_nAttackFirstRange; FLOAT fRadius = pMover->GetRadiusXZ(); // this의 반지름 FLOAT fRadiusSq = fRadius * fRadius; // 반지름Sq버전. CMover *pLastAttacker = prj.GetMover( m_idLastAttacker ); if( IsValidObj( pLastAttacker ) && pLastAttacker->IsDie() ) { m_idLastAttacker = NULL_ID; pLastAttacker = NULL; } if( pLastAttacker == NULL ) // LastAttacker가 없어졌으면 타겟 다시 잡을 수 있도록 하자. { m_idLastAttacker = NULL_ID; } else { D3DXVECTOR3 vDist = pLastAttacker->GetPos() - pMover->GetPos(); FLOAT fDistSq = D3DXVec3LengthSq( &vDist ); // 목표지점까지의 거리. if( fDistSq >= fRadiusSq * 10.0f ) // 라스트어태커가 내 반지름의 10배이상 떨어져있으면 { // 타겟 포기 m_idLastAttacker = NULL_ID; pLastAttacker = NULL; } } m_idTarget = NULL_ID; m_vTarget.x = m_vTarget.y = m_vTarget.z = 0; // 일단 이건 안쓰는걸로 하자. if( m_idLastAttacker == NULL_ID ) // 아직 날 때린쉐리가 없다. { CMover* pTarget = NULL; pTarget = ScanTarget( pMover, nAttackFirstRange, JOB_ALL ); if( pTarget ) { if( pMover->IsFlyingNPC() == pTarget->m_pActMover->IsFly() ) // 위상이 같으면 OK m_idTarget = pTarget->GetId(); else return FALSE; } else return FALSE; } else { // 날 때린 쉐리가 있다. DWORD dwNum = xRandom( 100 ); // 0 ~ 99까지으 난수. DWORD dwAggroRate = 50; if( IsValidObj( pLastAttacker ) ) { if( pLastAttacker->GetJob() == JOB_MERCENARY ) // 마지막으로 날때린 쉐리가 머서면 어그로 좀더 주자. dwAggroRate = 70; } if( dwNum < dwAggroRate ) { // dwAggroRate% 확률로 마지막으로 날 때린넘 공격. m_idTarget = m_idLastAttacker; // 날 공격한 쉐리를 타겟으로 지정하자. } else if( dwNum < 75 ) { // 50미터 반경내에서 가장 쎈넘을 잡자. CMover *pTarget = ScanTargetStrong( pMover, (float)( nAttackFirstRange ) ); if( pTarget ) { // this가 비행형 몬스터거나 || 타겟이 비행중이 아닐때만 공격. if( pMover->IsFlyingNPC() == pTarget->m_pActMover->IsFly() ) m_idTarget = pTarget->GetId(); else m_idTarget = m_idLastAttacker; // 타겟이 공격하기가 여의치 않으면 마지막으로 때린쉐리 공격하자. } else m_idTarget = m_idLastAttacker; // 타겟이 공격하기가 여의치 않으면 마지막으로 때린쉐리 공격하자. } else if( dwNum < 100 ) { // 오버힐하는 어시를 죽이자. CMover *pTarget = ScanTargetOverHealer( pMover, (float)( nAttackFirstRange ) ); if( pTarget ) { // this가 비행형 몬스터거나 || 타겟이 비행중이 아닐때만 공격. if( pMover->IsFlyingNPC() == pTarget->m_pActMover->IsFly() ) m_idTarget = pTarget->GetId(); else m_idTarget = m_idLastAttacker; // 타겟이 공격하기가 여의치 않으면 마지막으로 때린쉐리 공격하자. } else m_idTarget = m_idLastAttacker; // 타겟이 공격하기가 여의치 않으면 마지막으로 때린쉐리 공격하자. } } return TRUE; }
void CNpcProperty::ResetTimer() { m_dwTick = ::GetTickCount() + SEC( 15 ) + SEC( xRandom( 10 ) ); }
// 공격 대상을 찾아서 m_idTarget에 세팅한다. BOOL CAIMonster2::Search() { CMover *pMover = GetMover(); CWorld *pWorld = GetWorld(); CModelObject *pModel = (CModelObject *)pMover->GetModel(); FLOAT fRadius = pMover->GetRadiusXZ(); // this의 반지름 FLOAT fRadiusSq = fRadius * fRadius; // 반지름Sq버전. if( m_idTarget == NULL_ID && // 공격대상이 정해지지 않았고 (m_vTarget.x == 0 && m_vTarget.y == 0 && m_vTarget.z == 0) ) // 공격위치도 정해지지 않았다. { // 어떤 쉐리를 공격할까....? 를 선정함. if( SelectTarget() == FALSE ) return FALSE; } D3DXVECTOR3 vTarget; FLOAT fDistSq = 0; // 공격지점과 this의 거리. CMover *pTarget = NULL; if( m_idTarget != NULL_ID ) // 타겟오브젝이 있을때 { pTarget = prj.GetMover( m_idTarget ); if( IsValidObj(pTarget) ) vTarget = pTarget->GetPos(); // 공격좌표는 타겟무버의 좌표 else { m_idTarget = NULL_ID; return FALSE; // 타겟이 거시기 하면 걍리턴. } } else if( m_vTarget.x && m_vTarget.y && m_vTarget.z ) // 공격 좌표로 설정되어 있을때. { vTarget = m_vTarget; } else { return FALSE; // 타겟이 거시기 하면 걍리턴. } D3DXVECTOR3 vDist = vTarget - pMover->GetPos(); fDistSq = D3DXVec3LengthSq( &vDist ); // 목표지점까지는 거리. m_fAttackRange = fRadius; // 얼마나 근접해야하는가? 디폴트로 반지름 길이. if( fDistSq < fRadiusSq * 4.0f ) // 근거리면. { DWORD dwNum = xRandom( 100 ); // 0 ~ 99까지으 난수. if( dwNum < 85 ) { if( xRandom( 2 ) ) m_nAttackType = CAT_NORMAL; // 앞발로 밟기. else m_nAttackType = CAT_NORMAL2; m_fAttackRange = 5.0f; // 딱붙어서 밟아야 한다. ?? } else { m_nAttackType = CAT_QUAKEDOUBLE; // 두손으로 내려치기 - 스턴 } } else if( fDistSq < fRadiusSq * 6.0f ) // 반지름의 x배 이하는 쏘기. { DWORD dwNum = xRandom( 100 ); // 0 ~ 99까지으 난수. // 반지름 3배거리 이상이면 원거리. if( dwNum < 60 ) { m_nAttackType = CAT_QUAKE_ONE; // 하늘에서 돌 떨어뜨리기 m_fAttackRange = 15.0f; // xx미터 까지 접근하자. ?? } else { m_idTarget = NULL_ID; return FALSE; } } else { m_nAttackType = CAT_NORMAL; // 앞발로 밟기. m_fAttackRange = fRadius; //10.0f; } return TRUE; }
void CWndInfoNotice::OnInitialUpdate() { CWndNeuz::OnInitialUpdate(); // 여기에 코딩하세요 CWndButton* pWndCheck = (CWndButton*)GetDlgItem( WIDC_CHECK1 ); pWndCheck->SetCheck( !g_Option.m_bNotice ); CWndText* pWndText = (CWndText*)GetDlgItem( WIDC_TEXT1 ); #ifdef __YNOTICE_UNI1026 CString strnotice; strnotice = GetLangFileName( ::GetLanguage(), FILE_NOTICE ); CScript scanner; if( scanner.Load( "Client\\"+strnotice ) == FALSE ) return; pWndText->m_string.AddParsingString( scanner.m_pProg ); pWndText->ResetString(); #else //__YNOTICE_UNI1026 CFileStatus fileStatus; CString strnotice; strnotice = GetLangFileName( ::GetLanguage(), FILE_NOTICE ); if( CFile::GetStatus( "Client\\"+strnotice, fileStatus ) == TRUE ) { if( g_Option.m_tNoticeTime != fileStatus.m_mtime.GetTime() ) g_Option.m_tNoticeTime = static_cast< time_t >( fileStatus.m_mtime.GetTime() ); CFileIO file; strnotice = GetLangFileName( ::GetLanguage(), FILE_NOTICE ); if(::GetLanguage() == LANG_VTN) { if( file.Open( "Client\\"+strnotice, "rb" ) ) { int nLength = file.GetLength(); TCHAR* pChar = new TCHAR[ nLength + 2 ]; file.Read( pChar, nLength ); *(pChar + nLength ) = '\0'; *(pChar + nLength + 1 ) = '\0'; char* lpMultiByte = new char[ nLength + 2 ]; int nResult = WideCharToMultiByteEx( g_codePage, 0, (LPWSTR)(pChar+2), -1, lpMultiByte, nLength, NULL, NULL ); if( nResult > 0 ) { lpMultiByte[nResult-1] = 0; pWndText->m_string.AddParsingString( lpMultiByte ); pWndText->ResetString(); } safe_delete_array(pChar); safe_delete_array(lpMultiByte); } } else { if( file.Open( "Client\\"+strnotice, "rb" ) ) { int nLength = file.GetLength(); TCHAR* pChar = new TCHAR[ nLength + 1]; file.Read( pChar, nLength ); pChar[ nLength ] = 0; //pWndText->SetString( pChar ); pWndText->m_string.AddParsingString( pChar ); pWndText->ResetString(); safe_delete( pChar ); } } } #endif //__YNOTICE_UNI1026 // 윈도를 중앙으로 옮기는 부분. CRect rectRoot = m_pWndRoot->GetLayoutRect(); CRect rectWindow = GetWindowRect(); CPoint point( rectRoot.right - rectWindow.Width(), 110 ); Move( point ); MoveParentCenter(); ///////////////////////////////////////////////////////////////////////////////////////// int nCount = 0; CScript script; if( script.Load(MakePath(DIR_THEME, "TexBannerList.inc" )) ) { int nLang; nLang = script.GetNumber(); do { if( nLang == ::GetLanguage() ) { script.GetToken(); nCount = atoi( script.token ); script.GetToken(); for( int i=0; i<nCount; i++ ) { CString addStr = script.token; m_vecStrBanner.push_back( addStr ); script.GetToken(); } if( nCount <= 0 ) { Error( "TexBannerList.inc의 갯수가 0이다" ); return; } break; } else script.GetLastFull(); nLang = script.GetNumber(); } while( script.tok != FINISHED ); } SAFE_DELETE( m_atexPannel ); if( nCount > 0 ) { m_atexPannel = new IMAGE; LoadImage( MakePath( DIR_THEME, m_vecStrBanner[xRandom(nCount)] ), m_atexPannel ); AdjustWndBase(); } ///////////////////////////////////////////////////////////////////////////////////////// }
BOOL vMover::SubPK( vMover* pAttacker, int nReflect ) { if(!IsPlayer()) return TRUE; if( !g_gameEvent.GetState(EVE_PK) || GetWorld()->IsArena() || !g_pEventArena.IsActive() || ( GetWorld()->GetId() == WI_WORLD_GUILDWAR || pAttacker->GetWorld()->GetId() == WI_WORLD_GUILDWAR ) && g_pGuildCombatMng.GetState() != vGuildCombatManager::CLOSE_STATE || g_pGuildCombat1to1Mng.IsPossibleUser((vUser*)this) && g_pGuildCombat1to1Mng.IsPossibleUser((vUser*)pAttacker) ) return TRUE; if(g_gameEvent.GetState( EVE_PKCOST )) { if( IsPlayer() && IsChaotic()) { CHAO_PROPENSITY Propensity = g_prj.GetPropensityPenalty( GetPKPropensity() ); int nInvenDrop = xRandom(Propensity.nInvenDorpMin, Propensity.nInvenDorpMax); for(int i = 0; i < nInvenDrop; i++ ) { if( DoDropItemRandom( TRUE, pAttacker ) == 0 ) break; } int nEquipDrop = xRandom( Propensity.nEquipDorpMin, Propensity.nEquipDorpMax + 1 ); for( int i = 0; i < nEquipDrop; ++i ) { if( DoDropItemRandom( FALSE, pAttacker, TRUE ) == 0 ) break; } } if( pAttacker->IsPlayer() ) { m_idMurderer = pAttacker->GetId(); vWorld* pWorld = GetWorld(); if( pWorld ) { char szFormat[256]; strcpy_s( szFormat, pAttacker->GetName() ); // strcat_s( szFormat, g_prj.GetText( TID_PK_REWARDNOTICE ) ); // ((vUser*)this)->AddDefinedText( TID_GAME_PKDEAD ); g_pClient.SendWCWantedReward( GetId(), pAttacker->GetId(), szFormat, pWorld->GetId(), GetPos(), GetLayer() ); } } } Log( LOG_SUCCESS, ">> mue %d", m_idMurderer ); if( !pAttacker->IsPlayer() || IsNPC() ) return TRUE; bool bAdd = false; if( pAttacker->IsChaotic() ) { if( !IsChaotic() ) bAdd = true; } else { if( !(IsChaotic() || IsPKPink()) ) bAdd = true; } // if( bAdd && nReflect == 0 && pAttacker != this ) // { // if( IsPlayer() && pAttacker->IsPlayer() ) // { // if( !pAttacker->IsChaotic() ) // ((vUser*)pAttacker)->AddPlaySound( SND_PC_CHAOS ); // // char szBuff[64] = {0}; // // sprintf_s( szBuff, g_prj.GetText(TID_GAME_PK_DEFENDER), pAttacker->GetName() ); // ((vUser*)this)->AddText( szBuff ); // sprintf_s( szBuff, g_prj.GetText(TID_GAME_PK_ATTACKER) , GetName() ); // ((vUser*)pAttacker)->AddText( szBuff ); // } // // pAttacker->SetPKValue( pAttacker->GetPKValue() + 1 ); // ((vUser*)pAttacker)->AddPKValue(); // pAttacker->SetPKPropensity( pAttacker->GetPKPropensity() + NextPKPropensity( pAttacker->GetPKValue() ) ); // g_UserMng.AddPKPropensity( pAttacker ); // g_dpDBClient.SendLogPkPvp( pAttacker, this, 0, 'P' ); // ((vUser*)pAttacker)->SetHonorAdd(HS_PK_COUNT,HI_COUNT_CHECK); // } return TRUE; }
//int __EndQuest( int nPcId, int nQuestId, BOOL IsEndQuestCondition = TRUE ) int __EndQuest( int nPcId, int nQuestId, BOOL IsEndQuestCondition ) { int nNum; QuestProp* pQuestProp = prj.m_aPropQuest.GetAt( nQuestId ); if( pQuestProp ) { CUser* pUser = prj.GetUser( nPcId ); if( IsEndQuestCondition ) { if( __IsEndQuestCondition( pUser, nQuestId ) == 0 ) return FALSE; } // 보상 아이템 갯수 만큼, 인벤토리 여유가 있는가? int nItemNum = 0; for( int i = 0; i < pQuestProp->m_nEndRewardItemNum; i++ ) { QuestPropItem* pEndRewardItem = &pQuestProp->m_paEndRewardItem[ i ]; if( pEndRewardItem->m_nSex == -1 || pEndRewardItem->m_nSex == pUser->GetSex() ) { if( pEndRewardItem->m_nType == 0 ) { if( pEndRewardItem->m_nJobOrItem == -1 || pEndRewardItem->m_nJobOrItem == pUser->GetJob() ) { if( pEndRewardItem->m_nItemIdx ) { ItemProp* pItemProp = prj.GetItemProp( pEndRewardItem->m_nItemIdx ); int nDiv = pEndRewardItem->m_nItemNum / pItemProp->dwPackMax; int nSur = pEndRewardItem->m_nItemNum % pItemProp->dwPackMax; if( nSur ) nDiv++; nItemNum += nDiv; } } } else if( pEndRewardItem->m_nType == 1 ) { if( pEndRewardItem->m_nJobOrItem == -1 || pUser->GetItemNum( pEndRewardItem->m_nJobOrItem ) ) { if( pEndRewardItem->m_nItemIdx ) { ItemProp* pItemProp = prj.GetItemProp( pEndRewardItem->m_nItemIdx ); int nDiv = pEndRewardItem->m_nItemNum / pItemProp->dwPackMax; int nSur = pEndRewardItem->m_nItemNum % pItemProp->dwPackMax; if( nSur ) nDiv++; nItemNum += nDiv; } } } } } if( nItemNum > pUser->m_Inventory.GetEmptyCount() ) { pUser->AddDefinedText( TID_QUEST_NOINVENTORYSPACE ); // 인벤토리 공간이 없어서 퀘스트를 완료할 수 없습니다. RunScriptFunc rsf; rsf.wFuncType = FUNCTYPE_EXIT; pUser->AddRunScriptFunc( rsf ); return FALSE; } //////////////////////////// // 보상 지급 //////////////////////////// for( i = 0; i < pQuestProp->m_nEndRewardItemNum; i++ ) { QuestPropItem* pEndRewardItem = &pQuestProp->m_paEndRewardItem[ i ]; if( pEndRewardItem->m_nSex == -1 || pEndRewardItem->m_nSex == pUser->GetSex() ) { if( pEndRewardItem->m_nType == 0 ) { if( pEndRewardItem->m_nJobOrItem == -1 || pEndRewardItem->m_nJobOrItem == pUser->GetJob() ) { if( pEndRewardItem->m_nItemIdx ) { int nItemNum = pEndRewardItem->m_nItemNum; #ifdef __JEFF_11 #if __VER >= 13 // __CHIPI_QUESTITEM_FLAG __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum, pEndRewardItem->m_nAbilityOption, pEndRewardItem->m_byFlag ); #else // __CHIPI_QUESTITEM_FLAG __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum, pEndRewardItem->m_nAbilityOption ); #endif // __CHIPI_QUESTITEM_FLAG #else // __JEFF_11 __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum ); #endif // __JEFF_11 } } } else if( pEndRewardItem->m_nType == 1 ) { if( pEndRewardItem->m_nJobOrItem == -1 || pUser->GetItemNum( pEndRewardItem->m_nJobOrItem ) ) { if( pEndRewardItem->m_nItemIdx ) { int nItemNum = pEndRewardItem->m_nItemNum; #ifdef __JEFF_11 #if __VER >= 13 // __CHIPI_QUESTITEM_FLAG __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum, pEndRewardItem->m_nAbilityOption, pEndRewardItem->m_byFlag ); #else // __CHIPI_QUESTITEM_FLAG __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum, pEndRewardItem->m_nAbilityOption ); #endif // __CHIPI_QUESTITEM_FLAG #else // __JEFF_11 __CreateItem( nPcId, pEndRewardItem->m_nItemIdx, nItemNum ); #endif // __JEFF_11 } } } } } #if __VER >= 9 // __PET_0410 if( pQuestProp->m_bEndRewardPetLevelup ) pUser->PetLevelup(); #endif // __PET_0410 if( pQuestProp->m_nEndRewardGoldMin ) { nNum = pQuestProp->m_nEndRewardGoldMax - pQuestProp->m_nEndRewardGoldMin + 1; int nGold = pQuestProp->m_nEndRewardGoldMin + xRandom( nNum ); pUser->AddGold( nGold ); pUser->AddGoldText( nGold ); } if( pQuestProp->m_nEndRewardExpMin ) { nNum = pQuestProp->m_nEndRewardExpMax - pQuestProp->m_nEndRewardExpMin + 1; int nExp = pQuestProp->m_nEndRewardExpMin + xRandom( nNum ); if( pUser->AddExperience( nExp, TRUE, FALSE ) ) pUser->LevelUpSetting(); else pUser->ExpUpSetting(); pUser->AddSetExperience( pUser->GetExp1(), (WORD)pUser->m_nLevel, pUser->m_nSkillPoint, pUser->m_nSkillLevel ); pUser->AddDefinedText( TID_GAME_REAPEXP ); } if( pQuestProp->m_nEndRewardSkillPoint ) { pUser->AddSkillPoint( pQuestProp->m_nEndRewardSkillPoint ); pUser->AddSetExperience( pUser->GetExp1(), (WORD)pUser->m_nLevel, pUser->m_nSkillPoint, pUser->m_nSkillLevel ); g_dpDBClient.SendLogSkillPoint( LOG_SKILLPOINT_GET_QUEST, pQuestProp->m_nEndRewardSkillPoint, (CMover*)pUser, NULL ); } #if __VER >= 8 // __S8_PK if( pQuestProp->m_nEndRewardPKValueMin || pQuestProp->m_nEndRewardPKValueMax ) { if( pQuestProp->m_nEndRewardPKValueMin <= pQuestProp->m_nEndRewardPKValueMax ) { int nPKValue = pUser->GetPKValue() - xRandom( pQuestProp->m_nEndRewardPKValueMin, pQuestProp->m_nEndRewardPKValueMax + 1 ); if( nPKValue < 0 ) nPKValue = 0; pUser->SetPKValue( nPKValue ); pUser->AddPKValue(); g_dpDBClient.SendLogPkPvp( (CMover*)pUser, NULL, 0, 'P' ); #if __VER >= 13 // __HONORABLE_TITLE // 달인 pUser->CheckHonorStat(); g_UserMng.AddHonorTitleChange( pUser, pUser->m_nHonor); #endif // __HONORABLE_TITLE // 달인 } } #else // __VER >= 8 // __S8_PK if( pQuestProp->m_nEndRewardKarmaStyle ) { if( pQuestProp->m_nEndRewardKarmaStyle == 1 ) pUser->ChangeSlaughter( CHANGE_SLAUGHTER_SET, NULL, pQuestProp->m_nEndRewardKarmaPoint ); else if( pQuestProp->m_nEndRewardKarmaStyle == 2 ) { int nKarma = pUser->GetKarma(); pUser->ChangeSlaughter( CHANGE_SLAUGHTER_SET, NULL, nKarma + pQuestProp->m_nEndRewardKarmaPoint ); } } #endif // __VER >= 8 // __S8_PK #if __VER >= 9 // __S_9_ADD if( pQuestProp->m_nEndRewardTeleport != 0 ) pUser->REPLACE( g_uIdofMulti, pQuestProp->m_nEndRewardTeleport, pQuestProp->m_nEndRewardTeleportPos, REPLACE_NORMAL, nTempLayer ); #endif // __S_9_ADD // 시작시 변신을 했으면 종료시 변신 해제시킨다. if( pQuestProp->m_nBeginSetDisguiseMoverIndex ) { CUser* pUser = prj.GetUser( nPcId ); pUser->NoDisguise( NULL ); g_UserMng.AddNoDisguise( pUser ); } #if __VER >= 15 // __CAMPUS if( pQuestProp->m_nEndRewardTSP ) g_dpDBClient.SendUpdateCampusPoint( pUser->m_idPlayer, pQuestProp->m_nEndRewardTSP, TRUE, 'Q' ); if( pQuestProp->m_nEndRemoveTSP ) g_dpDBClient.SendUpdateCampusPoint( pUser->m_idPlayer, pQuestProp->m_nEndRemoveTSP, FALSE, 'Q' ); #endif // __CAMPUS //////////////////////////// // 아이템 제거 //////////////////////////// for( i = 0; i < 8; i++ ) { if( pQuestProp->m_nEndRemoveItemIdx[ i ] ) { int nItemNum = pQuestProp->m_nEndRemoveItemNum[ i ]; if( nItemNum > 0x7fff ) // 삭제될 아이템 개수가 short의 MAX를 넘으면.. { for( ; nItemNum > 0x7fff; ) { pUser->RemoveItemA( pQuestProp->m_nEndRemoveItemIdx[ i ], 0x7fff ); nItemNum -= 0x7fff; } } pUser->RemoveItemA( pQuestProp->m_nEndRemoveItemIdx[ i ], nItemNum ); } } if( pQuestProp->m_nEndRemoveGold ) __RemoveGold( nPcId, pQuestProp->m_nEndRemoveGold ); //////////////////////////// // 퀘스트 제거 (완료,진행 모두 제거함) //////////////////////////// for( i = 0; i < MAX_QUESTREMOVE; i++ ) { if( pQuestProp->m_anEndRemoveQuest[ i ] ) { __RemoveQuest( nPcId, pQuestProp->m_anEndRemoveQuest[ i ] ); } } // 퀘스트 종료 __SetQuestState( nPcId, nQuestId, QS_END ); } return 1; }
// 싸이킥 월 void CCommonCtrl::_ProcessWall( void ) { if( m_nCount == 0 ) { #ifdef __CLIENT m_pSfxModel = new CSfxModel; m_pSfxModel2 = new CSfxModel; m_pSfxModel->SetSfx( "sfx_sklpsypsychicwall02" ); m_pSfxModel2->SetSfx( "sfx_sklpsypsychicwall04" ); #endif } D3DXVECTOR3 vPos = GetPos(); #ifndef __CLIENT CObj* pObj; BOOL bApply; #endif //__CLIENT int nRange = 4; // 일반적으로 fDepth가 가장 길기때문에 검사 영역은 fDepth로 했다. float fDepth = 3; if( fDepth <= 4.0f ) nRange = 4; else if( fDepth <= 8.0f ) nRange = 8; else if( fDepth <= 16.0f ) nRange = 16; else nRange = 32; #ifdef __WORLDSERVER CMover *pAttacker = prj.GetMover( m_idAttacker ); if( IsInvalidObj( pAttacker ) ) // 일단 어태커가 사라지면 컨트롤도 사라지게 하자. { DestroyWall(); return; } int nMin = m_pAddSkillProp->dwAbilityMin + (pAttacker->GetLevel() + (pAttacker->GetInt() / 10) * (int)m_pAddSkillProp->dwSkillLvl); int nMax = m_pAddSkillProp->dwAbilityMax + (pAttacker->GetLevel() + (pAttacker->GetInt() / 10) * (int)m_pAddSkillProp->dwSkillLvl); int nDamage = xRandom( nMin, nMax ); #if __VER >= 9 // __SKILL_0706 int nMinPVP = m_pAddSkillProp->dwAbilityMinPVP + ( pAttacker->GetLevel() + ( pAttacker->GetInt() / 10 ) * (int)m_pAddSkillProp->dwSkillLvl ); int nMaxPVP = m_pAddSkillProp->dwAbilityMaxPVP + ( pAttacker->GetLevel() + ( pAttacker->GetInt() / 10 ) * (int)m_pAddSkillProp->dwSkillLvl ); int nDamagePVP = xRandom( nMinPVP, nMaxPVP ); #endif // __SKILL_0706 int nHitPoint = 0; int nTargetHP = 0; FOR_LINKMAP( GetWorld(), vPos, pObj, nRange, CObj::linkDynamic, GetLayer() ) { bApply = FALSE; if( pObj->GetType() == OT_MOVER ) // 대상이 무버일때만. { CMover *pTarget = (CMover *)pObj; if( pTarget->IsPeaceful() == FALSE ) // NPC가 아닌경우만 적용 bApply = TRUE; #if __VER >= 8 // #ifdef __JHMA_VER_8_5_1 // 8.5차 경비병 범위스킬 공격효과 불가로 수정 World if( pAttacker->IsPlayer() && pAttacker->IsChaotic() == FALSE && pTarget->GetProp()->dwClass == RANK_GUARD ) bApply = FALSE; #endif // #endif // __JHMA_VER_8_5_1 // 8.5차 경비병 범위스킬 공격효과 불가로 수정 World if( bApply ) { if( IsValidObj( pTarget ) && pTarget->IsLive() ) { if( pObj->IsRangeObj( vPos, 1.0f ) ) { if( IsValidObj(pAttacker) ) { nTargetHP = pTarget->GetHitPoint(); nHitPoint = nTargetHP - nDamage; if( nHitPoint > 0 ) { pTarget->m_nHitPoint = nHitPoint; g_UserMng.AddDamage( pTarget, pAttacker->GetId(), nDamage, AF_GENERIC ); } else { pAttacker->SubExperience( pTarget ); // pTarget를 죽이고 난후의 m_pAttacker 경험치 처리. pTarget->DropItemByDied( pAttacker ); // 몬스터였다면 아이템 드랍. pAttacker->m_nAtkCnt = 0; // 타겟을 죽였으면 공격자의 어택카운트 클리어 pTarget->DoDie( pAttacker ); // pTarget 죽어라. pTarget->m_nHitPoint = 0; } } m_nLife ++; // 부딪힐때마다 카운트 올라감 if( m_nLife >= (int)(m_pAddSkillProp->dwSkillLvl / 2) ) DestroyWall(); // 뒤로 밀리기 처리. #if __VER >= 10 // __AI_0711 if( pTarget->IsRank( RANK_MIDBOSS ) == FALSE ) #endif // __AI_0711 { FLOAT fPushAngle = pTarget->GetAngle() + 180.0f; FLOAT fPower = 0.825f; AngleToVectorXZ( &pTarget->m_pActMover->m_vDeltaE, fPushAngle, fPower ); g_UserMng.AddPushPower( pTarget, pTarget->GetPos(), pTarget->GetAngle(), fPushAngle, fPower ); } } } } } }