void CPetResurrectionDialog::OnActionEvent(LONG lId, void* p, DWORD we)
{
	if( lId == PET_RES_DLG_CANCEL )
	{
		SetActive( FALSE );

		// 081021 LYW --- PetResurrectionDialog : 아이템의 락을 풀어준다.
		if( mUsedItem ) mUsedItem->SetLock( FALSE ) ;
	}

	if( lId == PET_RES_DLG_OK )
	{
		CItem* pItem = ( CItem* )( mSourceItem->GetLinkItem() );
		if( !pItem )
			return;

		mMessage.Category = MP_PET;
		mMessage.Protocol = MP_PET_RESURRECTION_SYN;
		mMessage.dwObjectID = HEROID;
		mMessage.dwData1 = pItem->GetDBIdx();
		mMessage.dwData2 = mUsedItem->GetPosition();
		mMessage.dwData3 = mUsedItem->GetItemIdx();
		
		GAMEIN->GetInventoryDialog()->SetCoolTime( mUsedItem->GetItemIdx(), WAITMILISECOND );

		{
			cQuickSlotDlg* dialog = ( cQuickSlotDlg* )WINDOWMGR->GetWindowForID( QI1_QUICKSLOTDLG );
			ASSERT( dialog );

			//dialog->SetCoolTime( pItem->GetItemIdx(), changeSecond );
			dialog->SetCoolTime( mUsedItem->GetItemIdx(), WAITMILISECOND );
		}

		{
			CProgressDialog* dialog = ( CProgressDialog* )WINDOWMGR->GetWindowForID( PROGRESS_DIALOG );
			ASSERT( dialog );

			// 081112 LYW --- PetResurrectionDialog : 펫을 부활할 때, 
			// 프로그레스 바의 출력 메시지를 부활중이라는 메시지로 수정 함.(정진문)
			dialog->SetText( CHATMGR->GetChatMsg( 1740 ) ) ;

			dialog->Wait( CProgressDialog::eActionPetResurrection );
		}
	}
}
BOOL CPetResurrectionDialog::FakeMoveIcon( LONG x, LONG y, cIcon* icon )
{
	if( WT_ITEM != icon->GetType() ||
		icon->IsLocked()			||
		m_bDisable )
	{
		return FALSE;
	}

	CItem* pItem = (CItem *)icon;

	if( pItem->GetItemInfo()->SupplyType != ITEM_KIND_PET )
	{
		return FALSE;
	}

	PET_OBJECT_INFO* pPetObjectInfo = PETMGR->GetPetObjectInfo( pItem->GetDBIdx() );

	if( !pPetObjectInfo )
	{
		return FALSE;
	}

	if( pPetObjectInfo->State != ePetState_Die )
	{
		return FALSE;
	}

	CItem* old = ( CItem* )( mSourceItem->GetLinkItem() );
	if( old )
		old->SetLock( FALSE );

	mSourceItem->SetData( pItem->GetItemIdx() );
	mSourceItem->SetLinkItem( pItem );

	ITEMMGR->AddToolTip( mSourceItem );

	mIconDialog->AddIcon( 0, mSourceItem );

	pItem->SetLock( TRUE );

	return FALSE;
}
Пример #3
0
void CNoteManager::NetworkMsgParse(BYTE Protocol,void* pMsg)
{
	switch(Protocol)
	{
		case MP_NOTE_RECEIVENOTE:
		{
			if(GAMEIN->GetNoteDialog()->IsActive() == TRUE)
			{
				NoteListSyn(GAMEIN->GetNoteDialog()->GetSelectedNotePge());
			}
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(933));						
		}
		break;
	case MP_NOTE_NEW_NOTE:
		{
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(934));
			if(GAMEIN->GetNoteDialog()->IsActive() == TRUE)
				NoteListSyn(1);
		}
		break;
	case MP_NOTE_SENDNOTE_ACK:
		{
			MSG_NAME *pmsg = (MSG_NAME*) pMsg;
			GAMEIN->GetMiniNoteDialogWrite()->SetActive(FALSE);
			CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(935), pmsg->Name );
		}
		break;
	case MP_NOTE_NOTELIST_ACK:
		{
			MSG_FRIEND_NOTE_LIST* pmsg = (MSG_FRIEND_NOTE_LIST*) pMsg;
			GAMEIN->GetNoteDialog()->SetNoteList(pmsg);
		}
		break;
	case MP_NOTE_DELNOTE_ACK:
		{
			MSG_FRIEND_DEL_NOTE* pmsg = (MSG_FRIEND_DEL_NOTE*)pMsg;
			if(pmsg->bLast)
			{
				NoteListSyn(GAMEIN->GetNoteDialog()->GetSelectedNotePge(), GAMEIN->GetNoteDialog()->GetMode());
			}
			
			if(pmsg->NoteID == GAMEIN->GetMiniNoteDialogRead()->GetNoteID())
			{
				GAMEIN->GetMiniNoteDialogRead()->SetActive(FALSE);
			}

			GAMEIN->GetMiniNoteDialogWrite()->SetActive(FALSE);
		}
		break;
	case MP_NOTE_SAVENOTE_ACK:
		{
			MSG_DWORD2* pmsg = (MSG_DWORD2*)pMsg;
			if(pmsg->dwData2)
			{
				NoteListSyn(GAMEIN->GetNoteDialog()->GetSelectedNotePge(), GAMEIN->GetNoteDialog()->GetMode());
			}
			GAMEIN->GetMiniNoteDialogWrite()->SetActive(FALSE);
		}
		break;
	case MP_NOTE_READNOTE_ACK:
		{
			MSG_FRIEND_READ_NOTE * pmsg = (MSG_FRIEND_READ_NOTE*)pMsg;

			{
				CMiniNoteDialogRead* dialog = GAMEIN->GetMiniNoteDialogRead();
				ASSERT( dialog );

				// desc_hseos_농장시스템_01
				// S 농장시스템 추가 added by hseos 2008.01.16
				if (stricmp(pmsg->FromName, "<SYSTEM>") == 0)
				{
					int nMsgID = atoi(pmsg->Note);
					if (nMsgID && 
						CHATMGR->GetChatMsg(nMsgID))
					{
						
						SafeStrCpy(pmsg->Note, CHATMGR->GetChatMsg(nMsgID), MAX_NOTE_LENGTH - 1);
					}
				}
				// E 농장시스템 추가 added by hseos 2008.01.16

				char* pSendDate = NULL;
				char* pTitle = NULL;
				CNoteDialog* noteDialog = GAMEIN->GetNoteDialog();
				if(noteDialog)
				{
					pSendDate = noteDialog->GetSendDate(pmsg->NoteID);
					pTitle = noteDialog->GetTitle(pmsg->NoteID);
				}

				dialog->SetMiniNote(pTitle, pSendDate, pmsg->FromName, pmsg->Note, pmsg->ItemIdx);
				dialog->SetPackageInfo(pmsg->dwPackageMoney, NULL, NULL);
				dialog->SetNoteID(pmsg->NoteID);
				dialog->SetActive(TRUE);

				noteDialog->Refresh( pmsg->NoteID );
			}
		}
		break;
	case MP_NOTE_READNOTE_WITH_PACKAGE_ACK:
		{
			MSG_FRIEND_READ_NOTE_WITH_PACKAGE * pmsg = (MSG_FRIEND_READ_NOTE_WITH_PACKAGE*)pMsg;

			CMiniNoteDialogRead* dialog = GAMEIN->GetMiniNoteDialogRead();
			ASSERT( dialog );

			char* pSendDate = NULL;
			char* pTitle = NULL;
			CNoteDialog* noteDialog = GAMEIN->GetNoteDialog();
			if(noteDialog)
			{
				pSendDate = noteDialog->GetSendDate(pmsg->NoteID);
				pTitle = noteDialog->GetTitle(pmsg->NoteID);
			}

			dialog->SetMiniNote(pTitle, pSendDate, pmsg->FromName, pmsg->Note, pmsg->ItemIdx);
			dialog->SetPackageInfo(pmsg->PackageMoney, &pmsg->ItemInfo, &pmsg->OptionInfo);
			dialog->SetNoteID(pmsg->NoteID);
			dialog->SetActive(TRUE);

			noteDialog->Refresh( pmsg->NoteID );
		}
		break;
		
	case MP_NOTE_GETPACKAGE_NACK:
		{
			MSG_DWORD* pmsg = (MSG_DWORD*)pMsg;

			switch(pmsg->dwData)
			{
			case eConsignmentERR_PoorSlot:
				{
					CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(1520) );
				}
				break;

			case eConsignmentERR_GoldOver:
				{
					CHATMGR->AddMsg(CTC_SYSMSG, CHATMGR->GetChatMsg(475) );
				}
				break;
			}

		}
		break;

	case MP_NOTE_GETPACKAGE_ACK:
		{
			ITEMOBTAINARRAY * pmsg = (ITEMOBTAINARRAY *)pMsg;												// 아이템 획득 정보를 담을 포인터를 선언하고 메시지를 받는다.

			CItem* pItem = NULL;																			// 아이템 정보를 담을 포인터를 선언하고 null처리를 한다.

			for(WORD i = 0; i < pmsg->ItemNum; ++i )
			{
				ITEMBASE& itemBase = pmsg->ItemInfo[ i ];
				pItem = GAMEIN->GetInventoryDialog()->GetItemForPos( pmsg->GetItem(i)->Position);

				ITEMBASE prevItemBase;
				ZeroMemory( &prevItemBase, sizeof( prevItemBase ) );

				if(pItem)
				{
					if( pItem->GetDBIdx() == itemBase.dwDBIdx )
					{
						prevItemBase = pItem->GetItemBaseInfo();
					}

					pItem->SetItemBaseInfo( itemBase );												// 아이템 기본 정보를 세팅한다.
				}
				else																						// 아이템 정보가 유효하지 않으면,
				{
					pItem = ITEMMGR->MakeNewItem(pmsg->GetItem(i),"MP_NOTE_GETPACKAGE_ACK");					// 새로 아이템을 생성해 포인터로 받는다.
					
					const ITEM_INFO* pInfo = ITEMMGR->GetItemInfo( pItem->GetItemIdx() ) ;
					if( !pInfo ) continue;

					if( pInfo->wSeal == eITEM_TYPE_SEAL )
					{
						itemBase.nSealed = eITEM_TYPE_SEAL ;
						itemBase.nRemainSecond = pInfo->dwUseTime ;

						pItem->SetItemBaseInfo( itemBase ) ;
					}

					GAMEIN->GetInventoryDialog()->AddItem(pItem);
				}
			}

			if( pItem )
			{
				ITEMMGR->ItemDropEffect( pItem->GetItemIdx() );
			}

			QUICKMGR->RefreshQickItem();
		}
		break;

	case MP_NOTE_GETPACKAGE_NOTIFY:
		{
			MSG_DWORD4* pmsg = (MSG_DWORD4*)pMsg;
			const ITEM_INFO* pInfo = ITEMMGR->GetItemInfo( pmsg->dwData3 ) ;
			if(pInfo)
			{
				if( pInfo->Stack )
					CHATMGR->AddMsg( CTC_GETITEM, CHATMGR->GetChatMsg( 1112 ), pInfo->ItemName, pmsg->dwData4 );
				else
					CHATMGR->AddMsg( CTC_GETITEM, CHATMGR->GetChatMsg( 101 ), pInfo->ItemName );
			}

			DWORD dwNoteID = 0;
			CMiniNoteDialogRead* pReadDlg = GAMEIN->GetMiniNoteDialogRead();
			if(pReadDlg)
			{
				dwNoteID = pReadDlg->GetNoteID();
				pReadDlg->SetPackageInfo(0, NULL, NULL);
			}

			CNoteDialog* pNoteDlg = GAMEIN->GetNoteDialog();
			if(pNoteDlg)
			{
				pNoteDlg->ClearPackageInfo(dwNoteID);
				pNoteDlg->Refresh(dwNoteID);
			}
		}
		break;
		
	//////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////
	//nack 	
	case MP_NOTE_SENDNOTE_NACK:
		{
			MSG_NAME_WORD * pmsg = (MSG_NAME_WORD *)pMsg;
			if(pmsg->wData == 2) //invalid user
				CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(936) );
			else if(pmsg->wData == 3) //full list
				CHATMGR->AddMsg( CTC_SYSMSG, CHATMGR->GetChatMsg(937), pmsg->Name );
		}
		break;
	}

}