예제 #1
0
void CWndGuildMeritCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pItemContainer.size() <= 0 )
		return;

	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 32;

	// 스크롤바 관련   
	CPoint pt( 0, 0 );

	nWidth = 6;
	int nPage = nHeight;
	int nRange = m_pItemContainer.size() / nWidth;// - nPage;
	if( m_pItemContainer.size() % nWidth )
		nRange++;

	m_wndScrollBar.SetScrollRange( 0, nRange );
	m_wndScrollBar.SetScrollPage( nPage );
	
	pt.y = 0;
	pt.y += m_wndScrollBar.GetScrollPos() * nWidth;

	for( int i = pt.y; i < (int)( m_pItemContainer.size() ); i++ )
	{
		int x	= ( i - pt.x ) % 6;
		int y	= ( i - pt.y ) / 6;
		CItemBase* pItemBase	= m_pItemContainer[i];
		if( pItemBase )
		{
			pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 13, y * 32 + 7 ) );
			CRect rectHittest	= CRect( x * 32 + 13, y * 32  + 7, x * 32  + 13 + 32, y * 32 + 32 + 7 );
			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}
			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( x * 32 + 32 - size.cx + 17, y * 32 + 32 - size.cy + 10, szTemp, 0xff1010ff );
			}
		}
	}
}
예제 #2
0
void CWndGuildMeritCtrl::OnMouseMove( UINT nFlags, CPoint point )
{
	if( m_bDrag == FALSE )
		return;
	m_bDrag		= FALSE;
	CPoint pt( 3, 3 );
	CRect rect;

	CItemBase* pItemBase	= m_pFocusItem;
	if( pItemBase && pItemBase->GetExtra() > 0 )
	{
		m_GlobalShortcut.m_pFromWnd		= this;
		m_GlobalShortcut.m_dwShortcut	= SHORTCUT_ITEM;
		m_GlobalShortcut.m_dwIndex	= m_nCurSel;
		m_GlobalShortcut.m_dwType	= 0;
		m_GlobalShortcut.m_dwId		= pItemBase->m_dwObjId;
		m_GlobalShortcut.m_pTexture		= pItemBase->GetTexture();
		m_GlobalShortcut.m_dwData	= (DWORD)pItemBase;
		_tcscpy( m_GlobalShortcut.m_szString, pItemBase->GetProp()->szName );
	}
}
예제 #3
0
BOOL CWndRegVend::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
{
	CString str;

	SetFocus();
	
	CWndStatic* pWndStatic;
	pWndStatic = (m_dwFocus == 0) ? (CWndStatic*)GetDlgItem( WIDC_SELLNUM ): (CWndStatic*)GetDlgItem( WIDC_SELLPRI );

	str = pWndStatic->GetTitle();

	switch( nID )
	{
	case WIDC_VENEQUA:
		{
			if( m_bIsFirst )
			{
				char buffer[20] = { 0 };
				int i = ProcessCalc( m_Calc, atoi(str) );

				if(i < 0)
					_itoa( 2100000000, buffer, 10 );
				else
					_itoa( i, buffer, 10 );

				str = buffer;
				pWndStatic->SetTitle(str);
				m_bIsFirst = FALSE;
				m_Calc.m_nValue = 0;
			}
		}
		break;
	case WIDC_VENPLUS:
		OnChar('+');
		break;
	case WIDC_VENMINUS:
		OnChar('-');
		break;
	case WIDC_VENMULTI:
		OnChar('*');
		break;
	case WIDC_VENDIVID:
		OnChar('/');
		break;
	case WIDC_NUM0:
		OnChar('0');
		break;
	case WIDC_NUM1:
		OnChar('1');
		break;
	case WIDC_NUM2:
		OnChar('2');
		break;
	case WIDC_NUM3:
		OnChar('3');
		break;
	case WIDC_NUM4:
		OnChar('4');
		break;
	case WIDC_NUM5:
		OnChar('5');
		break;
	case WIDC_NUM6:
		OnChar('6');
		break;
	case WIDC_NUM7:
		OnChar('7');
		break;
	case WIDC_NUM8:
		OnChar('8');
		break;
	case WIDC_NUM9:
		OnChar('9');
		break;
	case WIDC_NUM00:
		{
			if(str == "0")
				break;

			CString strSum;
			strSum = str + "00";
			if(strlen(strSum) <= 9)
			{
				str+="00";
				pWndStatic->SetTitle(str);
			}
			break;
		}
	case WIDC_NUM000:
		{
			if(str == "0")
				break;

			CString strSum;
			strSum = str + "000";
			if(strlen(strSum) <= 9)
			{
				str+="000";
				pWndStatic->SetTitle(str);
			}
			break;
		}
	case WIDC_VENMIN:
		{
			pWndStatic->SetTitle( "1" );
			break;
		}
	case WIDC_VENMAX:
		{
			if(m_pItemBase)
			{
				ItemProp *pItemProp = m_pItemBase->GetProp();

				int nValue = 0;
#if __VER >= 8 // __S8_VENDOR_REVISION
				nValue = ( m_dwFocus == 0 ) ? ( (CItemElem*)m_pItemBase )->m_nItemNum: 2100000000;
#else // __VER >= 8 // __S8_VENDOR_REVISION
				nValue = ( m_dwFocus == 0 ) ? ( (CItemElem*)m_pItemBase )->m_nItemNum: pItemProp->dwCost;
#endif // __VER >= 8 // __S8_VENDOR_REVISION
				
				CString str;
				str.Format( "%d", nValue );
				
				pWndStatic->SetTitle(str);
				
			}
			break;
		}
	}
	
	if( nID == WIDC_OK || message ==  EN_RETURN )
	{
		pWndStatic	= (CWndStatic*)GetDlgItem( WIDC_SELLNUM );
		LPCTSTR str	= pWndStatic->GetTitle();
		int nNum	= 1;
		nNum	= atoi( str );
		CItemElem* pItemElem	= (CItemElem*)m_pItemBase;
		if( nNum < 1 )	return TRUE;	// 개수가 너무 작습니다.
		if( nNum > pItemElem->m_nItemNum )	nNum	= pItemElem->m_nItemNum;

		int nCost	= 0;
		pWndStatic	= (CWndStatic*)GetDlgItem( WIDC_SELLPRI );
		str		= pWndStatic->GetTitle();
#if __VER < 8 // __S8_VENDOR_REVISION
		if( strlen( str ) > 9 )	return TRUE;	// 숫자가 너무 큽니다.
#endif // __VER < 8 // __S8_VENDOR_REVISION
		//nCost	= atoi( str );

		__int64  n64Cost = 0;
		n64Cost = _atoi64(str);
		if( n64Cost > INT_MAX )
			n64Cost = INT_MAX;
		nCost = static_cast<int>( n64Cost );

		if( nCost < 1 )	return TRUE;	// 비정상적인 수치가 입력되었습니다.
		
		ItemProp* pItemProp	= m_pItemBase->GetProp();

		
#if __VER >= 8 // __S8_VENDOR_REVISION
//		if( 999999999 < ((EXPINTEGER)nCost*nNum) )
//		{
//			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ONE_GOLD)), MB_OK, this );
//			return TRUE;
//		}
		
		int nGold = g_pPlayer->GetGold();
		for( int iv = 0 ; iv < MAX_VENDITEM ; ++iv )
		{
			CItemBase *pItemBase = g_pPlayer->m_vtInfo.GetItem( iv );
			if( pItemBase == NULL )
				continue;

			nGold += ((CItemElem*)pItemBase)->m_nCost * pItemBase->GetExtra();
		}					
		int nOldGold = nGold;
		//nGold += (nCost * nNum);

		INT64 n64Sum(0);
		INT64 n64Gold(nGold);
		INT64 n64itemCost(nCost);
		INT64 n64Num(nNum);
		n64Sum = n64Gold + (n64itemCost * n64Num);

		if( n64Sum <= 0 || 2100000000 <= n64Sum || nOldGold >= n64Sum )
		{
			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
			return TRUE;
		}

//		if( nGold <= 0 || nOldGold >= nGold || 2100000000 <= nGold )
//		{
//			g_WndMng.OpenMessageBox( _T(prj.GetText(TID_GAME_VENDOR_MAX_ALL_GOLD)), MB_OK, this );
//			return TRUE;
//		}
#endif // __VER >= 8 // __S8_VENDOR_REVISION
		
#if __VER < 8     //8차게임내아이템판매가격제한풀기
		if( nCost > pItemProp->dwCost * 1000 )
		{
			g_WndMng.OpenMessageBox( _T( prj.GetText(TID_GAME_LIMITSELL)), MB_OK, this );
			return TRUE;
		}
#endif	//	   __VER < 8  

		g_DPlay.SendRegisterPVendorItem( m_iIndex, 0, (BYTE)( m_pItemBase->m_dwObjId ), nNum, nCost );
		Destroy( FALSE );
	}
	else if( nID == WIDC_CANCEL )	// WIDC_CANCEL
	{
		Destroy( FALSE );
	}
	

	return CWndNeuz::OnChildNotify( message, nID, pLResult );
}
예제 #4
0
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pMover == NULL )
		return;

	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;

	for( int i = 0; i < MAX_VENDITEM; i++ )
	{
		int x	= i % 6;
		int y	= i / 6;
		//p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
		CRect rectHittest	= CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 );

		CPoint point	= GetMousePoint();

		if( rectHittest.PtInRect( point ) )
		{
			if( CWndBase::m_GlobalShortcut.m_dwData )
			{
				m_nCurSel = -1;
				CPoint ptx = CPoint(x * 32 + 7, y * 32 + 11);
				{
					m_pTex->Render( p2DRender, ptx );
				}
			}
		}			
		CItemBase* pItemBase = GetItem( i );
		if( pItemBase )
		{
			if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
			{
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ), D3DCOLOR_XRGB( 255, 100, 100 ) );
			}
			else
			{
				pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ) );
			}

			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}
			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( x * 32 + 32 - size.cx+5, y * 32 + 32 - size.cy+12, szTemp, 0xff1010ff );
			}
		}
	}
}
예제 #5
0
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pMover == NULL )
		return;
	
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;

#if __VER >= 8 //__S8_VENDOR_REVISION
	for( int i = 0; i < MAX_VENDOR_REVISION; i++ )
#else //__S8_VENDOR_REVISION
	for( int i = 0; i < MAX_VENDITEM; i++ )
#endif //__S8_VENDOR_REVISION
	{
		int x	= i % 2;
		int y	= i / 2;
		
		int nX;
		int nY = y * 32 + 8 + y * 4;
		if( x == 0 )
			nX = x * 32 + 15;
		else
			nX = 235;

		CRect rectHittest = CRect( nX, nY, nX + 180, nY + 32 );
		CPoint point	= GetMousePoint();
		if( rectHittest.PtInRect( point ) )
		{
			if( CWndBase::m_GlobalShortcut.m_dwData )
			{
				m_nCurSel = -1;
				{
					CPoint ptx = CPoint(nX, nY);
					m_pTex->Render( p2DRender, ptx );		// 아이템 테두리 그리기
				}
			}
		}			
		CItemBase* pItemBase = GetItem( i );
		if( pItemBase )
		{

			// 툴팁
			float fScal = 1.0f;
			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				fScal = 1.15f;
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}

			// 아이템 아이콘 
			if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 100, 100 ) );					
			else
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 255, 255 ), fScal, fScal );

			// 아이템 이름, 판매가격
			OnDrawItemInfo( p2DRender, ((CItemElem*)pItemBase), nX, nY );

			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( nX, nY, nX + 32, nY + 32 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( nX - 7 + 32 - size.cx+5, nY - 11 + 32 - size.cy+12, szTemp, 0xff1010ff );
			}
		}
	}
}