void CWndGuildVote::SelChange(CGuild* pGuild, int nIndex) { GUILD_VOTE_SELECT guildvotesel[4]; CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1); list <CGuildVote*>::iterator it = pGuild->m_votes.begin(); for ( ; it != pGuild->m_votes.end() ; ++it ) { if( (*it)->GetID() == pCombo->GetItemData(nIndex) ) { guildvotesel[0] = (*it)->GetVoteSelect(0); guildvotesel[1] = (*it)->GetVoteSelect(1); guildvotesel[2] = (*it)->GetVoteSelect(2); guildvotesel[3] = (*it)->GetVoteSelect(3); SetQuestion( (*it)->GetQuestion() ); break; } } SetszString( guildvotesel[0].szString, guildvotesel[1].szString, guildvotesel[2].szString, guildvotesel[3].szString ); SetCount( guildvotesel[0].cbCount, guildvotesel[1].cbCount, guildvotesel[2].cbCount, guildvotesel[3].cbCount ); }
BOOL CWndAdminCreateItem::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { ItemProp* pItemProp; CWndListBox* pListBox = (CWndListBox*)GetDlgItem( WIDC_CONTROL1 ); if( nID == WIDC_ITEM_KIND || nID == WIDC_ITEM_SEX || nID == WIDC_ITEM_JOB || nID == WIDC_LEVEL ) { if( message == WNM_SELCHANGE || message == EN_CHANGE ) { DWORD dwLevel = 0; CWndEdit* pWndEdit = (CWndEdit*)GetDlgItem( WIDC_LEVEL ); CString string = pWndEdit->GetString(); dwLevel = atoi( string ); CWndComboBox* pWndItemKind = (CWndComboBox*)GetDlgItem( WIDC_ITEM_KIND ); CWndComboBox* pWndItemSex = (CWndComboBox*)GetDlgItem( WIDC_ITEM_SEX ); CWndComboBox* pWndItemJob = (CWndComboBox*)GetDlgItem( WIDC_ITEM_JOB ); pListBox->ResetContent(); for( int i = 0; i < prj.m_aPropItem.GetSize(); i++ ) { ItemProp* pItemProp = prj.GetItemProp( i ); DWORD dwKind = pWndItemKind->GetItemData( pWndItemKind->GetCurSel() ); DWORD dwSex = pWndItemSex->GetItemData( pWndItemSex->GetCurSel() ); DWORD dwJob = pWndItemJob->GetItemData( pWndItemJob->GetCurSel() ); if( pItemProp && ( pItemProp->dwItemKind2 == dwKind || dwKind == NULL_ID ) && ( pItemProp->dwItemSex == dwSex || dwSex == SEX_SEXLESS ) ) { if( pItemProp->dwLimitLevel1 >= dwLevel && ( pItemProp->dwItemJob == dwJob || dwJob == -1 ) ) { if( GetLanguage() != LANG_KOR && pItemProp->nVer >= 7 && pItemProp->bCharged == TRUE ) continue; int nIndex = pListBox->AddString( MakeName( pItemProp ) ); pListBox->SetItemDataPtr( nIndex, pItemProp ); } } } } } else if( nID == WIDC_OK || ( nID == WIDC_CONTROL1 && message == WNM_DBLCLK ) ) { CString string; CWndText* pWndItemName = (CWndText*)GetDlgItem( WIDC_ITEM_NAME ); CWndText* pWndItemNum = (CWndText*)GetDlgItem( WIDC_ITEM_NUM ); DWORD dwNum; if( pWndItemNum->m_string.GetLength() ) { dwNum = _ttoi(pWndItemNum->m_string); } else { dwNum = 1; } dwNum = ( dwNum == 0? 1:dwNum ); if( pWndItemName->m_string.GetLength() ) { CString str2; str2 = pWndItemName->m_string; string.Format( "/ci %s %d",str2, dwNum); ParsingCommand( string.LockBuffer(), g_pPlayer ); string.UnlockBuffer(); } else { int nIndex = pListBox->GetCurSel(); if( nIndex != -1 ) { pItemProp = (ItemProp*)pListBox->GetItemDataPtr( nIndex ); if( pItemProp ) { string.Format( "/ci \"%s\" %d", pItemProp->szName, dwNum); ParsingCommand( string.LockBuffer(), g_pPlayer ); string.UnlockBuffer(); } } } // nID = WTBID_CLOSE; } else if( nID == WIDC_CANCEL || nID == WTBID_CLOSE ) { nID = WTBID_CLOSE; Destroy( TRUE ); return TRUE; } return CWndNeuz::OnChildNotify( message, nID, pLResult ); }
BOOL CWndGuildVoteSeting::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { switch( nID ) { // 길드 설정창 클리어 case WIDC_VOTE_CLEAR: { CWndEdit* pEdit; pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT1 ); pEdit->SetString( "" ); pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT2 ); pEdit->SetString( "" ); pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT3 ); pEdit->SetString( "" ); pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT5 ); pEdit->SetString( "" ); pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT6 ); pEdit->SetString( "" ); pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT4 ); pEdit->SetString( "" ); m_nSelect = -1; } break; // 길드 투표 시작 case WIDC_VOTE_START: { CGuild* pGuild = g_pPlayer->GetGuild(); if( pGuild ) { // 현재 투표할 메뉴가 완료된것이냐? CWndComboBox* pCombo = (CWndComboBox*)GetParentWnd()->GetDlgItem(WIDC_COMBOBOX1); if( m_nSelect != -1 ) { if( pGuild->m_votes.size() ) { list <CGuildVote*>::iterator it = pGuild->m_votes.begin(); for ( ; it != pGuild->m_votes.end() ; ++it ) { if( (*it)->GetID() == pCombo->GetItemData(m_nSelect) ) { if( (*it)->IsCompleted() ) { g_WndMng.OpenMessageBox( "투표가 완료된 사항입니다.", MB_OK, this ); return FALSE; } else { g_WndMng.OpenMessageBox( "이미 진행중입니다.", MB_OK, this ); return FALSE; } } } } } // 입력사항 체크 부분... CWndEdit* pEdit1 = (CWndEdit*) GetDlgItem( WIDC_EDIT1 ); CWndEdit* pEdit2 = (CWndEdit*) GetDlgItem( WIDC_EDIT2 ); if( strlen( pEdit1->GetString() ) <= 0 || strlen( pEdit2->GetString() ) <= 0 ) { g_WndMng.OpenMessageBox( "투표제목과 내용은 필수 입력 사항입니다.", MB_OK, this ); break; } int nChk = -1; CWndEdit* pEdit[4]; pEdit[0] = (CWndEdit*) GetDlgItem( WIDC_EDIT3 ); pEdit[1] = (CWndEdit*) GetDlgItem( WIDC_EDIT5 ); pEdit[2] = (CWndEdit*) GetDlgItem( WIDC_EDIT6 ); pEdit[3] = (CWndEdit*) GetDlgItem( WIDC_EDIT4 ); int i; for( i=0; i<4; i++ ) { if( strlen( pEdit[i]->GetString() ) > 0 ) nChk = i; } if( nChk != -1 ) { if( nChk < 1 ) { g_WndMng.OpenMessageBox( "투표 항목은 최소한 2개 이상이어야 합니다.", MB_OK, this ); break; } for( i=0; i<=nChk; i++ ) { if( strlen( pEdit[i]->GetString() ) <= 0 ) { g_WndMng.OpenMessageBox( "중간에 빈 내용이 있습니다.", MB_OK, this ); return FALSE; } } } else { g_WndMng.OpenMessageBox( "투표 항목은 최소한 2개 이상이어야 합니다.", MB_OK, this ); break; } LPCTSTR ptext[4]; ptext[0] = pEdit[0]->GetString(); ptext[1] = pEdit[1]->GetString(); ptext[2] = pEdit[2]->GetString(); ptext[3] = pEdit[3]->GetString(); g_DPlay.SendAddVote( pEdit1->GetString(), pEdit2->GetString(), ptext ); } Destroy(); } break; // 길드투표 끝내기 case WIDC_VOTE_FINISH: { CWndComboBox* pCombo = (CWndComboBox*)GetParentWnd()->GetDlgItem(WIDC_COMBOBOX1); if( pCombo->GetCurSel() != -1 ) g_DPlay.SendCloseVote( pCombo->GetItemData( pCombo->GetCurSel() ) ); Destroy(); } break; } return CWndNeuz::OnChildNotify( message, nID, pLResult ); }
BOOL CWndGuildVote::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { CGuild* pGuild = g_pPlayer->GetGuild(); if( pGuild == NULL ) return FALSE; switch( nID ) { case WIDC_COMBOBOX1: { if( message == WNM_SELCHANGE ) { CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1); SelChange( pGuild, pCombo->GetCurSel()); } break; } // 길드 투표 설정 case WIDC_VOTE_SETTING: { if( pGuild->IsMaster( g_pPlayer->m_idPlayer ) == FALSE ) { g_WndMng.OpenMessageBox( "길드마스터만 설정할수 있습니다.", MB_OK, this ); break; } SAFE_DELETE( m_pWndGuildVoteSeting ); m_pWndGuildVoteSeting = new CWndGuildVoteSeting; CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1); m_pWndGuildVoteSeting->m_nSelect = pCombo->GetCurSel(); m_pWndGuildVoteSeting->Initialize( this ); break; } // 길드 투표 case WIDC_VOTE: { // 현재 투표할 메뉴가 완료된것이냐? CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1); if( pCombo->GetCurSel() == -1 ) { g_WndMng.OpenMessageBox( "종류를 고르세요.", MB_OK, this ); return FALSE; } if( pGuild->m_votes.size() ) { list <CGuildVote*>::iterator it = pGuild->m_votes.begin(); for ( ; it != pGuild->m_votes.end() ; ++it ) { if( (*it)->GetID() == pCombo->GetItemData(pCombo->GetCurSel()) ) { if( (*it)->IsCompleted() ) { g_WndMng.OpenMessageBox( "투표가 완료된 사항입니다.", MB_OK, this ); return FALSE; } } } } int nSelect = -1; CWndButton* pWndButton[4]; pWndButton[ 0 ] = (CWndButton*)GetDlgItem( WIDC_RADIO1 ); pWndButton[ 1 ] = (CWndButton*)GetDlgItem( WIDC_RADIO2 ); pWndButton[ 2 ] = (CWndButton*)GetDlgItem( WIDC_RADIO3 ); pWndButton[ 3 ] = (CWndButton*)GetDlgItem( WIDC_RADIO4 ); if( pWndButton[ 0 ]->GetCheck() ) nSelect = 0; else if( pWndButton[ 1 ]->GetCheck() ) nSelect = 1; else if( pWndButton[ 2 ]->GetCheck() ) nSelect = 2; else if( pWndButton[ 3 ]->GetCheck() ) nSelect = 3; CWndEdit* pEdit; switch(nSelect) { case 0: { pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT4 ); if( strlen( pEdit->GetString() ) <= 0 ) return FALSE; } break; case 1: { pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT2 ); if( strlen( pEdit->GetString() ) <= 0 ) return FALSE; } break; case 2: { pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT5 ); if( strlen( pEdit->GetString() ) <= 0 ) return FALSE; } break; case 3: { pEdit = (CWndEdit*) GetDlgItem( WIDC_EDIT3 ); if( strlen( pEdit->GetString() ) <= 0 ) return FALSE; } break; } g_DPlay.SendCastVote( pCombo->GetItemData( pCombo->GetCurSel() ), nSelect ); break; } } return CWndNeuz::OnChildNotify( message, nID, pLResult ); }