void CSubProcPerTrade::SecureCodeBegin() { // 1.상거래 중이면 개인 거래 신청이 않된다.. -> 해당 부분.. ok // 2.상거래 중에 개인 거래 신청을 받으면 거절.. -> 해당 부분.. ok // 3.유저가 움직이고 있는 중이면 멈춘다.. if ( s_pPlayer->IsMovingNow() ) s_pPlayer->ToggleMoveMode(); // 자동 전진 토글.. // 4.아이콘 매니저 윈도우는 모두 닫는다.. // 인벤토리 윈도우이면.. if ( CGameProcedure::s_pProcMain->m_pUIInventory->IsVisible() ) CGameProcedure::s_pProcMain->m_pUIInventory->Close(); // Drop Item 윈도우이면.. if ( CGameProcedure::s_pProcMain->m_pUIDroppedItemDlg->IsVisible() ) CGameProcedure::s_pProcMain->m_pUIDroppedItemDlg->LeaveDroppedState(); // 5.인풋을 막는다.. -> 해당 부분.. ok (키입력과 메시지..) // 6.거래창의 편집 Control의 값을 Clear.. CN3UIString* pStrMy = (CN3UIString* )m_pUIPerTradeDlg->GetChildByID("string_money_my"); __ASSERT(pStrMy, "NULL UI Component!!"); CN3UIString* pStrOther = (CN3UIString* )m_pUIPerTradeDlg->GetChildByID("string_money_other"); __ASSERT(pStrOther, "NULL UI Component!!"); pStrMy->SetString("0"); pStrOther->SetString("0"); // 7.개인 거래 창의 처크 버튼들 원래대로.. CN3UIButton* pButtonMy = (CN3UIButton* )m_pUIPerTradeDlg->GetChildByID("btn_trade_my"); __ASSERT(pButtonMy, "NULL UI Component!!"); pButtonMy->SetState(UI_STATE_BUTTON_NORMAL); CN3UIButton* pButtonOther = (CN3UIButton* )m_pUIPerTradeDlg->GetChildByID("btn_trade_other"); __ASSERT(pButtonOther, "NULL UI Component!!"); pButtonOther->SetState(UI_STATE_BUTTON_NORMAL); // 8.상대방 거래 버튼은 Click할 수 없다. uif 자체 기능.. }
void CSubProcPerTrade::ReceiveMsgPerTradeDoneSuccessBegin(int iTotalGold) { char szGold[32]; sprintf(szGold, "%d", iTotalGold); CN3UIString* pString = NULL; pString = (CN3UIString* )CGameProcedure::s_pProcMain->m_pUIInventory->GetChildByID("text_gold"); __ASSERT(pString, "NULL UI Component!!"); pString->SetString(szGold); s_pPlayer->m_InfoExt.iGold = iTotalGold; }
bool CN3UIList::SetString(int iIndex, const std::string& szString) { if(iIndex < 0 || iIndex >= m_ListString.size()) return false; it_pString it = m_ListString.begin(); for(int i = 0; i < iIndex; it++, i++); CN3UIString* pUIString = (*it); pUIString->SetString(szString); return false; }
int CN3UIList::AddString(const std::string& szString) { CN3UIString* pString = new CN3UIString(); pString->Init(this); pString->SetFont(m_szFontName, m_dwFontHeight, m_bFontBold, m_bFontItalic); pString->SetColor(m_crFont); pString->SetString(szString); m_ListString.push_back(pString); this->UpdateChildRegions(); return m_ListString.size() - 1; }
void CUIItemExchange::UpdateGoldValue() { char szGold[32]; CN3UIString* pStrGold = (CN3UIString* )GetChildByID("string_gold"); __ASSERT(pStrGold, "NULL UI Component!!"); if ( pStrGold ) { // 돈 업데이트.. sprintf(szGold, "%d", m_pTotalPrice); pStrGold->SetString(szGold); } }
bool CUILoadingDlg::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; CN3UIString* pText = (CN3UIString*)(CN3UIBase::GetChildByID("Text_Version")); __ASSERT(pText, "NULL UI Component!!"); if(pText) { char szVersion[128]; sprintf(szVersion, "%.3f", CURRENT_VERSION/1000.0f); pText->SetString(szVersion); } return true; }
void CUIItemExchange::UpdateUserTotalGold(int iGold) { char szGold[32]; CN3UIString* pStatic = NULL; // 돈 업데이트.. CGameBase::s_pPlayer->m_InfoExt.iGold = iGold; sprintf(szGold, "%d", iGold); pStatic = (CN3UIString* )CGameProcedure::s_pProcMain->m_pUIInventory->GetChildByID("text_gold"); __ASSERT(pStatic, "NULL UI Component!!"); if(pStatic) { pStatic->SetString(szGold); } }
int CN3UIList::AddStrings(const std::string* pszStrings, int iStringCount) { for(int i = 0; i < iStringCount; i++) { CN3UIString* pString = new CN3UIString(); pString->Init(this); pString->SetFont(m_szFontName, m_dwFontHeight, m_bFontBold, m_bFontItalic); pString->SetColor(m_crFont); pString->SetString(pszStrings[i]); m_ListString.push_back(pString); } this->UpdateChildRegions(); return m_ListString.size() - 1; }
bool CN3UIList::InsertString(int iIndex, const std::string& szString) { if(iIndex < 0 || iIndex >= m_ListString.size()) return false; CN3UIString* pString = new CN3UIString(); pString->Init(this); pString->SetFont(m_szFontName, m_dwFontHeight, m_bFontBold, m_bFontItalic); pString->SetColor(m_crFont); pString->SetString(szString); it_pString it = m_ListString.begin(); for(int i = 0; i < iIndex; it++); m_ListString.insert(it, pString); return true; this->UpdateChildRegions(); }
void CSubProcPerTrade::ReceiveMsgPerTradeOtherAdd(int iItemID, int iCount, int iDurability) { char szGold[32]; std::string str; int iGold, iDestiOrder; // 거래창의 값.. if ( iItemID == dwGold ) { // 거래 창의 다른 사람의 현재 돈을 얻어 온다.. CN3UIString* pStrOther = (CN3UIString* )m_pUIPerTradeDlg->GetChildByID("string_money_other"); __ASSERT(pStrOther, "NULL UI Component!!"); str = pStrOther->GetString(); iGold = atoi(str.c_str()); // 돈을 더한 다음.. iGold += iCount; // 돈 표시.. 개인 거래 창.. sprintf(szGold, "%d", iGold); pStrOther->SetString(szGold); } else { // 아이템이 들어갈 수 있는지 확인, 아이템이 들어 가는 자리 계산.. bool bFound = false; // 아이템 만들어서 넣기.. __TABLE_ITEM_BASIC* pItem = NULL; __TABLE_ITEM_EXT* pItemExt = NULL; pItem = s_pTbl_Items_Basic->Find(iItemID/1000*1000); // 열 데이터 얻기.. if(pItem && pItem->byExtIndex >= 0 && pItem->byExtIndex < MAX_ITEM_EXTENSION) pItemExt = CGameBase::s_pTbl_Items_Exts[pItem->byExtIndex]->Find(iItemID%1000); if(NULL == pItem || NULL == pItemExt) { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); return; } if( (pItem->byContable == UIITEM_TYPE_COUNTABLE) || (pItem->byContable == UIITEM_TYPE_COUNTABLE_SMALL) ) { for( int i = 0; i < MAX_ITEM_PER_TRADE; i++ ) { if( (m_pUIPerTradeDlg->m_pPerTradeOther[i]) && (m_pUIPerTradeDlg->m_pPerTradeOther[i]->pItemBasic->dwID == pItem->dwID) ) { bFound = true; iDestiOrder = i; break; } } // 못찾았으면.. if ( !bFound ) { // 인벤토리 빈슬롯을 찾아 들어간다.. for(int i = 0; i < MAX_ITEM_PER_TRADE; i++ ) { if ( !m_pUIPerTradeDlg->m_pPerTradeOther[i] ) { bFound = true; iDestiOrder = i; break; } } if ( !bFound ) // 빈 슬롯을 찾지 못했으면.. return; } if ( m_pUIPerTradeDlg->m_pPerTradeOther[iDestiOrder] ) // 해당 위치에 아이콘이 있으면.. { m_pUIPerTradeDlg->m_pPerTradeOther[iDestiOrder]->iCount += iCount; } else { std::string szIconFN; e_PartPosition ePart; e_PlugPosition ePlug; CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서 __IconItemSkill* spItem; spItem = new __IconItemSkill; spItem->pItemBasic = pItem; spItem->pItemExt = pItemExt; spItem->szIconFN = szIconFN; // 아이콘 파일 이름 복사.. spItem->iCount = iCount; spItem->iDurability = iDurability; float fUVAspect = (float)45.0f/(float)64.0f; spItem->pUIIcon = new CN3UIIcon; spItem->pUIIcon->Init(m_pUIPerTradeDlg); spItem->pUIIcon->SetTex(szIconFN); spItem->pUIIcon->SetUVRect(0,0,fUVAspect,fUVAspect); spItem->pUIIcon->SetUIType(UI_TYPE_ICON); spItem->pUIIcon->SetStyle(UISTYLE_ICON_ITEM|UISTYLE_ICON_CERTIFICATION_NEED); spItem->pUIIcon->SetVisible(true); CN3UIArea* pArea = NULL; //pArea = m_pUIPerTradeDlg->GetChildAreaByiOrder(UI_AREA_TYPE_PER_TRADE_OTHER, i); if ( pArea ) { spItem->pUIIcon->SetRegion(pArea->GetRegion()); // 움직일 수 없다.. RECT rect = { 0, 0, 0, 0 }; spItem->pUIIcon->SetMoveRect(rect); } //m_pUIPerTradeDlg->m_pPerTradeOther[i] = spItem; } } else { for( int i = 0; i < MAX_ITEM_PER_TRADE; i++ ) { if (m_pUIPerTradeDlg->m_pPerTradeOther[i] == NULL) { bFound = true; break; } } if ( !bFound ) return; // 못 찾았으므로.. 실패.. std::string szIconFN; e_PartPosition ePart; e_PlugPosition ePlug; CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서 __IconItemSkill* spItem; spItem = new __IconItemSkill; spItem->pItemBasic = pItem; spItem->pItemExt = pItemExt; spItem->szIconFN = szIconFN; // 아이콘 파일 이름 복사.. spItem->iCount = 1; spItem->iDurability = iDurability; float fUVAspect = (float)45.0f/(float)64.0f; spItem->pUIIcon = new CN3UIIcon; spItem->pUIIcon->Init(m_pUIPerTradeDlg); spItem->pUIIcon->SetTex(szIconFN); spItem->pUIIcon->SetUVRect(0,0,fUVAspect,fUVAspect); spItem->pUIIcon->SetUIType(UI_TYPE_ICON); spItem->pUIIcon->SetStyle(UISTYLE_ICON_ITEM|UISTYLE_ICON_CERTIFICATION_NEED); spItem->pUIIcon->SetVisible(true); CN3UIArea* pArea = NULL; //pArea = m_pUIPerTradeDlg->GetChildAreaByiOrder(UI_AREA_TYPE_PER_TRADE_OTHER, i); if ( pArea ) { spItem->pUIIcon->SetRegion(pArea->GetRegion()); // 움직일 수 없다.. RECT rect = { 0, 0, 0, 0 }; spItem->pUIIcon->SetMoveRect(rect); } if ( spItem->iDurability == 0 ) spItem->pUIIcon->SetStyle(spItem->pUIIcon->GetStyle() | UISTYLE_DURABILITY_EXHAUST); //m_pUIPerTradeDlg->m_pPerTradeOther[i] = spItem; } } }
void CSubProcPerTrade::ReceiveMsgPerTradeAdd(BYTE bResult) { // 상태를 변화시키고.. 창을 닫고.. CN3UIWndBase::m_sRecoveryJobInfo.m_bWaitFromServer = false; char szGold[32]; std::string str; int iGold, // 거래창의 값.. iMyMoney; // 인벤토리의 값.. switch ( bResult ) { case 0x01: break; case 0x00: // 실패 했을 경우.. 복구한다.. // 전에 작업한 아이템 종류가 돈인 경우.. switch ( m_ePerTradeItemKindBackup ) { case PER_TRADE_ITEM_MONEY: { // 거래 창의 내 현재 돈을 얻어 온다.. CN3UIString* pStrMy = (CN3UIString* )m_pUIPerTradeDlg->GetChildByID("string_money_my"); __ASSERT(pStrMy, "NULL UI Component!!"); str = pStrMy->GetString(); iGold = atoi(str.c_str()); // 현재 내가 가진 돈을 얻어 온다.. iMyMoney = s_pPlayer->m_InfoExt.iGold; // 돈을 증가 시킨다.. iMyMoney += m_iGoldOffsetBackup; s_pPlayer->m_InfoExt.iGold = iMyMoney; // 돈 표시.. 인벤토리.. sprintf(szGold, "%d", iMyMoney); CN3UIString* pString = NULL; pString = (CN3UIString* )CGameProcedure::s_pProcMain->m_pUIInventory->GetChildByID("text_gold"); __ASSERT(pString, "NULL UI Component!!"); if(pString) pString->SetString(szGold); if(m_pUIPerTradeDlg->m_pStrMyGold) m_pUIPerTradeDlg->m_pStrMyGold->SetString(szGold); // 돈 표시.. 개인 거래 창.. iGold -= m_iGoldOffsetBackup; sprintf(szGold, "%d", iGold); pStrMy->SetString(szGold); } break; case PER_TRADE_ITEM_OTHER: { // 전에 작업한 아이템 종류가 아이템인 경우.. if( (m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]-> pItemBasic->byContable == UIITEM_TYPE_COUNTABLE) || (m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]-> pItemBasic->byContable == UIITEM_TYPE_COUNTABLE_SMALL) ) { // 활이나 물약등 아이템인 경우.. bool bFound = false; // 인벤토리에 아이템이 없어진 경우.. 만든다.. if ( !m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder] ) { bFound = true; // 인벤토리에 만들고 아이템의 갯수를 정해준다.. __IconItemSkill *spItem, *spItemNew = NULL; spItem = m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]; // 아이콘이 없으면 아이콘을 만드록 갯수는 0으로.. spItemNew = new __IconItemSkill; spItemNew->pItemBasic = spItem->pItemBasic; spItemNew->pItemExt = spItem->pItemExt; spItemNew->szIconFN = spItem->szIconFN; // 아이콘 파일 이름 복사.. spItemNew->iCount = m_pUIPerTradeDlg->m_iBackupiCount; spItemNew->iDurability = spItem->iDurability; // 아이콘 리소스 만들기.. spItemNew->pUIIcon = new CN3UIIcon; float fUVAspect = (float)45.0f/(float)64.0f; spItemNew->pUIIcon->Init(m_pUIPerTradeDlg); spItemNew->pUIIcon->SetTex(spItemNew->szIconFN); spItemNew->pUIIcon->SetUVRect(0,0, fUVAspect, fUVAspect); spItemNew->pUIIcon->SetUIType(UI_TYPE_ICON); spItemNew->pUIIcon->SetStyle(UISTYLE_ICON_ITEM|UISTYLE_ICON_CERTIFICATION_NEED); spItemNew->pUIIcon->SetVisible(true); CN3UIArea* pArea; pArea = m_pUIPerTradeDlg->GetChildAreaByiOrder(UI_AREA_TYPE_PER_TRADE_INV, CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder); if ( pArea ) { spItemNew->pUIIcon->SetRegion(pArea->GetRegion()); spItemNew->pUIIcon->SetMoveRect(pArea->GetRegion()); } m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder] = spItemNew; // 내 거래창의 아이템이 있는 경우 .. 갯수 갱신.. if ( m_pUIPerTradeDlg->m_iBackupiCount != m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]->iCount ) { m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]->iCount -= m_pUIPerTradeDlg->m_iBackupiCount; } } // 아이콘이 내 거래창의 슬롯에 생긴경우.. 삭제한다.. if ( m_pUIPerTradeDlg->m_iBackupiCount == m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]->iCount ) { bFound = true; __IconItemSkill* spItem; spItem = m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]; // 매니저에서 제거.. m_pUIPerTradeDlg->RemoveChild(spItem->pUIIcon); // 리소스 제거.. spItem->pUIIcon->Release(); delete spItem->pUIIcon; spItem->pUIIcon = NULL; delete spItem; spItem = NULL; m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder] = NULL; // 인벤토리에 아이템이 있는 경우.. 갯수 갱신.. if ( m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder] ) { m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder]->iCount += m_pUIPerTradeDlg->m_iBackupiCount; } } // 위에서 갯수 보정한게 아니면.. 갯수만 보정한다.. if ( !bFound) { // 내 거래창과 인벤토리의 아이템의 갯수를 정해준다.. m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder]->iCount += m_pUIPerTradeDlg->m_iBackupiCount; m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder]->iCount -= m_pUIPerTradeDlg->m_iBackupiCount; } } else { __IconItemSkill* spItem; spItem = CN3UIWndBase::m_sRecoveryJobInfo.pItemSource; spItem->pUIIcon->SetParent(m_pUIPerTradeDlg); // 인벤토리 윈도우에 세팅하고.. m_pUIPerTradeDlg->m_pPerTradeInv[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder] = spItem; // 내 거래 윈도우에서 클리어.. m_pUIPerTradeDlg->m_pPerTradeMy[CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceEnd.iOrder] = NULL; CN3UIArea* pArea; pArea = m_pUIPerTradeDlg->GetChildAreaByiOrder(UI_AREA_TYPE_PER_TRADE_INV, CN3UIWndBase::m_sRecoveryJobInfo.UIWndSourceStart.iOrder); if ( pArea ) { spItem->pUIIcon->SetRegion(pArea->GetRegion()); spItem->pUIIcon->SetMoveRect(pArea->GetRegion()); } } } break; } break; } }
void CSubProcPerTrade::ItemCountEditOK() { char szGold[32]; std::string str; int iGold, // 거래창의 값.. iGoldOffset, // 편집창의 값.. iMyMoney; // 인벤토리의 값.. // 거래 창의 내 현재 돈을 얻어 온다.. CN3UIString* pStrMy = (CN3UIString* )m_pUIPerTradeDlg->GetChildByID("string_money_my"); __ASSERT(pStrMy, "NULL UI Component!!"); str = pStrMy->GetString(); iGold = atoi(str.c_str()); // 입력 창의 값을 얻어서 iGoldOffset = m_pUITradeEditDlg->GetQuantity(); // Gold Offset Backup.. m_iGoldOffsetBackup = iGoldOffset; // 현재 내가 가진 돈을 얻어 온다.. iMyMoney = s_pPlayer->m_InfoExt.iGold; if ( iGoldOffset <= 0 ) return; if ( iGoldOffset > iMyMoney ) return; // 돈을 감소 시킨다.. iMyMoney -= iGoldOffset; s_pPlayer->m_InfoExt.iGold = iMyMoney; // 돈 표시.. 인벤토리.. sprintf(szGold, "%d", iMyMoney); CN3UIString* pString = NULL; pString = (CN3UIString* )CGameProcedure::s_pProcMain->m_pUIInventory->GetChildByID("text_gold"); __ASSERT(pString, "NULL UI Component!!"); if(pString) pString->SetString(szGold); if(m_pUIPerTradeDlg->m_pStrMyGold) m_pUIPerTradeDlg->m_pStrMyGold->SetString(szGold); // 돈 표시.. 개인 거래 창.. iGold += iGoldOffset; sprintf(szGold, "%d", iGold); pStrMy->SetString(szGold); // 서버에게 전송한다.. BYTE byBuff[16]; // 패킷 버퍼.. int iOffset=0; // 패킷 오프셋.. // 서버에게 패킷 만들어서 날림.. CAPISocket::MP_AddByte(byBuff, iOffset, N3_PER_TRADE); CAPISocket::MP_AddByte(byBuff, iOffset, N3_SP_PER_TRADE_ADD); CAPISocket::MP_AddByte(byBuff, iOffset, 0xff); CAPISocket::MP_AddDword(byBuff, iOffset, dwGold); CAPISocket::MP_AddDword(byBuff, iOffset, iGoldOffset); CGameProcedure::s_pSocket->Send(byBuff, iOffset); // 보냄.. m_pUITradeEditDlg->SetQuantity(0); // 상태를 변화시키고.. 창을 닫고.. CN3UIWndBase::m_sRecoveryJobInfo.m_bWaitFromServer = true; m_ePerTradeState = PER_TRADE_STATE_NORMAL; m_ePerTradeItemKindBackup = PER_TRADE_ITEM_MONEY; m_pUITradeEditDlg->Close(); m_pUIPerTradeDlg->PlayGoldSound(); }