Пример #1
0
BOOL CWndRepairItemCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	int nDstId	= -1;
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;
	CPoint pt( 3, 3 );
	if( pShortcut->m_dwType == ITYPE_ITEM && pShortcut->m_dwData == 0 )
	{
		return TRUE;
	}
	else
	{
		CItemBase* pItemBase = g_pPlayer->GetItemId( pShortcut->m_dwId );
		if( pItemBase )
		{
			for( int i = 0; i < MAX_REPAIRINGITEM; i++ )
			{
				int x	= i % 5;
				int y	= i / 5;
				rect.SetRect( x * 32, y * 32, x * 32 + 32, y * 32 + 32 );

				if( rect.PtInRect( point ) && m_pdwIdRepair[i] == NULL_ID )
				{
					pShortcut->m_dwData		= i + 100;
					CWndBase* pParent	= (CWndBase*)GetParentWnd();
					pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut );
				}
			}
			return TRUE;
		}
	}
	return TRUE;
}
Пример #2
0
BOOL CWndVendorCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	int nDstId	= -1;
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;
	CPoint pt( 3, 3 );
	if( pShortcut->m_dwType == ITYPE_ITEM && pShortcut->m_dwData == 0 )
	{
		//		CWndBase* pParent	= (CWndBase*)GetParentWnd();
		//		pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut );
		return TRUE;
	}
	else
	{
		CItemBase* pItemBase = g_pPlayer->GetItemId( pShortcut->m_dwId );
		if( pItemBase )
		{
#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
			{
#if __VER >= 8 // __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;
				
				rect.SetRect( nX, nY, nX + 180, nY + 32 );
#else // __VER >= 8 // __S8_VENDOR_REVISION
				int x	= i % 6;
				int y	= i / 6;
				rect.SetRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 );
#endif // __VER >= 8 // __S8_VENDOR_REVISION
				
				if( rect.PtInRect( point ) && GetItem( i ) == NULL )
				{
					pShortcut->m_dwData		= i + 100;
					CWndBase* pParent	= (CWndBase*)GetParentWnd();
					pParent->OnChildNotify( 100, m_nIdWnd, (LRESULT*)pShortcut );
				}
			}
			return TRUE;
		}
	}
	return TRUE;
}
Пример #3
0
BOOL CWndShopCtrl::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
{
	CWndBase* pWndFrame =  pShortcut->m_pFromWnd->GetFrameWnd();
	if( pWndFrame->GetWndId() != APP_SHOP_ )
		return FALSE;

	if( pShortcut->m_dwShortcut == SHORTCUT_ITEM )
	{
		CItemElem* pItemElem = (CItemElem*)pShortcut->m_dwData;
		DWORD nTempCost = 0;
		if( m_nTabType == 0)
		{
			nTempCost += pItemElem->GetCost();
			nTempCost = static_cast< int >( static_cast< float >( nTempCost ) * prj.m_fShopBuyRate );

			if(CTax::GetInstance()->IsApplyTaxRate( g_pPlayer, pItemElem ))
				nTempCost += ( static_cast<DWORD>(nTempCost * CTax::GetInstance()->GetPurchaseTaxRate( g_pPlayer )) );
		}
		else if( m_nTabType == 1 || m_nTabType == 2 )
			nTempCost += pItemElem->GetChipCost();

		nTempCost = (int)((float)nTempCost * prj.m_fShopCost );
		
		if( pItemElem && pItemElem->m_dwItemId == II_SYS_SYS_SCR_PERIN )
			nTempCost = PERIN_VALUE;

		if( nTempCost > INT_MAX )
			return FALSE;

		for( int i = 0; i < MAX_CART; i++ )
		{
			int x = i % 6;
			int y = i / 6;			
			CRect rectHittest = CRect( x * 35, y * 35 + 3, x * 35 + 35, y * 35 + 35 + 3);
			if( rectHittest.PtInRect( point ) )
			{
				m_nLastPoint = i;
				break;
			}
		}
		CWndBase* pParent = (CWndBase*)GetParentWnd();
		pParent->OnChildNotify( WIN_ITEMDROP, m_nIdWnd, (LRESULT*)pShortcut ); 
		return TRUE;
	}

	return FALSE;
}