CIcon* CHotIconSlot::GetHotIcon( int iSlot ) { CIcon* pIcon = NULL; CIconQuick* pQuickIcon = NULL; switch( g_pAVATAR->m_HotICONS.m_IconLIST[ iSlot ].m_cType ) { case 0: break; case INV_ICON: { CItemSlot* pItemSlot = g_pAVATAR->GetItemSlot(); CItem* pItem = pItemSlot->GetItem( g_pAVATAR->m_HotICONS.m_IconLIST[ iSlot ].m_nSlotNo ); if( pItem ) pQuickIcon = new CIconQuick( pItem->CreateItemIcon() ); } break; case SKILL_ICON: { int iSkillSlot = g_pAVATAR->m_HotICONS.m_IconLIST[ iSlot ].m_nSlotNo; pQuickIcon = new CIconQuick( new CIconSkill( iSkillSlot ) ); } break; case DIALOG_ICON: { int iDialogType = g_pAVATAR->m_HotICONS.m_IconLIST[ iSlot ].m_nSlotNo; if( iDialogType > 0 && iDialogType < DLG_TYPE_MAX ) { if( CIconDialog* p = CIconDialog::CreateIcon( iDialogType , false ) ) pQuickIcon = new CIconQuick( p ); } break; } case CLANSKILL_ICON: { int iSkillSlot = g_pAVATAR->m_HotICONS.m_IconLIST[ iSlot ].m_nSlotNo; pQuickIcon = new CIconQuick( new CIconSkillClan( iSkillSlot ) ); break; } default: assert( 0 && "GetHotIcon gets invalid icon type" ); break; } if( pQuickIcon ) pQuickIcon->SetQuickBarSlotIndex( iSlot ); return pQuickIcon; }
void CSeparateDlg::Update( CObservable* pObservable, CTObject* pObj ) { assert( pObservable ); assert( pObj && strcmp( pObj->toString() ,"Separate" ) == 0 ); if( pObj == NULL || strcmp( pObj->toString() ,"Separate" ) ) return; CTEventSeparate* pEvent = (CTEventSeparate*)pObj; switch( pEvent->GetID() ) { case CTEventSeparate::EID_REMOVE_MATERIAL_ITEM: ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 2: EID_REMOVE_MATERIAL_ITEM"); m_MaterialItemSlot.DetachIcon(); break; case CTEventSeparate::EID_SET_MATERIAL_ITEM: { CItem* pItem = pEvent->GetItem(); ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 1: EID_SET_MATERIAL_ITEM Item Type %i Item ID %i", pItem->GetType(), pItem->GetItemNo()); assert( pItem ); if( pItem ) m_MaterialItemSlot.AttachIcon( pItem->CreateItemIcon() ); break; } case CTEventSeparate::EID_REMOVE_OUTPUT_ITEM: { ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 4: EID_REMOVE_OUTPUT_ITEM"); int iIndex = pEvent->GetIndex(); //assert( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() ); if( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() ) m_OutputItemSlots[iIndex].DetachIcon(); break; } case CTEventSeparate::EID_SET_OUTPUT_ITEM: { ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 3: EID_SET_OUTPUT_ITEM"); int e = m_OutputItemSlots.size(); int iIndex = pEvent->GetIndex(); //assert( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() ); if( iIndex >= 0 && iIndex < (int)m_OutputItemSlots.size() ) { CItem* pItem = pEvent->GetItem(); ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 3: EID_SET_OUTPUT_ITEM Item Type %i Item ID %i", pItem->GetType(), pItem->GetItemNo()); //assert( pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL ); if( pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL ) { m_OutputItemSlots[iIndex].AttachIcon( pItem->CreateItemIcon() ); } else if( pItem && m_OutputItemSlots[iIndex].GetIcon() != NULL) { m_OutputItemSlots[iIndex].DetachIcon(); m_OutputItemSlots[iIndex].AttachIcon( pItem->CreateItemIcon() ); } else { assert(" pItem && m_OutputItemSlots[iIndex].GetIcon() == NULL ?? "); //PY: Logically speaking, this can never happen unless it is simultaineously neither NULL or Not NULL. Duhh!! } } break; } case CTEventSeparate::EID_RECEIVE_RESULT: { ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Event 5: EID_RECEIVE_RESULT"); ChangeState( STATE_RESULT ); break; } default: { ClientLog (LOG_NORMAL, "CSeperateDlg::Update. Invalid Seperate Event"); assert( 0 && "Invalid Separate Event Type" ); } break; } }
bool CTCmdDragItemFromInvenInItemDlg::Exec( CTObject* pObj ) { if( pObj == NULL ) return true; if( strcmp( pObj->toString(), "CIcon" ) ) return true; CTDialog* pDlg = g_itMGR.FindDlg( DLG_TYPE_ITEM ); if( pDlg == NULL ) return true; CIconItem* pItemIcon = (CIconItem*)pObj; CItemDlg* pItemDlg = (CItemDlg*)pDlg; POINT ptMouse; CGame::GetInstance().Get_MousePos( ptMouse ); if( pItemDlg->IsInsideEquip( ptMouse ) ) { int iItemType = pItemIcon->GetItem().GetTYPE(); /// @brief 보석 아이템이라면.. if( iItemType == ITEM_TYPE_GEM ) { int iEquipSlot = pItemDlg->GetEquipSlot( ptMouse ); if( iEquipSlot < 0 ) return false; tagITEM& Item = g_pAVATAR->m_Inventory.m_ItemEQUIP[ iEquipSlot ]; /// 소켓이 있다면.. if( Item.HasSocket() ) { g_pNet->Send_cli_CRAFT_GEMMING_REQ( iEquipSlot, pItemIcon->GetIndex() ); } return true; } /// 사용아이템은 드래그로 기본 동작( 장착 )을 처리하지 않는다. if( pItemIcon->GetItem().GetTYPE() != ITEM_TYPE_USE ) pItemIcon->ExecuteCommand(); } else if( CSlot* pTargetSlot = pItemDlg->GetInvenSlot( ptMouse) ) { if( CIcon* pTargetIcon = pTargetSlot->GetIcon() ) { CItem* pTempItem = ((CIconItem*)pTargetIcon)->GetCItem(); assert( pTempItem ); pTargetSlot->DetachIcon(); CSlot* pSourceSlot = pItemIcon->GetSlot(); assert( pSourceSlot ); CItem* pSourceItem = pItemIcon->GetCItem(); assert( pSourceItem ); pSourceSlot->DetachIcon(); pTargetSlot->AttachIcon( pSourceItem->CreateItemIcon() ); pSourceSlot->AttachIcon( pTempItem->CreateItemIcon() ); } else { CSlot* pSourceSlot = pItemIcon->GetSlot(); CItem* pSourceItem = pItemIcon->GetCItem(); pSourceSlot->DetachIcon(); pTargetSlot->AttachIcon( pSourceItem->CreateItemIcon() ); } } return true; }