#include "stdafx.h" #include "SGameManager.h" #include "SUIJewelEquipWnd.h" #include "SUIDisplayInfo.h" #include "SUIDefine.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SUISysMsgDefine.h" #include "ErrorCode/ErrorCode.h" #include "KUIDragAndDrop.h" #include "KUIControlStatic.h" #include "SInventoryMgr.h" #include "SPlayerInfoMgr.h" #include "SStringDB.h" #include "SItemDB.h" #include #include "SUILazyTooltip.h" #include "SGameSystem.h" extern SGameSystem * g_pCurrentGameSystem; namespace { enum { CANT, EQUIP, MAIN, JEWEL }; const char* ItemSocketsList[6] = { "icon_socket00", "icon_socket01", "icon_socket02", "icon_socket03", "icon_socket04", "icon_socket05" }; const char* ItemIconsList[6] = { "static_inventory_weapon", "static_inventory_armor" "static_inventory_shield", "static_inventory_helm", "static_inventory_glove", "static_inventory_boots", }; const char* pWeaponSocket = "icon_socket00"; // Socket #1; weapon socket const char* pArmorSocket = "icon_socket01"; // Socket #2; armor socket const char* pShieldSocket = "icon_socket02"; // Socket #3; shield socket const char* pHelmetSocket = "icon_socket03"; // Socket #4; helmet socket const char* pGlovesSocket = "icon_socket04"; // Socket #5; gloves socket const char* pBootsSocket = "icon_socket05"; // Socket #6; boots socket const char* lpSoketCtr1 = "icon_socket06"; // Soulstone Socket 1 const char* lpSoketCtr2 = "icon_socket07"; // Soulstone Socket 2 const char* lpSoketCtr3 = "icon_socket08"; // Soulstone Socket 3 const char* lpSoketCtr4 = "icon_socket09"; // Soulstone Socket 4 const char* pEssenceSlot = "icon_socket10"; // Soulstone Essence socket const char* pGaugeWeapon = "gauge_00"; // Weapon ethereal durability bar const char* pGaugeArmor = "gauge_01"; // Armor ethereal durability bar const char* pGaugeShield = "gauge_02"; // Shield ethereal durability bar const char* pGaugeHelmet = "gauge_03"; // Helmet ethereal durability bar const char* pGaugeGloves = "gauge_04"; // Gloves ethereal durability bar const char* pGaugeBoots = "gauge_05"; // Boots ethereal durability bar const char* c_szStaticRp = "text_R"; // "R" letter (ruppees) const char* c_szStatickLak = "text_LAK"; // "LAK" text const float c_fPrice = 1.2f; // Item icons const char* lpShield = "icon_socket_shield"; const char* lpGlove = "icon_socket_glove"; const char* lpBoots = "icon_socket_boots"; const char* lpWeapon = "icon_socket_weapon"; const char* lpHelm = "icon_socket_helm"; const char* lpArmor = "icon_socket_armor"; } extern void MsgSplit( const char* szMsg, std::vector& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter=false ); bool SUIJewelEquipWnd::InitControls( KPoint kPos ) { SetCustomMovingRect( KRect( 0, 0, 312, 20 ) ); // Title bar selection area — click area for moving (the window) return SUIWnd::InitControls( kPos ); } bool SUIJewelEquipWnd::InitData( bool bReload ) { KUIControlMultiIcon* pJewelControl(NULL); pJewelControl = dynamicCast(GetChild( "icon_craftitem" )); if( pJewelControl ) pJewelControl->SetIconLayer( 4 ); pJewelControl = dynamicCast(GetChild( lpSoketCtr1 )); if( pJewelControl ) pJewelControl->SetIconLayer( 2 ); pJewelControl = dynamicCast(GetChild( lpSoketCtr2 )); if( pJewelControl ) pJewelControl->SetIconLayer( 2 ); pJewelControl = dynamicCast(GetChild( lpSoketCtr3 )); if( pJewelControl ) pJewelControl->SetIconLayer( 2 ); pJewelControl = dynamicCast(GetChild( lpSoketCtr4 )); if( pJewelControl ) pJewelControl->SetIconLayer( 2 ); return SUIWnd::InitData(bReload); } void SUIJewelEquipWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { if( bOpen ) { m_hMainItem = 0; m_nTotalPrice = 0; KUIControlMultiIcon* pJewelControl(NULL); for( int i(0); i < c_nJewelCnt; ++i ) { // 2010.09.20 - prodongi //m_hJewelItem[c_nJewelCnt] = 0; m_hJewelItem[i] = 0; //pJewelControl = dynamicCast(GetChild( lpSoketDisableCtr[i] )); //if( pJewelControl ) pJewelControl->SetShow(false); } RefreshPrice(); m_pManager->SetMouseClickWnd(this); //servantes 2010.12.16 } else { m_pManager->SetMouseClickWnd(NULL); //servantes 2010.12.16 } } void SUIJewelEquipWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK: { if (::strcmp(lpszControlID, "button_work_cancel") == 0) //servantes 2010.10.13 { RemoveAllSlot(); } else if( ::strcmp( lpszControlID, "button_ok" ) == 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_JEWEL_EQUIP, SR(966, "#@cost@#", m_nTotalPrice).c_str(), "Equip", true ) ); } else if( ::strcmp( lpszControlID, "button_close" ) == 0 ) { RemoveAllSlot(); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_JEWEL_EQUIP, false ) ); } } break; case KUI_MESSAGE::KGENWND_MOVE: // Mowing the window { LimitMoveWnd(); // Restrict so that it cannot go outside the game window } case KUI_MESSAGE::KICON_PRESSING: { if(m_bShiftKey || m_bControlKey) { RemoveJewelEquipSubItems(lpszControlID); } } break; case KUI_MESSAGE::KICON_DBLCLK: { RemoveJewelEquipSubItems(lpszControlID); } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUIJewelEquipWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg; if( pData->m_strString == "success" ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_SUCCESS_EQUIP_JEWEL), 99 ); // Socketing is completed. RemoveAllSlot(); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_JEWEL_EQUIP, false ) ); } else if( pData->m_strString == "Jewel_Equip" ) { std::vector< std::string > vToken; MsgSplit( pData->m_strText.c_str(), vToken, L"|" ); if( vToken.size() == 1 ) { if( vToken[0] == "Equip" ) ReqJewelEquipMsg(); } else if( vToken.size() == 2 ) { AR_HANDLE handle = ::atoi( vToken[0].c_str() ); int nIndex = ::atoi( vToken[1].c_str() ); AddJewelEquipItem( handle, nIndex ); } vToken.clear(); } } break; case IMSG_UI_MOVE: case KUI_MESSAGE::KGENWND_MOVE: // Mowing the window { LimitMoveWnd(); // Restrict so that it cannot go outside the game window } break; case IMSG_UI_FOCUS: { pMsg->bUse = true; } break; case IMSG_HOTKEY_EX: { SIMSG_HOTKEY_EX* pHotKey = dynamicCast(pMsg); if( pHotKey->wParam == VK_SHIFT ) m_bShiftKey = (pHotKey->bUp == 0); if( pHotKey->wParam == VK_CONTROL ) m_bControlKey = (pHotKey->bUp == 0); if( pHotKey->wParam == VK_MENU ) { bool bPreState = m_bAltKey; m_bAltKey = (pHotKey->bUp == 0); if( bPreState != m_bAltKey && IsShow() ) { RefreshAllSlot(); } } } break; case IMSG_SOULSTONE_MOVEITEM: { SIMSG_SOULSTONE_MOVEITEM* pData = dynamicCast(pMsg); AddItemFromInventory(pData->m_handle, -1); } break; } } bool SUIJewelEquipWnd::AddItemFromInventory(AR_HANDLE hItem, int nCtrIndex) { SInventorySlot* pSlot( m_InventoryMgr.GetItemInfo( hItem ) ); if( NULL == pSlot ) return false; const ItemBaseEx_info* pItemBase( GetItemDB().GetItemData( pSlot->GetItemCode() ) ); if( NULL == pItemBase ) return false; if( pItemBase->CheckFlag( ItemBase::FLAG_RANDOMIZABLE ) ) { TS_ITEM_BASE_INFO::LPRANDOM_OPTION const pRandomOption( pSlot->GetRandomOption() ); if( pRandomOption && false == pRandomOption->IsHaveData() ) { if( m_pDisplayInfo ) m_pDisplayInfo->AddSystemMessage( S( 690000049 ), 0); // Socketing of soul stone in unchecked item cannot be done return false; } } int nSlotCnt = 0; SInventorySlot* pMainSlot = m_InventoryMgr.GetItemInfo( m_hMainItem ); if( pMainSlot ) nSlotCnt = pMainSlot->GetJewelSlotCount(); if( nCtrIndex < 0 && pMainSlot != NULL ) { const TS_ITEM_INFO* pItemInfo = pMainSlot->GetItem(); for( int i = 0; i< nSlotCnt; ++i ) { // If the socket is empty if( pItemInfo->socket[i] == 0 && m_hJewelItem[i] == 0 ) { nCtrIndex = i; break; } } if( nCtrIndex < 0 ) { return false; } } if( pMainSlot != NULL ) { if( nCtrIndex >= nSlotCnt ) return false; } int nRegistType = AbleAddSlot(pSlot); if( nRegistType != MAIN && m_hMainItem == NULL ) return false; if( nRegistType == MAIN ) { RegistItem( pSlot->GetHandle() ); } else if( nRegistType == JEWEL ) { if( AbleEquipJewel( hItem, nCtrIndex ) == false ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_EQUIP_JEWEL_OVER), 99 ); // You can not have more than 2 Soul Stones socketed in the same weapon that increase the same stat. return false; } int nIndex = GetJewelIndex( GetJewelCnt( nCtrIndex ) ); if( nIndex != -1 ) { if( pMainSlot ) { TS_ITEM_INFO* pItemInfo = pMainSlot->GetItem(); if( pItemInfo->socket[nIndex] ) { std::string strData = CStringUtil::StringFormat( "%d|%d", pSlot->GetHandle(), nIndex ); m_pGameManager->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_JEWEL_EQUIP, S(965), strData.c_str(), true ) ); return false; } } AddJewelEquipItem( pSlot->GetHandle(), nIndex ); } } else if( nRegistType == CANT ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_NOT_JEWEL), 99 ); // Only Soul Stones can be socketed. return false; } else if( nRegistType == EQUIP ) { m_pDisplayInfo->AddSystemMessage(S(SYS_MSG_EQUIP_ITEM), 99 ); // The item is socketed already. return false; } if( nRegistType != CANT ) m_pGameManager->StartSound( m_pDisplayInfo->GetMaterialSound( GetItemDB().GetMaterial(pSlot->GetItemCode()) ) ); return true; } void* SUIJewelEquipWnd::Perform( KID id, KArg& msg ) { _CID( UI_BEGIN_DRAG ); _CID( UI_SEND_DROP ); _CID( UI_RECV_DROP ); if ( id == id_UI_BEGIN_DRAG ) { KUIBeginDragMessage* pBeginMsg = static_cast( &msg ); const char* szControlID = pBeginMsg->sDragControlID.c_str(); KUIControlMultiIcon* pWndMultiIcon = dynamicCast(GetChild( szControlID )); if( pWndMultiIcon ) { const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0); AR_HANDLE hItem(NULL); int nIndex = GetJewelIndex( szControlID ); if( nIndex != -1 ) hItem = m_hJewelItem[ nIndex ]; SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem ); if( pSlot ) { m_pDisplayInfo->SetUIDragInfo( new SUICombineItemDragInfo( hItem ) ); m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL ); pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon; } } return NULL; } else if ( id == id_UI_SEND_DROP ) { KUISendRecvDropMessage* pSendMsg = static_cast( &msg ); SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo(); if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_COMBINEITEM == pUIDragInfo->m_type ) { SUICombineItemDragInfo* pCombineDragInfo = (SUICombineItemDragInfo*)pUIDragInfo; // 동일한 창이 아닌 곳에 드롭했다면 슬롯을 비운다. if( pSendMsg->sRecvDropParentID != std::string(GetID()) ) { if( m_hMainItem == pCombineDragInfo->m_hItem ) RemoveAllSlot(); else RemoveJewelEquipItem( pCombineDragInfo->m_hItem ); } // Drag & Drop 정보 제거 m_pDisplayInfo->SetUIDragInfo(); } return NULL; } else if ( id == id_UI_RECV_DROP ) { KUISendRecvDropMessage* pRecvMsg = static_cast( &msg ); SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo(); if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_INVENITEM == pUIDragInfo->m_type ) // 인벤에서 드래그한 아이템인 경우에만 { SUIInvenItemDragInfo* pItemDragInfo( (SUIInvenItemDragInfo*)pUIDragInfo ); if( NULL == pItemDragInfo ) return NULL; AddItemFromInventory( pItemDragInfo->m_hItem, GetJewelIndex( pRecvMsg->sRecvDropControlID.c_str() ) ); } return NULL; } return SUIWnd::Perform( id, msg ); } <<<<<<< HEAD ======= // From ZONE source; dual crossbows >>>>>>> a34328224e914a577b99c79ec6e8ffbcea554a05 bool SUIJewelEquipWnd::IsTwoHandWeapon(SInventorySlot* pSlot) { if (!pSlot) return false; int nItemCode(pSlot->GetItemCode()); int nClass(GetItemDB().GetClassID(nItemCode)); if (nClass == ItemBase::CLASS_TWOHAND_SWORD || nClass == ItemBase::CLASS_TWOHAND_SPEAR || nClass == ItemBase::CLASS_TWOHAND_AXE || nClass == ItemBase::CLASS_TWOHAND_MACE || nClass == ItemBase::CLASS_HEAVY_BOW || nClass == ItemBase::CLASS_LIGHT_BOW || <<<<<<< HEAD nClass == ItemBase::CLASS_CROSSBOW || nClass == ItemBase::CLASS_TWOHAND_STAFF) //Double Crossbow ======= nClass == ItemBase::CLASS_CROSSBOW || nClass == ItemBase::CLASS_TWOHAND_STAFF) >>>>>>> a34328224e914a577b99c79ec6e8ffbcea554a05 return true; return false; } int SUIJewelEquipWnd::AbleAddSlot( SInventorySlot* pSlot ) { if( !pSlot ) return CANT; if( pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_FAILED ) ) // Failed enhance result { return CANT; } AR_HANDLE handle = pSlot->GetHandle(); int nItemCode( pSlot->GetItemCode() ); int nGroup = GetItemDB().GetGroup( nItemCode ); if( ItemBase::GROUP_WEAPON == nGroup || ItemBase::GROUP_ARMOR == nGroup || ItemBase::GROUP_SHIELD == nGroup || ItemBase::GROUP_HELM == nGroup || ItemBase::GROUP_GLOVE == nGroup || ItemBase::GROUP_BOOTS == nGroup || ItemBase::GROUP_DECO == nGroup || ItemBase::GROUP_FACE == nGroup || ItemBase::GROUP_MANTLE == nGroup) { return MAIN; } if( ItemBase::GROUP_SOULSTONE == nGroup ) { for( int i(0); i < c_nJewelCnt; ++i ) { if( m_hJewelItem[i] == handle ) { if( pSlot->GetItemCount() <= 1 ) { return EQUIP; } } } return JEWEL; } return CANT; } bool SUIJewelEquipWnd::AbleEquipJewel( AR_HANDLE hItem, int nCtrIndex ) { SInventorySlot* pEquipSlot( NULL ); SInventorySlot* pInsertSlot( m_InventoryMgr.GetItemInfo( hItem ) ); if( pInsertSlot == NULL ) return false; const ItemBaseEx_info* pEquipItemInfo( NULL ); const ItemBaseEx_info* pInsertItemInfo( GetItemDB().GetItemData( pInsertSlot->GetItemCode() ) ); SInventorySlot* pMainSlot = m_InventoryMgr.GetItemInfo( m_hMainItem ); if( NULL == pMainSlot ) return false; int nSlotCnt( pMainSlot->GetJewelSlotCount() ); int nMaxEqualJewelCnt = nSlotCnt >= 3 ? 2 : 1; int nEqualJewelCnt( NULL ); TS_ITEM_INFO* pMainInfo( pMainSlot->GetItem() ); for( int i(0); isocket[i] ); if( !m_hJewelItem[i] && IsEqualJewel( pEquipItemInfo, pInsertItemInfo ) ) { nEqualJewelCnt++; if( nEqualJewelCnt>=nMaxEqualJewelCnt ) return false; } } for( int i(0); iGetItemCode() ); if( IsEqualJewel( pEquipItemInfo, pInsertItemInfo ) ) { nEqualJewelCnt++; if( nEqualJewelCnt>=nMaxEqualJewelCnt ) return false; } } } return true; } bool SUIJewelEquipWnd::IsEqualJewel( const ItemBaseEx_info* pItemInfo1, const ItemBaseEx_info* pItemInfo2 ) { if( !pItemInfo1 || !pItemInfo2 ) return false; if( ::memcmp( pItemInfo1->nBaseType, pItemInfo2->nBaseType, sizeof(pItemInfo1->nBaseType) ) == 0 ) if( ::memcmp( pItemInfo1->dBaseVar1, pItemInfo2->dBaseVar1, sizeof(pItemInfo1->dBaseVar1) ) == 0 ) if( ::memcmp( pItemInfo1->nOptType, pItemInfo2->nOptType, sizeof(pItemInfo1->nOptType) ) == 0 ) if( ::memcmp( pItemInfo1->dOptVar1, pItemInfo2->dOptVar1, sizeof(pItemInfo1->dOptVar1) ) == 0 ) return true; return false; } void SUIJewelEquipWnd::RefreshAllSlot() { if( m_hMainItem != NULL ) { KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( "icon_craftitem" )); if( pJewelControl ) SetItemIconStatic( pJewelControl, m_InventoryMgr.GetItemInfo( m_hMainItem ) ); } for( int i(0); i < c_nJewelCnt; ++i ) { m_hJewelItem[i] = NULL; const char* lpCtrName = GetJewelCnt(i); KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( lpCtrName )); if( pJewelControl ) SetItemIconStatic( pJewelControl, m_InventoryMgr.GetItemInfo( m_hJewelItem[i] ) ); } RefreshPrice(); } void SUIJewelEquipWnd::RemoveAllSlot() { RemoveJewelEquipItem( m_hMainItem ); RemoveJewelEquipItems(); } void SUIJewelEquipWnd::RemoveJewelEquipItems() { for( int i(0); i < c_nJewelCnt; ++i ) { m_hJewelItem[i] = NULL; const char* lpCtrName = GetJewelCnt(i); KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( lpCtrName )); if( pJewelControl ) SetItemIconStatic( pJewelControl, NULL ); } RefreshPrice(); } void SUIJewelEquipWnd::RemoveJewelEquipSubItems(const char* lpCtrName) //servantes 2010.10.28 { if(lpCtrName == NULL) return ; int nIndex = GetCtrIndex(lpCtrName); if(nIndex >= 0 && nIndex < 4) { if(m_hJewelItem[nIndex]) { KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( lpCtrName )); if( pJewelControl ) { SetItemIconStatic( pJewelControl, NULL ); m_hJewelItem[nIndex] = NULL; } } } RefreshPrice(); } void SUIJewelEquipWnd::RemoveJewelEquipItem( AR_HANDLE hItem ) { if( m_hMainItem == hItem ) { m_hMainItem = NULL; KUIControlMultiIcon* pJewelControl; const char* itemSlot = GetItemSlot(hItem); if (std::strcmp(itemSlot, "SOCKET_NULL") != 0) { pJewelControl = dynamicCast(GetChild(itemSlot)); } if( pJewelControl ) SetItemIconStatic( pJewelControl, NULL ); RefreshPrice(); return; } for( int i(0); i < c_nJewelCnt; ++i ) { if( m_hJewelItem[i] == hItem ) { m_hJewelItem[i] = NULL; const char* lpCtrName = GetJewelCnt(i); KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( lpCtrName )); if( pJewelControl ) SetItemIconStatic( pJewelControl, NULL ); RefreshPrice(); return; } } } // Putting a soulstone in the socket void SUIJewelEquipWnd::AddJewelEquipItem( AR_HANDLE hItem, int nIndex ) { SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem ); if( !pSlot ) return; const char* lpCtrName( GetJewelCnt(nIndex) ); if( lpCtrName == NULL ) return; m_hJewelItem[nIndex] = hItem; RefreshPrice(); KUIControlMultiIcon* pJewelControl = dynamicCast(GetChild( lpCtrName )); if( pJewelControl == NULL ) return; SetItemIconStatic( pJewelControl, m_InventoryMgr.GetItemInfo( hItem ) ); } int SUIJewelEquipWnd::GetCtrIndex( const char* lpCtrName ) { if( ::strcmp( lpCtrName, "icon_socket06" ) == 0 ) return 0; else if(::strcmp( lpCtrName, "icon_socket07" ) == 0 ) return 1; else if(::strcmp( lpCtrName, "icon_socket08" ) == 0 ) return 2; else if(::strcmp( lpCtrName, "icon_socket09" ) == 0 ) return 3; return -1; } const char* SUIJewelEquipWnd::GetItemSlot(AR_HANDLE hItem) { SInventorySlot* pSlot(m_InventoryMgr.GetItemInfo(hItem)); if(!pSlot) return "SOCKET_NULL"; SItemDB& itemDB = GetItemDB(); int nWearPos = itemDB.GetWearType(pSlot->GetItemCode()); int nItemClass = itemDB.GetItemData(pSlot->GetItemCode())->nClass; switch (nItemClass) { case ItemBase::CLASS_ONEHAND_SWORD: // 101 case ItemBase::CLASS_TWOHAND_SWORD: // 102 case ItemBase::CLASS_DAGGER: // 103 case ItemBase::CLASS_TWOHAND_SPEAR: // 104 case ItemBase::CLASS_TWOHAND_AXE: // 105 case ItemBase::CLASS_ONEHAND_MACE: // 106 case ItemBase::CLASS_TWOHAND_MACE: // 107 case ItemBase::CLASS_HEAVY_BOW: // 108 case ItemBase::CLASS_LIGHT_BOW: // 109 case ItemBase::CLASS_CROSSBOW: // 110 case ItemBase::CLASS_ONEHAND_STAFF: // 111 case ItemBase::CLASS_TWOHAND_STAFF: // 112 case ItemBase::CLASS_ONEHAND_AXE: // 113 { int nItemWearCode = itemDB.GetWearType(pSlot->GetItemCode()); if (nItemWearCode == ItemBase::WEAR_WEAPON || nItemWearCode == ItemBase::WEAR_TWOHAND) // 0 / 99 { return "icon_socket00"; } break; } case ItemBase::CLASS_ARMOR: // 200 case ItemBase::CLASS_FIGHTER_ARMOR: // 201 case ItemBase::CLASS_HUNTER_ARMOR: // 202 case ItemBase::CLASS_MAGICIAN_ARMOR: // 203 case ItemBase::CLASS_SUMMONER_ARMOR: // 204 { if (itemDB.GetWearType(pSlot->GetItemCode()) == ItemBase::WEAR_ARMOR) // 2 { return "icon_socket01"; } break; } case ItemBase::CLASS_SHIELD: // 210 { if (itemDB.GetWearType(pSlot->GetItemCode()) == ItemBase::WEAR_SHIELD) // 1 { return "icon_socket02"; } break; } case ItemBase::CLASS_HELM: // 220 { if (itemDB.GetWearType(pSlot->GetItemCode()) == ItemBase::WEAR_HELM) // 3 { return "icon_socket03"; } break; } case ItemBase::CLASS_GLOVE: // 240 case ItemBase::CLASS_FIGHTER_GLOVE: // 241 case ItemBase::CLASS_HUNTER_GLOVE: // 242 case ItemBase::CLASS_MAGICIAN_GLOVE: // 243 case ItemBase::CLASS_SUMMONER_GLOVE: // 244 { if (itemDB.GetWearType(pSlot->GetItemCode()) == ItemBase::WEAR_GLOVE) // 4 { return "icon_socket04"; } break; } case ItemBase::CLASS_BOOTS: // 230 case ItemBase::CLASS_FIGHTER_BOOTS: // 231 case ItemBase::CLASS_HUNTER_BOOTS: // 232 case ItemBase::CLASS_MAGICIAN_BOOTS: // 233 case ItemBase::CLASS_SUMMONER_BOOTS: // 234 { if (itemDB.GetWearType(pSlot->GetItemCode()) == ItemBase::WEAR_BOOTS) // 5 { return "icon_socket05"; } break; } } return "SOCKET_NULL"; } void SUIJewelEquipWnd::ClearItemSlots() { const char* pWeaponSocket[6] = { "static_icon_inventory_weapon", "static_icon_inventory_armor" "static_icon_inventory_shield", "static_icon_inventory_helm", "static_icon_inventory_glove", "static_icon_inventory_boots", }; for (int i(0); i < 6; i++) { const char* chControlName; const char* chIconName; CStringUtil::StringFormat(chControlName, "icon_socket%02d", i); KUIControlMultiIcon* pIconStatic = dynamicCast(GetChild(chControlName)); if (pIconStatic) { pIconStatic->SetIcon(0, c_szDEF_SPR_NAME, pWeaponSocket[i]); pIconStatic->SetIcon(1); pIconStatic->SetIcon(2); pIconStatic->SetIcon(3); pIconStatic->SetTooltip(); } } } void SUIJewelEquipWnd::RefreshPrice() { // gmbpigsun (2013-04-16): Recalculates the price for the currently registered soul stone m_nTotalPrice = 0; for( int i(0); i < c_nJewelCnt; ++i ) { if( m_hJewelItem[i] ) { SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( m_hJewelItem[i] ); if( pSlot ) m_nTotalPrice += GetItemDB().GetPrice( pSlot->GetItemCode() )/10; } } KUIWnd* pWnd = GetChild("static_cost02"); // 01 is LAK cost (recharge soulstones) 02 is ruppees cost (insert soulstones); if( pWnd ) { std::string strPrice = CStringUtil::StringFormat( "%d", m_nTotalPrice ); pWnd->SetCaption( strPrice.c_str() ); } } // Set icon of item for inserting soulstones void SUIJewelEquipWnd::SetItemIconStatic( KUIControlMultiIcon* pIconStatic, SInventorySlot* pSlot ) { if( pSlot ) { if( NULL != pIconStatic ) { m_pDisplayInfo->AddSystemMessage("void SUIJewelEquipWnd::SetItemIconStatic( KUIControlMultiIcon* pIconStatic, SInventorySlot* pSlot )"); if (GetItemDB().GetItemData(pSlot->GetItemCode())->nClass == ItemBase::CLASS_SOULSTONE) { //pIconStatic->SetShow(false); pIconStatic->SetIcon( 0, "06_live.spr", GetItemDB().GetIconName( pSlot->GetItemCode() ) ); pIconStatic->SetIcon( 1, "06_live.spr", NULL ); //pIconStatic->SetShow(true); } else { for (int i(0); i < 6; i++) { std::string outputStr; if (strcmp(ItemSocketsList[i], pIconStatic->GetID()) == 0) { m_hItemsList[i] = pSlot->GetItem()->handle; XStringUtil::Format(outputStr, "[true] Item socket: %s; I: %d; ID: %s; handle: %d", ItemSocketsList[i], i, pIconStatic->GetID(), m_hItemsList[i]); } else { m_hItemsList[i] = 0; XStringUtil::Format(outputStr, "[false] Item socket: %s; I: %d; ID: %s; handle: %d", ItemSocketsList[i], i, pIconStatic->GetID(), m_hItemsList[i]); } m_pDisplayInfo->AddSystemMessage(outputStr.c_str()); if (m_hItemsList[i] == 0) { pIconStatic->SetIcon(0, "05_ui.spr", static_cast(ItemIconsList[i]) ); } else { std::string ItemIconName = GetItemDB().GetIconName(pSlot->GetItemCode()); XStringUtil::Format(outputStr, "Handle is not 0 ( %d ) ; setting icon: %s; Icon Name: %s", m_hItemsList[i], GetItemDB().GetIconName(pSlot->GetItemCode()), ItemIconName); m_pDisplayInfo->AddSystemMessage(outputStr.c_str()); //pIconStatic->SetShow(false); //pIconStatic->SetIcon(0, c_szDEF_SPR_NAME, GetItemDB().GetIconName(pSlot->GetItemCode())); pIconStatic->SetIcon(0, "01_equip.spr", static_cast(ItemIconName.c_str())); //pIconStatic->SetShow(true); } } //pIconStatic->SetShow(false); //pIconStatic->SetIcon(1, c_szDEF_SPR_NAME, NULL); // //pIconStatic->SetIcon(1, NULL, NULL); // Commenting this out to test if disabling setting icon for layer 1 will fix the fucking problem //pIconStatic->SetShow(true); } EquipItemAddtionalIconSetter icon_setter( pIconStatic, pSlot ); pIconStatic->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) ); if( m_bAltKey ) { m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIconStatic, pSlot ); } } } else { if( NULL != pIconStatic ) { pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" ); pIconStatic->SetIcon( 1 ); pIconStatic->SetIcon( 2 ); pIconStatic->SetIcon( 3 ); pIconStatic->SetTooltip(); } } } // Setting icon of soulstone in specific slot void SUIJewelEquipWnd::SetJewelItemIconStatic( KUIControlMultiIcon* pIconStatic, int nItemCode ) { if( NULL != pIconStatic ) { if( nItemCode > 0 ) { std::string strOutput; XStringUtil::Format(strOutput, "Setting icon for %s: Item ID: %d; icon name: %s;\n", pIconStatic->GetID(), nItemCode, GetItemDB().GetIconName(nItemCode)); m_pDisplayInfo->AddSystemMessage(strOutput.c_str()); const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( nItemCode ); pIconStatic->SetShow(false); pIconStatic->SetIcon( 0, "06_live.spr", GetItemDB().GetIconName(nItemCode)); pIconStatic->SetShow(true); EquipItemAddtionalIconSetter icon_setter( pIconStatic, nItemCode, pItemBase->enhance, pItemBase->nEthereal_durability, pItemBase->Flag ); pIconStatic->SetTooltip( m_pDisplayInfo->GetItemTooltipText(nItemCode, true).c_str() ); } else { //pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_itemslot" ); pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, "common_panel_titanium_slot_icon" ); pIconStatic->SetIcon( 1 ); pIconStatic->SetTooltip(); } } } // Input item function? void SUIJewelEquipWnd::RegistItem( AR_HANDLE hItem ) { SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem ); if( !pSlot ) return; RemoveAllSlot(); // todo remove later // SItemDB& itemDB = GetItemDB(); int nWearPos = GetItemDB().GetWearType(pSlot->GetItemCode()); int nItemClass = itemDB.GetItemData(pSlot->GetItemCode())->nClass; std::string strOutput; XStringUtil::Format(strOutput, "Item ID: %d; wear type: %d; Item class: %d\n", pSlot->GetItemCode(), nWearPos, nItemClass); m_pDisplayInfo->AddSystemMessage(strOutput.c_str()); // todo remove later // KUIControlMultiIcon* pMainSlot = NULL; const char* itemSlot = GetItemSlot(hItem); if (std::strcmp(itemSlot, "SOCKET_NULL") != 0) { pMainSlot = dynamicCast(GetChild(itemSlot)); } if( pMainSlot == NULL ) return; SInventorySlot* pInvenSlot = m_InventoryMgr.GetItemInfo( hItem ); if( pInvenSlot == NULL ) return; SetItemIconStatic( pMainSlot, pInvenSlot ); m_hMainItem = hItem; const char* lpCtrName( NULL ); KUIControlMultiIcon* pJewelControl( NULL ); TS_ITEM_INFO* pItemInfo( pSlot->GetItem() ); int nSlotCnt( pSlot->GetJewelSlotCount() ); for( int i(0); i < c_nJewelCnt; ++i ) { pJewelControl = dynamicCast(GetChild(GetJewelCnt(i))); if (pJewelControl) { pJewelControl->SetShow(nSlotCnt <= 1); } if (pItemInfo->socket[i]) { lpCtrName = GetJewelCnt(i); pJewelControl = dynamicCast(GetChild(lpCtrName)); if( pJewelControl == NULL ) continue; SetJewelItemIconStatic( pJewelControl, pItemInfo->socket[i] ); } //pJewelControl = dynamicCast(GetChild( lpSoketDisableCtr[i] )); //if( pJewelControl ) pJewelControl->SetShow( nSlotCnt<=i ); // //if( pItemInfo->socket[i] ) //{ // lpCtrName = GetJewelCnt(i); // pJewelControl = dynamicCast(GetChild( lpCtrName )); // if( pJewelControl == NULL ) continue; // SetJewelItemIconStatic( pJewelControl, pItemInfo->socket[i] ); //} } } const char* SUIJewelEquipWnd::GetJewelCnt( int nIndex ) { if( nIndex == 0 ) return lpSoketCtr1; else if( nIndex == 1 ) return lpSoketCtr2; else if( nIndex == 2 ) return lpSoketCtr3; else if( nIndex == 3 ) return lpSoketCtr4; else return NULL; } int SUIJewelEquipWnd::GetJewelIndex( const char* szControlID ) { if( ::strcmp( szControlID, lpSoketCtr1 ) == 0 ) return 0; else if( ::strcmp( szControlID, lpSoketCtr2 ) == 0 ) return 1; else if( ::strcmp( szControlID, lpSoketCtr3 ) == 0 ) return 2; else if( ::strcmp( szControlID, lpSoketCtr4 ) == 0 ) return 3; return -1; } // Send a request to the server to insert soulstones (After clicking Socket button) void SUIJewelEquipWnd::ReqJewelEquipMsg() { if( m_hMainItem == NULL ) return; m_pDisplayInfo->AddSystemMessage( "void SUIJewelEquipWnd::ReqJewelEquipMsg()"); SIMSG_UI_SOULSTONE_CRAFT Msg; Msg.craft_item_handle = m_hMainItem; bool bMsgComplete(false); for( int i(0); iAddSystemMessage( S( 90010008 ), 0 ); // You do not have enough Rupees. } } if( bMsgComplete ) m_pGameManager->ProcMsgAtStatic(&Msg); } bool SUISoulChargeWnd::InitControls( KPoint kPos ) { SetCustomMovingRect( KRect( 0, 0, 220, 20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area KUIControlMultiIcon* pSoulChargeControl(NULL); pSoulChargeControl = dynamicCast(GetChild( lpShield )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); pSoulChargeControl = dynamicCast(GetChild( lpGlove )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); pSoulChargeControl = dynamicCast(GetChild( lpBoots )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); pSoulChargeControl = dynamicCast(GetChild( lpWeapon )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); pSoulChargeControl = dynamicCast(GetChild( lpHelm )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); pSoulChargeControl = dynamicCast(GetChild( lpArmor )); if( pSoulChargeControl ) pSoulChargeControl->SetIconLayer( 2 ); SetChildCaption( c_szStatickLak, GetStringDB().GetString( STRING_LAK ) ); return SUIWnd::InitControls( kPos ); } void SUISoulChargeWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd ) { if( bOpen ) { ClearData(); ClearIconSlots(); RefreshRepairPrice(); m_pManager->SetMouseClickWnd(this); //servantes 2010.12.16 } else { m_pManager->SetMouseClickWnd(NULL); //servantes 2010.12.16 } } void SUISoulChargeWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam ) { switch( nMessage ) { case KUI_MESSAGE::KBUTTON_CLICK: { if( ::strcmp( lpszControlID, "button_close" ) == 0 ) { m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE, false ) ); } else if( ::strcmp( lpszControlID, "button_ok" ) == 0 ) { if( IsAddRepairItem() ) { ReqRepairMsg(); ClearData(); //servantes 2010.10.13 ClearIconSlots(); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE, false ) ); } } else if( ::strcmp( lpszControlID, "button_charge_cancel" ) == 0 ) { ClearData(); ClearIconSlots(); RefreshRepairPrice(); m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE, false ) ); } else if( ::strcmp( lpszControlID, "button_allrepair" ) == 0 ) { AllEquipItemRepair(); RefreshRepairPrice(); } } break; case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동 { LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 } case KUI_MESSAGE::KICON_DBLCLK: //servantes 2010.10.21 { KUIControlMultiIcon* pWndMultiIcon = dynamicCast(GetChild( lpszControlID )); if( pWndMultiIcon ) { const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0); AR_HANDLE hItem( GetRepairItemHandle( lpszControlID ) ); SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem ); if( pSlot ) { ClearData(); ClearIconSlots(); RefreshRepairPrice(); } } } break; } SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam ); } void SUISoulChargeWnd::ProcMsgAtStatic( SGameMessage* pMsg ) { switch( pMsg->nType ) { case IMSG_UI_SEND_DATA: { SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg; if( pData->m_strString == "success" ) { } } break; case IMSG_UI_MOVE: case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동 { LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한 } break; case MSG_RESULT: { SMSG_RESULT* pResultMsg = (SMSG_RESULT*)pMsg; if( pResultMsg->request_msg_id == TM_CS_REPAIR_SOULSTONE ) { switch( pResultMsg->result ) { case RESULT_SUCCESS: { if( pResultMsg->value == 0 ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_SUCCESS_REPAIR), 99 ); // Recharge all items to 100% } else { m_pDisplayInfo->AddSystemMessage( SR(SYS_MSG_SOME_REPAIR, "#@lak@#", pResultMsg->value ).c_str(), 99 ); // Consume #@lak@# Lak to recharge some Soul Power. } } break; case RESULT_NOT_EXIST: case RESULT_NOT_ACTABLE: { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_ERR_ITEM), 99 ); // This is the wrong type of item. } break; case RESULT_NOT_ENOUGH_MONEY: { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_NOT_ENOUGH_LAK), 99 ); // You don't have enough Lak. } break; } } break; } break; case IMSG_SOULCHARGE_MOVEITEM: //servantes 2010.10.25 { SIMSG_SOULCHARGE_MOVEITEM* pMsg2 = (SIMSG_SOULCHARGE_MOVEITEM*)pMsg; SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pMsg2->m_handle ); if( pSlot == NULL ) break; if( GetRepairValue( pSlot->GetHandle() ) <= 0.0f ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_ERR_ITEM), 99 ); // This is the wrong type of item. } else { AddRepairItem(pSlot); } } break; case IMSG_HOTKEY_EX: //servantes 2010.10.21 { SIMSG_HOTKEY_EX* pHotKey = dynamicCast(pMsg); if( pHotKey->wParam == VK_SHIFT ) m_bShiftKey = (pHotKey->bUp == 0); //servantes 2010.10.15 if( pHotKey->wParam == VK_CONTROL ) //servantes 2010.10.15 m_bControlKey = (pHotKey->bUp == 0); if( pHotKey->wParam == VK_MENU ) { bool bPreState = m_bAltKey; m_bAltKey = (pHotKey->bUp == 0); if( bPreState != m_bAltKey && IsShow() ) { RefreshRepairSlot(); } } } break; } } void* SUISoulChargeWnd::Perform( KID id, KArg& msg ) { _CID( UI_BEGIN_DRAG ); _CID( UI_SEND_DROP ); _CID( UI_RECV_DROP ); if ( id == id_UI_BEGIN_DRAG ) { KUIBeginDragMessage* pBeginMsg = static_cast( &msg ); const char* szControlID = pBeginMsg->sDragControlID.c_str(); KUIControlMultiIcon* pWndMultiIcon = dynamicCast(GetChild( szControlID )); if( pWndMultiIcon ) { const KUIControlMultiIcon::ICON_INFO& rIconInfo = pWndMultiIcon->GetIconInfoByLayer(0); AR_HANDLE hItem( GetRepairItemHandle( szControlID ) ); SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem ); if( pSlot ) { m_pDisplayInfo->SetUIDragInfo( new SUICombineItemDragInfo( hItem ) ); m_pDragAndDropIcon->SetStateIcon( pWndMultiIcon->GetSprName(), rIconInfo.sAniName.c_str(), rIconInfo.nFrameIndex, STATE_NORMAL ); pBeginMsg->pDragAndDropRenderer = m_pDragAndDropIcon; } } return NULL; } else if ( id == id_UI_SEND_DROP ) { KUISendRecvDropMessage* pSendMsg = static_cast( &msg ); SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo(); if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_COMBINEITEM == pUIDragInfo->m_type ) { SUICombineItemDragInfo* pCombineDragInfo = (SUICombineItemDragInfo*)pUIDragInfo; // 동일한 창이 아닌 곳에 드롭했다면 슬롯을 비운다. if( pSendMsg->sRecvDropParentID != std::string(GetID()) ) { ClearSlot( pSendMsg->sSendDropControlID.c_str() ); RefreshRepairPrice(); } // Drag & Drop 정보 제거 m_pDisplayInfo->SetUIDragInfo(); } return NULL; } else if ( id == id_UI_RECV_DROP ) { KUISendRecvDropMessage* pRecvMsg = static_cast( &msg ); SUIDragInfo* pUIDragInfo = m_pDisplayInfo->GetUIDragInfo(); if( NULL != pUIDragInfo && SUIDragInfo::DRAGTYPE_INVENITEM == pUIDragInfo->m_type ) // 인벤에서 드래그한 아이템인 경우에만 { SUIInvenItemDragInfo* pItemDragInfo = (SUIInvenItemDragInfo*)pUIDragInfo; SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pItemDragInfo->m_hItem ); if( !pSlot ) return NULL; if( GetRepairValue( pItemDragInfo->m_hItem ) <= 0.0f ) { m_pDisplayInfo->AddSystemMessage( S(SYS_MSG_ERR_ITEM), 99 ); // This is the wrong type of item. } else { AddRepairItem(pSlot); } } return NULL; } return SUIWnd::Perform( id, msg ); } void SUISoulChargeWnd::AddRepairItem( SInventorySlot* pSlot ) { const char* lpCtrName(NULL); AR_HANDLE handle = pSlot->GetHandle(); int nItemCode( pSlot->GetItemCode() ); int nGroup = GetItemDB().GetGroup( nItemCode ); switch(nGroup) { case ItemBase::GROUP_WEAPON:{ lpCtrName = lpWeapon; m_hWeapon = handle; } break; case ItemBase::GROUP_SHIELD:{ lpCtrName = lpShield; m_hShield = handle; } break; case ItemBase::GROUP_ARMOR: { lpCtrName = lpArmor; m_hArmor = handle; } break; case ItemBase::GROUP_HELM: { lpCtrName = lpHelm; m_hHelm = handle; } break; case ItemBase::GROUP_GLOVE: { lpCtrName = lpGlove; m_hGlove = handle; } break; case ItemBase::GROUP_BOOTS: { lpCtrName = lpBoots; m_hBoots = handle; } break; default: return; } RefreshRepairPrice(); SetItemIconStatic( lpCtrName, m_InventoryMgr.GetItemInfo( handle ) ); } void SUISoulChargeWnd::SetItemIconStatic( const char* lpCtrName, SInventorySlot* pSlot ) { KUIControlMultiIcon* pIconStatic = dynamicCast(GetChild( lpCtrName )); if( pIconStatic == NULL ) return; if( pSlot ) { if( NULL != pIconStatic ) { /// 2011.08.03 - prodongi if (!setSkillCardIcon(pIconStatic, pSlot->GetItemCode())) { pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode() ) ); pIconStatic->SetIcon( 2 ); pIconStatic->SetIcon( 3 ); } pIconStatic->SetIcon( 1, c_szDEF_SPR_NAME, pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_CARD ) ? "static_common_useunitcardicon" : NULL ); EquipItemAddtionalIconSetter icon_setter( pIconStatic, pSlot ); pIconStatic->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) ); if( m_bAltKey ) { m_pDisplayInfo->SetComparableEquipItemSubTooltip( pIconStatic, pSlot ); } } } else { if( NULL != pIconStatic ) { const char* lpIconName(NULL); if( ::strcmp( lpCtrName, lpWeapon ) == 0 ) lpIconName = "static_inventory_weapon"; else if( ::strcmp( lpCtrName, lpShield ) == 0 ) lpIconName = "static_inventory_shield"; else if( ::strcmp( lpCtrName, lpArmor ) == 0 ) lpIconName = "static_inventory_armor"; else if( ::strcmp( lpCtrName, lpHelm ) == 0 ) lpIconName = "static_inventory_helm"; else if( ::strcmp( lpCtrName, lpGlove ) == 0 ) lpIconName = "static_inventory_glove"; else if( ::strcmp( lpCtrName, lpBoots ) == 0 ) lpIconName = "static_inventory_boots"; if( lpIconName ) pIconStatic->SetIcon( 0, c_szDEF_SPR_NAME, lpIconName ); pIconStatic->SetIcon( 1, c_szDEF_SPR_NAME, NULL ); pIconStatic->SetTooltip(); } } } void SUISoulChargeWnd::RefreshRepairPrice() { m_fRepairValue = GetRepairValue( m_hShield ); m_fRepairValue += GetRepairValue( m_hGlove ); m_fRepairValue += GetRepairValue( m_hBoots ); m_fRepairValue += GetRepairValue( m_hWeapon ); m_fRepairValue += GetRepairValue( m_hHelm ); m_fRepairValue += GetRepairValue( m_hArmor ); KUIControlStatic* pConst = dynamicCast(GetChild("static_cost")); if( pConst ) pConst->SetCaption( CStringUtil::StringFormat( "%d", (int)(m_fRepairValue*c_fPrice+0.9f) ).c_str() ); } float SUISoulChargeWnd::GetRepairValue( AR_HANDLE handle ) { SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( handle ); if( !pSlot ) return 0.0f; if( pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_FAILED ) ) // 강화 실패 작 { return 0.0f; } unsigned int dwMaxEndurance( pSlot->GetMaxEndurance() ); if( dwMaxEndurance == 0 ) return 0.0f; float fGap( dwMaxEndurance/100000 - (pSlot->GetEndurance() + 99999)/100000 ); if( fGap>0.0f ) return fGap; return 0.0f; } void SUISoulChargeWnd::ClearData() { m_fRepairValue = 0; m_hShield = NULL; m_hGlove = NULL; m_hBoots = NULL; m_hWeapon = NULL; m_hHelm = NULL; m_hArmor = NULL; } void SUISoulChargeWnd::ClearIconSlots() { SetItemIconStatic(lpWeapon, NULL); SetItemIconStatic(lpShield, NULL); SetItemIconStatic(lpArmor, NULL); SetItemIconStatic(lpHelm, NULL); SetItemIconStatic(lpGlove, NULL); SetItemIconStatic(lpBoots, NULL); } void SUISoulChargeWnd::ClearSlot( const char* lpCtrName ) { if( ::strcmp( lpCtrName, lpWeapon ) == 0 ) m_hWeapon = 0; else if( ::strcmp( lpCtrName, lpShield ) == 0 ) m_hShield = 0; else if( ::strcmp( lpCtrName, lpArmor ) == 0 ) m_hArmor = 0; else if( ::strcmp( lpCtrName, lpHelm ) == 0 ) m_hHelm = 0; else if( ::strcmp( lpCtrName, lpGlove ) == 0 ) m_hGlove = 0; else if( ::strcmp( lpCtrName, lpBoots ) == 0 ) m_hBoots = 0; SetItemIconStatic( lpCtrName, NULL ); } void SUISoulChargeWnd::RefreshRepairSlot() { SetItemIconStatic( lpWeapon, m_InventoryMgr.GetItemInfo(m_hWeapon) ); SetItemIconStatic( lpShield, m_InventoryMgr.GetItemInfo(m_hShield) ); SetItemIconStatic( lpArmor, m_InventoryMgr.GetItemInfo(m_hArmor) ); SetItemIconStatic( lpHelm, m_InventoryMgr.GetItemInfo(m_hHelm) ); SetItemIconStatic( lpGlove, m_InventoryMgr.GetItemInfo(m_hGlove) ); SetItemIconStatic( lpBoots, m_InventoryMgr.GetItemInfo(m_hBoots) ); } AR_HANDLE SUISoulChargeWnd::GetRepairItemHandle( const char* szControlID ) { if( ::strcmp( szControlID, lpWeapon ) == 0 ) return m_hWeapon; else if( ::strcmp( szControlID, lpShield ) == 0 ) return m_hShield; else if( ::strcmp( szControlID, lpArmor ) == 0 ) return m_hArmor; else if( ::strcmp( szControlID, lpHelm ) == 0 ) return m_hHelm ; else if( ::strcmp( szControlID, lpGlove ) == 0 ) return m_hGlove; else if( ::strcmp( szControlID, lpBoots ) == 0 ) return m_hBoots; return NULL; } void SUISoulChargeWnd::AllEquipItemRepair() { std::vector vecInvenList; m_InventoryMgr.GetEquipItemList( vecInvenList ); for( int i(0); iGetHandle() ) > 0.0f ) AddRepairItem(vecInvenList[i]); } vecInvenList.clear(); } bool SUISoulChargeWnd::IsAddRepairItem() { return ( m_hShield || m_hGlove || m_hBoots || m_hWeapon || m_hHelm || m_hArmor ); } void SUISoulChargeWnd::ReqRepairMsg() { SIMSG_UI_REPAIR_SOULSTONE Msg; Msg.item_handle[0] = m_hShield; Msg.item_handle[1] = m_hGlove; Msg.item_handle[2] = m_hBoots; Msg.item_handle[3] = m_hWeapon; Msg.item_handle[4] = m_hHelm; Msg.item_handle[5] = m_hArmor; m_pGameManager->ProcMsgAtStatic(&Msg); }