#include "stdafx.h" #include "DragWindow.h" #include "ItemIcon.h" #include "SkillIcon.h" #include "UnionIcon.h" #include "UIRootNode.h" #include "ItemManager.h" #include "GameUIManager.h" #include "QuickManager.h" #include "ObjectManager.h" #include "hero.h" #include "ChatManager.h" #include "GameResourceManager.h" #include "NpcDisjointWindow.h" #include "EnhancedWindow.h" #include "TradeWindow.h" #include "UserSellWindow.h" #include "WareHouseWindow.h" #include "PutCardWindow.h" #include "CardBookWindow.h" #include "TarotSheetWindow.h" #include "NpcDealRegistSheet.h" #include "NpcDealWindow.h" #include "ChatWindow.h" #include "MailWindow.h" #include "MailSheet.h" #include "InventoryWindow.h" #include "BagWindow.h" #include "PartyUnionManager.h" #include "SoundSystem.h" #include "ShortcutWindow.h" #include "MegaphoneWindow.h" cDragWindow::cDragWindow( eUINodeType type ) : cUIWindow( type ) , mpCaller(0) , mShowIcon(0) , mIconType(eICON_MAX) , mShiftDown( false ) , mDragFrom( DRAG_FROM_MAX ) { SetExceptSnap( true ); } cDragWindow::~cDragWindow() { } void cDragWindow::Open() { } void cDragWindow::Close() { cUIWindow::Close(); mpCaller = 0; ITEMMAN->UnLinkIcon( true ); QUICKMAN->UnDragIcon(); PARTYUNIONMAN->UnLinkIcon(); mIconFrom = 0; mIconType = eICON_MAX; } void cDragWindow::Show( cUIWindow* pCaller, eDragFrom dragFrom, cBaseIcon* icon, unsigned int iconType, const cUIPos& pos, bool shift ) { if( icon == 0 || iconType >= eICON_MAX ) { assert( 0 && "Bad Icon or IconType" ); return; } int iconWidth = icon->GetRelativeRect().GetWidth(); int iconHeight = icon->GetRelativeRect().GetHeight(); mIconFrom = (cIcon*)icon; mIconType = iconType; mShowIcon->SetRelativeSize( cUISize( iconWidth, iconHeight ) ); mShowIcon->ChangeImage( icon->GetIconParam() ); mShowIcon->ShowNumber( false ); mShowIcon->Show(); switch( mIconType ) { case eICON_NORMAL: QUICKMAN->DragIcon( mIconFrom ); break; case eICON_ITEM: ITEMMAN->LinkIcon( (cItemIcon*)mIconFrom ); break; case eICON_UNION: PARTYUNIONMAN->LinkIcon( (cUnionIcon*)mIconFrom ); break; } mpCaller = pCaller; mShiftDown = shift; mDragFrom = dragFrom; /// µå·¡±×À©µµ¿ì À§Ä¡ ¼±Á¤, Å©±â Àç ¼³Á¤, À̹ÌÁö Å©±â Àç¼³Á¤ cUIPos newPos( (int)(pos.mX - GetAbsoluteRect().GetWidth() * 0.5), (int)(pos.mY - GetAbsoluteRect().GetHeight() * 0.5) ); SetRelativePos( newPos ); SetRelativeRect( cUIRect( newPos.mX, newPos.mY, newPos.mX + iconWidth + 4, newPos.mY + iconHeight + 4 ) ); // cUIWindow::Show(); SetCapture(); } /// ¿ÜºÎ¿¡¼­ ´ÝÈû. void cDragWindow::Hide( bool onsound ) { cUIWindow::Hide( onsound ); mpCaller = 0; ITEMMAN->UnLinkIcon( true ); QUICKMAN->UnDragIcon(); PARTYUNIONMAN->UnLinkIcon(); mIconFrom = 0; mIconType = eICON_MAX; } void cDragWindow::Hide( cUIWindow* pCaller ) { /// Àڱ⸦ È£ÃâÇÑ ÄÝ·¯°¡ ¾Æ´Ï¸é ¹«¹ÝÀÀ if( pCaller == mpCaller ) Hide(); } bool cDragWindow::OnCreate( cUINodeProperty* ) { mShowIcon = new cIcon; if( mShowIcon->CreateBySkinName( "Drag_Icon", this, 1 ) == false ) return false; Hide( false ); return true; } void cDragWindow::OnMouseMove( const cUIPos& pos ) { cUIPos newPos( (int)(pos.mX - GetAbsoluteRect().GetWidth() * 0.5), (int)(pos.mY - GetAbsoluteRect().GetHeight() * 0.5) ); SetRelativePos( newPos ); } void cDragWindow::OnLButtonUp( const cUIPos& pos ) { /// À©µµ¿ì ¼û±â±â cUIWindow::Hide(); mpCaller = 0; ITEMMAN->UnLinkIcon( true ); /// Á×¾îÀִµ¥ ¾ÆÀÌÅÛÀ» µå·¡±×ÇÏ¸é ½ÇÆÐó¸® if( HERO->GetState() == eOBJECT_STATE_DIE ) { CHATMANAGER->AddSystemMsg( eSYSTEM_NORMAL, GAMERESOURCEMAN->GetGameText( 235 ) ); } switch( mDragFrom ) { case DRAG_FROM_INVENTORY: OnDragFromInventory( pos ); break; case DRAG_FROM_NPC_STORE: OnDragFromNpcStore( pos ); break; case DRAG_FROM_QUICKSLOT: OnDragFromQuickSlot( pos ); break; case DRAG_FROM_TRADE: OnDragFromTradeWindow( pos ); break; case DRAG_FROM_USERSELL: OnDragFromUserSellWindow( pos ); break; case DRAG_FROM_CHATLINK: OnDragFromChatWindow( pos ); break; case DRAG_FROM_MEGAPHONELINK: OnDragFromMegaphoneWindow( pos ); break; case DRAG_FROM_SKILLWINDOW: OnDragFromSkillWindow( pos ); break; case DRAG_FROM_COMMUNITYWINDOW: OnDragFromCommunityWindow( pos ); break; case DRAG_FROM_NPCDEALREGIST: OnDragFromNpcDealRegistWindow( pos ); break; case DRAG_FROM_MAILREAD: OnDragFromMailReadWindow( pos ); break; case DRAG_FROM_MAILSEND: OnDragFromMailSendWindow( pos ); break; case DRAG_FROM_SHORTCUTWINDOW: OnDragFromShortcutWindow( pos ); break; } QUICKMAN->UnDragIcon(); } /// Àκ¥Å丮 -> ¿ÜºÎ void cDragWindow::OnDragFromInventory( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; unsigned short slotIndex0 = itemIcon->GetSlotIndex(); eItemIn in = ITEMMAN->GetItemIn( slotIndex0 ); cItem* item0 = ITEMMAN->GetItem( slotIndex0 ); if( !item0 ) { assert(0); return; } /// ¾²·¹±âÅë¿¡ ´ëÇÑ Ã³¸® if( node->GetID() == eUIID_INVENTORY_GARBAGE || node->GetID() == eUIID_WAREHOUSE_TRASH || node->GetID() == eUIID_WAREHOUSE_BAG1_TRASH || node->GetID() == eUIID_WAREHOUSE_BAG2_TRASH || node->GetID() == eUIID_WAREHOUSE_BAG3_TRASH || node->GetID() == eUIID_BAG0_TRASH || node->GetID() == eUIID_BAG1_TRASH || node->GetID() == eUIID_BAG2_TRASH ) { /// Àåºñâ¿¡ Àִ°ÍÀº ¹ö¸±¼ö ¾ø´Ù. if( in != ITEM_IN_EQUIP ) GAMEUI->ShowItemDumpAskWindow( slotIndex0 ); return; } /// NPC »óÁ¡ üũ cUIWindow* store = (cUIWindow*)GAMEUI->GetNpcStore(); if( store && UIMAN->IsIncludeParent( node, store ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; if( mShiftDown ) return; if( item0->GetCount() > 0 ) { if( item0->GetCount() == 1 ) GAMEUI->ShowItemSellAskWindow( slotIndex0, 1 ); else GAMEUI->ShowItemCountWindow( eMBEVENT_ITEMCOUNT_SELL, slotIndex0 ); } return; } /// ÆÇ¸Å³ëÁ¡ üũ cUserSellWindow* userSell = GAMEUI->GetUserSellWindow(); if( userSell && UIMAN->IsIncludeParent( node, userSell ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; if( userSell->GetStatus() == eUSERSELL_JOIN ) return; if( userSell->IsNetLock() == false ) { if( userSell->IsOpen() == false ) { CHATMANAGER->AddSystemMsg( eSYSTEM_NORMAL, GAMERESOURCEMAN->GetGameText( 2509 ) ); } else { GAMEUI->ShowMoneyWindow( eMONEY_NONE, eMBEVENT_USERSELL_ITEMMONEYADD, slotIndex0 ); } } return; } /// äÆÃÀ©µµ¿ì üũ cChatWindow* chatWin = GAMEUI->GetChatWindow(); if( chatWin && UIMAN->IsIncludeParent( node, chatWin ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; chatWin->AddLinkItem( slotIndex0, 0 ); return; } /// ¸Þ°¡Æù À©µµ¿ì cMegaphoneWindow* megaWin = GAMEUI->GetMegaphoneWindow(); if( megaWin && UIMAN->IsIncludeParent( node, megaWin ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; megaWin->AddLinkItem( slotIndex0, 0 ); return; } /// °Å·¡ üũ cTradeWindow* trade = GAMEUI->GetTradeWindow(); if( trade && UIMAN->IsIncludeParent( node, trade ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; if( trade->IsNetLock() == false ) { ITEMMAN->TryToTradeItemAdd( slotIndex0 ); } return; } /// Ä«µåÄ÷º¼ÇºÏ üũ cCardBookWindow* cardBook = GAMEUI->GetCardBookWindow(); if( cardBook && UIMAN->IsIncludeParent( node, cardBook ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; cItemDefine* define = ITEMMAN->GetItemDefine( item0->GetIndex() ); if( !define ) return; unsigned char type = define->GetType(); unsigned char subtype = define->GetSubType(); /// ÇöÀç Ä÷º¼ÇºÏ ÆäÀÌÁö °Ë»ç if( cardBook->GetCurrentPage() == ePAGE_TAROT ) { if( type == ITEM_CARD && subtype == ITEM_CARD_TAROT ) { /// Ÿ·Ô Ä«µåÀΰæ¿ì, cItemTarot* tarot = define->GetTarotDefine(); cTarotSheetWindow* sheet = cardBook->GetTarotSheet(); if( tarot && sheet ) { unsigned short bookslotIndex = sheet->GetSlotIndex( tarot->GetUniqueNumber() ); if( bookslotIndex != USHRT_MAX ) GAMEUI->ShowItemCardBook( eMBEVENT_ITEM_CARDBOOK_TAROTNEW, slotIndex0, bookslotIndex, 0 ); } } else if( type == ITEM_SPREAD ) { /// ½ºÇÁ·¹µåÀΰæ¿ì, cTarotSheetWindow* sheet = cardBook->GetTarotSheet(); if( sheet ) { /// ½ºÇÁ·¹µåÀÇ ½½·Ô¿¡ ²ø¾î³õÀº °æ¿ì. if( node->IsKindof(eUINODE_ICON) ) { cItemIcon* icon = (cItemIcon*)node; if( icon->GetSlotIndex() >= INVENTORY_SPREAD_NORMAL_BEGIN && icon->GetSlotIndex() <= INVENTORY_SPREAD_NORMAL_END ) { unsigned short emptyItemSlot = icon->GetSlotIndex(); unsigned long registItemIdx = sheet->IsRegistItem( emptyItemSlot - INVENTORY_TAROT_NORMAL_BEGIN ); if( registItemIdx != ULONG_MAX ) { eMSGBox_Event event = (registItemIdx == 0)? eMBEVENT_ITEM_CARDBOOK_SPREADNEW : eMBEVENT_ITEM_CARDBOOK_SPREADUPDATE; GAMEUI->ShowItemCardBook( event, slotIndex0, emptyItemSlot, registItemIdx ); } } } } } } return; } // ¿ìÆíÇÔ Ã¼Å© cMailWindow* mailWin = GAMEUI->GetMailWindow(); if( mailWin && UIMAN->IsIncludeParent( node, mailWin ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; cMailSendSheet* sendSheet = mailWin->GetSendSheet(); if( sendSheet && mailWin->GetCurrentSheet() == sendSheet ) { if( mailWin->IsNetLock() == false ) { sendSheet->AddItem( slotIndex0 ); } return; } } // ºÐÇØ üũ cNpcDisjointWindow* disjoint = GAMEUI->GetNpcDisjointWindow(); if( disjoint && UIMAN->IsIncludeParent( node, disjoint ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; disjoint->AddItem( slotIndex0 ); return; } // °­È­ üũ cEnhancedWindow* enhance = GAMEUI->GetEnhancedWindow(); if( enhance && UIMAN->IsIncludeParent( node, enhance ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; cItemDefine* define = item0->GetDefine(); if( !define ) { assert(0); return; } // item or card if( define->GetType() == ITEM_CARD && (define->GetSubType() >= ITEM_CARD_ENHANCE_WEAPON_LV1 && define->GetSubType() <= ITEM_CARD_ENHANCE_WEAR_LV2_75) ) { enhance->AddCard( slotIndex0, true ); } else if( define->GetType() == ITEM_MATERIAL && (define->GetSubType() >= ITEM_MATERIAL_ENHANCED_DOWN_30 && define->GetSubType() <= ITEM_MATERIAL_ENHANCED_DESTROY_60 ) ) { enhance->AddCashProtectCard( slotIndex0, true ); } else enhance->AddItem( slotIndex0, true ); return; } // ÆÇ¸Å´ëÇà cNpcDealWindow* dealWin = GAMEUI->GetNpcDealWindow(); if( dealWin && UIMAN->IsIncludeParent( node, dealWin ) ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; cNpcDealRegistSheet* regist = dealWin->GetRegistSheet(); if( regist && dealWin->GetCurrentSheet() == regist ) { regist->RegistItem( slotIndex0 ); } return; } /// ¾ÆÀÌÄÜ Ã¼Å© if( node->IsKindof(eUINODE_ICON) ) { cIcon* icon = (cIcon*)node; /// Äü½½·Ô ó¸® cUIContainer* parent = node->GetParent(); if ( parent == NULL ) return; int parentID = parent->GetID(); /// Äü½½·Ô È®Àΰ˻ç if( parentID == eUIID_COLUMN_QUICKSLOT || parentID == eUIID_ROW_QUICKSLOT || parentID == eUIID_COLUMN_EXTRASLOT1 || parentID == eUIID_ROW_EXTRASLOT1 || parentID == eUIID_COLUMN_EXTRASLOT2 || parentID == eUIID_ROW_EXTRASLOT2 || parentID == eUIID_COLUMN_QUICKSLOT_FS || parentID == eUIID_ROW_QUICKSLOT_FS ) { if( in != ITEM_IN_INVEN_PRIVATE ) return; DragToQuickSlot( DRAG_FROM_INVENTORY, icon ); return; } /// ¾ÆÀÌÅÛ Ã³¸® if( icon->GetIconType() == eICON_ITEM ) { DragToItemSlot( icon ); return; } } } /// ½ºÅ³Ã¢ -> ¿ÜºÎ void cDragWindow::OnDragFromSkillWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( node && node->IsKindof(eUINODE_ICON) ) { cIcon* icon = (cIcon*)node; if( icon->GetIconType() == eICON_NORMAL ) { /// Äü½½·Ô ó¸® DragToQuickSlot( DRAG_FROM_SKILLWINDOW, icon ); } } } void cDragWindow::OnDragFromCommunityWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( node && node->IsKindof(eUINODE_ICON) ) { cIcon* icon = (cIcon*)node; if( icon->GetIconType() == eICON_NORMAL ) { /// Äü½½·Ô ó¸® DragToQuickSlot( DRAG_FROM_COMMUNITYWINDOW, icon ); } } } /// npc »óÁ¡ -> inven void cDragWindow::OnDragFromNpcStore( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; if( node && node->IsKindof(eUINODE_ICON) ) { cItemIcon* icon = (cItemIcon*)node; unsigned short slotIndex = icon->GetSlotIndex(); eItemIn in = ITEMMAN->GetItemIn( slotIndex ); /// Npc »óÁ¡ -> Àκ¥ °³ÀÎ if( in == ITEM_IN_INVEN_PRIVATE ) { unsigned int itemIndex = itemIcon->GetItemIndex(); assert( itemIndex ); cItemDefine* itemDefine = ITEMMAN->GetItemDefine( itemIndex ); assert( itemDefine ); if( itemDefine ) { /// 1°³¶óµµ »ì¼ö ÀÖ¾î¾ß ±¸ÀÔ°¡´É if( ITEMMAN->CheckBuyItem( itemIndex, 1 ) == false ) return; if( itemDefine->GetCapacity() == 1 ) { GAMEUI->ShowItemBuyAskWindow( itemIndex, 1 ); } else { GAMEUI->ShowItemCountWindow( eMBEVENT_ITEMCOUNT_BUY, itemIndex ); } } } } } /// void cDragWindow::OnDragFromQuickSlot( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( node->IsKindof(eUINODE_ICON) ) { cIcon* icon = (cIcon*)node; if( icon->GetIconType() == eICON_NORMAL ) { /// Äü½½·Ô ó¸® DragToQuickSlot( DRAG_FROM_QUICKSLOT, icon ); } } else { QUICKMAN->DeleteData(); } } void cDragWindow::OnDragFromTradeWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; cTradeWindow* trade = GAMEUI->GetTradeWindow(); if( trade ) { if( trade->IsNetLock() == true ) return; if( trade->GetStatus() != ItemExchangeBegin ) return; /// Æ®·¹À̵å À©µµ¿ì ¿µ¿ªÀÎÁö üũ if( trade->ContainPoint( pos ) ) return; unsigned short slot = itemIcon->GetSlotIndex(); if( slot != USHRT_MAX && ITEMMAN->TryToTradeItemDelete( slot, itemIcon->GetID() ) == false ) return; } } void cDragWindow::OnDragFromChatWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; /// µî·Ï »èÁ¦ cChatWindow* chatWin = GAMEUI->GetChatWindow(); if( chatWin && chatWin->ContainPoint( pos ) == false ) chatWin->DeleteLinkItem(); } void cDragWindow::OnDragFromMegaphoneWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; /// µî·Ï »èÁ¦ cMegaphoneWindow* megaWin = GAMEUI->GetMegaphoneWindow(); if( megaWin && megaWin->ContainPoint( pos ) == false ) megaWin->DelLinkItem(); } void cDragWindow::OnDragFromUserSellWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; cUserSellWindow* userSell = GAMEUI->GetUserSellWindow(); if( !userSell ) return; if( userSell->IsNetLock() == true ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; /// ÆÇ¸Å »óÅ if( userSell->GetStatus() == eUSERSELL_SELL ) { /// ÆÇ¸Å³ëÁ¡»ó ³»ºÎÀÌ¸é ¸®ÅÏ if( userSell->ContainPoint( pos ) == true ) return; /// ¿µ¿ª¿¡ ¾øÀ¸¸é »èÁ¦ unsigned short slot = userSell->GetSelectInvenSlot(); if( slot != USHRT_MAX && ITEMMAN->TryToUserSellDelete( slot ) == false ) return; } /// ±¸¸Å»óÅ else if( userSell->GetStatus() == eUSERSELL_JOIN ) { if( node->IsKindof( eUINODE_ICON ) ) { cItemIcon* icon = (cItemIcon*)node; eItemIn in = ITEMMAN->GetItemIn( icon->GetSlotIndex() ); /// ±¸¸Åâ -> Àκ¥ °³ÀÎ if( in == ITEM_IN_INVEN_PRIVATE ) { sUserSellData* data = userSell->GetSelectJoinData(); sInventory* inv = &data->mThatInven; cItemDefine* itemDefine = ITEMMAN->GetItemDefine( inv->ItemIndex ); if( itemDefine->GetCapacity() > 1 ) GAMEUI->ShowItemCountWindow( eMBEVENT_ITEMCOUNT_USERSELLBUY, inv->number, inv->ItemIndex, inv->count, data->mPrice ); else GAMEUI->ShowItemUserSellBuyAskWindow( inv->number, inv->ItemIndex, 1, data->mPrice ); } } } } void cDragWindow::OnDragFromNpcDealRegistWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; cNpcDealWindow* deal = GAMEUI->GetNpcDealWindow(); if( deal ) { cNpcDealRegistSheet* regist = deal->GetRegistSheet(); if( !regist ) return; if( deal->IsNetLock() == true ) return; /// cUIRect dealRect = deal->GetAbsoluteRect(); if( dealRect.ContainPoint( pos ) == false ) { regist->DeleteRegistItem(); } } } void cDragWindow::OnDragFromMailReadWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; // ¿µ¿ª üũ bool check = false; cInventoryWindow* inven = GAMEUI->GetInventoryWindow(); if( inven && inven->ContainPoint( pos ) ) { check = true; } if( check == false ) { for( unsigned int i = 0; i < 3; ++i ) { cBagWindow* bag = GAMEUI->GetBagWindow( i ); if( bag && bag->ContainPoint( pos ) ) { check = true; break; } } } // Àκ¥ ȤÀº °¡¹æÀ¸·Î µå·¡±× ÇÏ¿´´Ù¸é if( check == true ) { cMailWindow* mailWin = GAMEUI->GetMailWindow(); if( mailWin ) { cMailReadSheet* read = mailWin->GetReadSheet(); if( read ) { read->SendItemDownload( itemIcon->GetID() ); } } } } void cDragWindow::OnDragFromMailSendWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_ITEM ) return; cItemIcon* itemIcon = (cItemIcon*)mIconFrom; if( itemIcon == 0 ) return; cMailWindow* mailWin = GAMEUI->GetMailWindow(); if( mailWin ) { cMailSendSheet* sheet = mailWin->GetSendSheet(); if( sheet ) { if( sheet->ContainPoint( pos ) ) return; sheet->DeleteItem( itemIcon->GetID() ); } } } /// Äü½½·ÔÀ¸·Î µå·¡±× void cDragWindow::DragToQuickSlot( eDragFrom dragFrom, cIcon* icon ) { if( icon == NULL ) return; cUIContainer* parent = icon->GetParent(); if( parent == NULL ) return; unsigned int parentID = parent->GetID(); /// Äü½½·Ô È®Àΰ˻ç if( parentID != eUIID_COLUMN_QUICKSLOT && parentID != eUIID_ROW_QUICKSLOT && parentID != eUIID_COLUMN_EXTRASLOT1 && parentID != eUIID_ROW_EXTRASLOT1 && parentID != eUIID_COLUMN_EXTRASLOT2 && parentID != eUIID_ROW_EXTRASLOT2 && parentID != eUIID_COLUMN_QUICKSLOT_FS && parentID != eUIID_ROW_QUICKSLOT_FS ) return; if( mIconFrom == 0 ) return; /// ³õ´Â À§Ä¡¿¡ µû¸¥ fs ½½·Ô ÆÇº° bool toIsFS = false; if( parentID == eUIID_COLUMN_QUICKSLOT_FS || parentID == eUIID_ROW_QUICKSLOT_FS ) toIsFS = true; /// ¸ó½ºÅÍ º¯½Å»óÅÂÀ϶§, ¸ó½ºÅÍ ½ºÅ³ ½½·Ô¿¡ µî·Ï ºÒ°¡!! if( toIsFS && HERO->IsTransformMonster() && icon->GetID() >= QUICKSLOT_ICON_FS_BEGIN && icon->GetID() <= QUICKSLOT_ICON_FS_END ) return; /// Äü½½·Ô¿¡ µî·Ï if( dragFrom == DRAG_FROM_QUICKSLOT ) { QUICKMAN->MoveData( icon->GetID(), mShowIcon, toIsFS ); } else { QUICKMAN->AddData( icon->GetID(), mIconFrom, toIsFS ); } } /// Àκ¥Å丮 -> NPC»óÁ¡, Àκ¥Å丮, ºÐÇØÃ¢,... /// ½½·Ô ´ë ½½·ÔÀ¸·Î ºñ±³ÇؾßÇϴ°æ¿ì »ç¿ë ( ¹Ýµå½Ã ÇØ´ç À§Ä¡ ½½·ÔÀ» üũÇϴ°æ¿ì ) void cDragWindow::DragToItemSlot( cIcon* icon ) { if( mIconType != eICON_ITEM ) return; cItemIcon* itemIconFrom = (cItemIcon*)mIconFrom; if( itemIconFrom == 0 ) return; cItemIcon* itemIcon = (cItemIcon*)icon; unsigned short slotIndex0 = itemIconFrom->GetSlotIndex(); unsigned short slotIndex1 = itemIcon->GetSlotIndex(); if( slotIndex0 == slotIndex1 ) return; eItemIn in = ITEMMAN->GetItemIn( slotIndex0 ); eItemIn out = ITEMMAN->GetItemIn( slotIndex1 ); if( in == ITEM_IN_NULL || out == ITEM_IN_NULL ) return; cItem* item = ITEMMAN->GetItem( slotIndex0 ); if( !item ) { assert(0); return; } if( mShiftDown == true && item->IsCash() == false ) { /// Àκ¥ °³ÀÎ -> Àκ¥ °³ÀÎ /// Àκ¥ °³ÀÎ <-> â°í °³ÀÎ /// â°í °³ÀÎ -> â°í °³ÀÎ if( (in == ITEM_IN_INVEN_PRIVATE && in == out) || (in == ITEM_IN_INVEN_PRIVATE && out == ITEM_IN_WAREHOUSE_PRIVATE) || (in == ITEM_IN_WAREHOUSE_PRIVATE && out == ITEM_IN_INVEN_PRIVATE) || (in == ITEM_IN_WAREHOUSE_PRIVATE && in == out ) ) { // ³õ¾ÆÁú À§Ä¡¿¡ ¾ÆÀÌÅÛ Á¸Àç ÆÇ´Ü /// ºÐÇÒ + ¸ÓÁö ±â´ÉÀº ¾øÀ½ if( itemIcon->GetNumber() > 0 ) return; GAMEUI->ShowItemCountWindow( eMBEVENT_ITEMCOUNT_SPLIT, slotIndex0, slotIndex1 ); return; } } /// Àκ¥ °³ÀÎ -> Ä«µå ÀåÂø [¾ÆÀÌÅÛ] ½½·Ô if( in == ITEM_IN_INVEN_PRIVATE && out == ITEM_IN_PUTCARD_ITEMSLOT ) { /// ¾ÆÀÌÅÛ µî·Ï cPutCardWindow* putcard = GAMEUI->GetPutCardWindow(); if( putcard ) putcard->AddItem( slotIndex0 ); } /// Àκ¥ °³ÀÎ -> Ä«µå ÀåÂø [Ä«µå] ½½·Ô else if( in == ITEM_IN_INVEN_PRIVATE && out == ITEM_IN_PUTCARD_CARDSLOT ) { cPutCardWindow* putcard = GAMEUI->GetPutCardWindow(); if( putcard ) putcard->TestAddCard( slotIndex0, slotIndex1 ); } /// Ä«µåºÏ -> Àκ¥ °³ÀÎ else if( in == ITEM_IN_CARDBOOK_NORMAL && out == ITEM_IN_INVEN_PRIVATE ) { cItem* item1 = ITEMMAN->GetItem( slotIndex1 ); if( item1 ) { if( item1->GetIndex() > 0 && item1->IsLock() == true ) return; // ºóÀÚ¸®°Å³ª, ÀÚ¸®¿¡ Á¸ÀçÇÏ´Â ¾ÆÀÌÅÛÀÌ µ¿ÀÏ Å¸·ÎÄ«µåÀ϶§¸¸ °¡´É if( item1->GetCount() > 0 ) { if( item->GetIndex() != item1->GetIndex() ) return; } GAMEUI->ShowItemCardBook( eMBEVENT_ITEM_CARDBOOK_TAROTRETURN, slotIndex0, slotIndex1, 0 ); } else { assert(0); return; } } else if( out == ITEM_IN_NPCSTORE || out == ITEM_IN_PUTCARD_ITEMSLOT ) { /// µµÂøÁöÁ¡ÀÌ À߸øµÇ¾úÀ¸¸é ¸®ÅÏ assert(0); return; } else { /// ¶ô °É¸° ½½·ÔÀÌ¸é ¸®ÅÏ cItem* item1 = ITEMMAN->GetItem( slotIndex1 ); if( !item1 ) { assert(0); return; } if( item1->GetIndex() > 0 && item1->IsLock() == true ) return; ITEMMAN->TryToMoveItem( slotIndex0, slotIndex1, itemIconFrom ); } return; } void cDragWindow::OnDragFromShortcutWindow( const cUIPos& pos ) { cUINode* node = NULL; /// ÇØ´ç ¾ÆÀÌÄÜÀÌ tabŰ, ctrlŰ, altŰ, space bar ¿¡ ÇØ´çÇÏ´ÂÁö °Ë»ç(À̵éÀº ¾ÆÀÌÄÜ ¿µ¿ªÀÌ ´Ù¸¥°Í°ú ´Ù¸£´Ù. cShortcutWindow* pShortcutWinow = GAMEUI->GetShortcutWindow(); if( pShortcutWinow ) { node = pShortcutWinow->GetSpecialKeyNode( pos ); } /// Å©±â°¡ ´Ù¸¥ ¾ÆÀÌÄÜÀÌ ¾Æ´Ï¸é ÇØ´ç ¾ÆÀÌÄÜ ¾ò¾î¿À±â if( node == NULL ) node = GetRoot()->GetNode( pos ); if( !node ) { assert( 0 ); return; } if( mIconType != eICON_SHORTCUT || mIconFrom == NULL ) return; /// ¾ÆÀÌÄÜÀ» µé¾ú´ø À§Ä¡¿Í µ¿ÀÏÇÏ´Ù¸é if( mIconFrom->GetID() == node->GetID() ) return; /// Ãâ¹ß ÁöÁ¡ÀÌ Å°º¸µå ¾ÆÀÌÄÜÀÌ¸ç ¸ñÇ¥ ÁöÁ¡ÀÌ Å°º¸µå ¾ÆÀÌÄÜÀÌ ¾Æ´Ñ°æ¿ì ¾ÆÀÌÄÜ »èÁ¦. typedef tPointerHashMap< int, void* > sKeyMap; sKeyMap *shortcutMap; sKeyMap *keyboardMap; shortcutMap = SHORTCUTMAN->GetShortcutScriptMap(); keyboardMap = SHORTCUTMAN->GetKeyboardScriptMap(); if( keyboardMap->GetAt( mIconFrom->GetID() ) != 0 ) { if( node->GetType() != eUINODE_ICON ) { SHORTCUTMAN->EraseShortcut( mIconFrom->GetID() ); return; } cBaseIcon* pIcon = (cBaseIcon*)node; if( pIcon->GetIconType() != eICON_SHORTCUT ) { SHORTCUTMAN->EraseShortcut( mIconFrom->GetID()); return; } if( keyboardMap->GetAt( pIcon->GetID() ) == 0 ) { SHORTCUTMAN->EraseShortcut( mIconFrom->GetID() ); return; } } /// ´ÜÃàŰ ¾ÆÀÌÄÜ ¹Ú½º¿¡¼­ Űº¸µå ¹Ú½º·Î ¿È±ä°Å¶ó¸é if( shortcutMap->GetAt( mIconFrom->GetID() ) != 0 && keyboardMap->GetAt( node->GetID() ) != 0 ) { SHORTCUTMAN->SetShortcut( mIconFrom->GetID(), node->GetID() ); } /// Űº¸µå ÅÇ¿¡¼­ Űº¸µå ÅÇÀ¸·Î ¿È±ä°Å¶ó¸é if( keyboardMap->GetAt( mIconFrom->GetID() ) != 0 && keyboardMap->GetAt( node->GetID() ) != 0 ) { SHORTCUTMAN->MoveShortcut( mIconFrom->GetID() , node->GetID() ); } } //-------------------------------------------------------------- cUnionDragWindow::cUnionDragWindow( eUINodeType type ) : cDragWindow( type ) , mpCaller(0) , mUnionShowIcon(0) , mUnionIconFrom(0) { mIconType = eICON_MAX; } cUnionDragWindow::~cUnionDragWindow() { } void cUnionDragWindow::Open() { } void cUnionDragWindow::Close() { cUIWindow::Close(); mpCaller = 0; PARTYUNIONMAN->UnLinkIcon(); mUnionIconFrom = 0; mIconType = eICON_MAX; } bool cUnionDragWindow::OnCreate( cUINodeProperty* ) { mUnionShowIcon = new cUnionIcon; if( mUnionShowIcon->CreateBySkinName( "UnionDrag_Icon", this, 1 ) == false ) return false; Hide( false ); return true; } void cUnionDragWindow::Show( cUIWindow* pCaller, cUnionIcon* icon, const cUIPos& pos ) { assert( icon ); if( icon->GetIconType() != eICON_UNION ) { assert(0); return; } mUnionIconFrom = icon; mIconType = icon->GetIconType(); // Á¤º¸ º¹»ç mUnionShowIcon->ClearInfo(); mUnionShowIcon->SetInfo( icon->GetName(), icon->GetMaxHP(), icon->GetHP(), icon->GetJob(), icon->GetLevel() ); mUnionShowIcon->Show(); PARTYUNIONMAN->LinkIcon( mUnionIconFrom ); mpCaller = pCaller; /// µå·¡±×À©µµ¿ì À§Ä¡ ¼±Á¤ cUIPos newPos( (int)(pos.mX - GetAbsoluteRect().GetWidth() * 0.5), (int)(pos.mY - GetAbsoluteRect().GetHeight() * 0.5) ); SetRelativePos( newPos ); //ShowModal( eMBEVENT_NONE ); cUIWindow::Show(); SetCapture(); } /// ¿ÜºÎ¿¡¼­ ´ÝÈû. void cUnionDragWindow::Hide( bool onsound ) { cUIWindow::Hide( onsound ); mpCaller = 0; PARTYUNIONMAN->UnLinkIcon(); mUnionIconFrom = 0; mIconType = eICON_MAX; } void cUnionDragWindow::Hide( cUIWindow* pCaller ) { cDragWindow::Hide( pCaller ); } void cUnionDragWindow::OnLButtonUp( const cUIPos& pos ) { /// À©µµ¿ì ¼û±â±â cUIWindow::Hide(); mpCaller = 0; // OnDragFromUnionWindow( pos ); // PARTYUNIONMAN->UnLinkIcon(); } void cUnionDragWindow::OnDragFromUnionWindow( const cUIPos& pos ) { cUINode* node = GetRoot()->GetNode( pos ); if( !node ) return; if( mIconType != eICON_UNION ) return; if( node->IsKindof(eUINODE_ICON) == false ) return; cBaseIcon* baseIcon = (cBaseIcon*)node; if( baseIcon->GetIconType() != eICON_UNION ) return; unsigned char i0 = (unsigned char)mUnionIconFrom->GetID(); unsigned char i1 = (unsigned char)baseIcon->GetID(); if( PARTYUNIONMAN->TryToMovePlayer( i0, i1 ) == false ) assert(0); }