Files
2026-06-01 12:46:52 +02:00

1551 lines
49 KiB
C++

#include "stdafx.h"
#include "KUIControlStatic.h"
#include "KUIControlButton.h"
#include "KUIControlGauge.h"
#include "KUIControlScroll.h"
#include "KUIControlQJTV.h"
#include "SGameManager.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SUICreatureCardWnd.h"
#include "SUIDisplayInfo.h"
#include "SSummonSlotMgr.h"
#include "SInventoryMgr.h"
#include "SItemDB.h"
#include "SSkillDB.h"
#include "SStringDB.h"
#include "SCreatureDB.h"
#include "SMonsterAffiliationDB.h"
#include "SMonsterAffiliationDetailDB.h"
#include "SSkillSlot.h"
#include "KDeviceManager.h"
#include "KUITextureManager.h"
#include <kfile/KFileManager.h>
#include "KResourceDX.h"
#include "KTGA_IO.h"
#include "SCreatureEnhanceDB.h"
#include <toolkit/XStringUtil.h>
//#include "SUIUtil.h"
#include "StringDBHelper.h"
#include "SUILazyTooltip.h"
#include "Util.h"
using namespace CStringUtil;
namespace
{
const int nCardImgWidth = 189;
const int nCardImgHeight = 280;
const short c_nCreatureRankOffSet = 17;
const int c_nDescDeltaY = 77;
const int c_nMaxScollLine = 4;
};
extern const char* g_szEmoticonFilter[];
extern void SetCopy( char * pSrc, const int nSrcStride, char * pDst, const int nDstStride, const int nWidth, const int nHeight );
void SUICreatureCardBaseWnd::initIllustTexture()
{
int nExpX, nExpY;
K3DRenderDevice::GetSquareSize( nCardImgWidth, nCardImgHeight, nExpX, nExpY );
if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT )
{
m_spTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, KUSAGE_DYNAMIC, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT );
}
else
{
//Intel Chip 계열에서 지원 안 되는 넘들이 있음.
m_spTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture( nExpX, nExpY, K3DFMT_A8R8G8B8, D3DPOOL_MANAGED );
}
KUIControlDynamicTexture* pWndDynamicTex = dynamicCast<KUIControlDynamicTexture*>(GetChild( "image_illust" ));
if( pWndDynamicTex )
pWndDynamicTex->SetRenderTarget( m_spTexture, nCardImgWidth, nCardImgHeight );
refreshInitImg();
}
void SUICreatureCardBaseWnd::refreshInitImg()
{
//소프트웨어 락
char* pDstBuf = NULL;
int nDstStride;
if( m_spTexture == NULL ) return;
m_spTexture->LockRect( NULL, (void**)&pDstBuf, nDstStride );
if( pDstBuf == NULL )
{
assert( 0 && "Texture Pool Lock Failed!!!" );
return;
}
int nWidth = m_spTexture->GetWidth();
int nHeight = m_spTexture->GetHeight();
KColor* pColor;
for(UINT y = 0; y < nHeight; y++ )
{
pColor = ( KColor* )pDstBuf;
for( UINT x = 0; x < nWidth; x++ )
{
KColor col;
col.r = 255; col.g = 255; col.b = 0; col.a = 255;
pColor[x] = col;
}
pDstBuf += nDstStride;
}
m_spTexture->Unlock();
}
void SUICreatureCardBaseWnd::refreshCardImg()
{
if( m_strIllustImg == "NotFound" ) return;
int offset = 0;
POINT point;
point.x = offset;
point.y = offset;
RECT rect;
rect.left = offset;
rect.top = offset;
KStream *stream = KFileManager::Instance().CreateStreamFromResource( m_strIllustImg.c_str() );
//일러스트 없는 크리처
if( stream == NULL )
stream = KFileManager::Instance().CreateStreamFromResource( "game_image_card_empty.jpg" );
if ( stream == NULL)
{
char card[MAX_PATH];
sprintf(card, "%s", m_strIllustImg.c_str());
MessageBox(NULL, card, "Creature IllustImg File Not Found", MB_OK);
return;
}
else
{
SetChildShow("inframe", false);
SetChildShow("inframe_gray", false);
if (0 == m_strIllustImg.compare("game_image_card_empty.jpg")) SetChildShow("inframe_gray", true);
else SetChildShow("inframe", true);
K3DTextureDX * pSrcTex = new K3DTextureDX( (K3DRenderDeviceDX *)KDeviceManager::GetDeviceManager()->GetRenderDevice() );
pSrcTex->AddRef();
if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT || KUITextureManager::GetHWType() == KUITextureManager::NOT_HW_SUPPORT )
{
if( KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT )
{
pSrcTex->Initialize( *stream, 0, D3DPOOL_SYSTEMMEM, K3DFMT_A8R8G8B8 );
rect.right = pSrcTex->GetWidth()-offset;
rect.bottom = pSrcTex->GetHeight()-offset;
if( KDeviceManager::GetDeviceManager()->GetRenderDevice()->UpdateSurface( pSrcTex, &rect, m_spTexture, &point ) != D3D_OK )
{
}
}
else if( KUITextureManager::GetHWType() == KUITextureManager::NOT_HW_SUPPORT )
{
pSrcTex->Initialize( *stream, 0, D3DPOOL_MANAGED, K3DFMT_A8R8G8B8 );
rect.right = pSrcTex->GetWidth()-offset;
rect.bottom = pSrcTex->GetHeight()-offset;
//소프트웨어 락
char* pDstBuf = NULL;
char* pSrcBuf = NULL;
int nSrcStride, nDstStride;
pSrcTex->LockRect( NULL, (void**)&pSrcBuf, nSrcStride );
if( pSrcBuf == NULL )
{
assert( 0 && "Texture Src Lock Failed!!!" );
return;
}
KRect krect = KRect(point.x, point.y, point.x+rect.right, point.y+rect.bottom);
m_spTexture->LockRect( &krect, (void**)&pDstBuf, nDstStride );
if( pDstBuf == NULL )
{
assert( 0 && "Texture Pool Lock Failed!!!" );
return;
}
SetCopy( pSrcBuf, nSrcStride, pDstBuf, nDstStride, rect.right, rect.bottom );
pSrcTex->Unlock();
m_spTexture->Unlock();
}
//////////////////////////////////////////////////////////////////////////
}
else if( KUITextureManager::GetHWType() == KUITextureManager::NOTPOW_SUPPORT )
{
_TEX_SRC_INFO _src_info;
//TGA 직접 로딩 방법------------------------------------------------------
if( TGAReadImage( stream, &_src_info.nWidth, &_src_info.nHeight, &_src_info.nBitDepth, &_src_info.pSrcTexel ) )
{
rect.right = _src_info.nWidth-offset;
rect.bottom = _src_info.nHeight-offset;
//소프트웨어 락
char* pDstBuf = NULL;
char* pSrcBuf = NULL;
int nDepth = (_src_info.nBitDepth/8);
int nSrcStride, nDstStride;
nSrcStride = _src_info.nWidth * nDepth;
pSrcBuf = (char*)_src_info.pSrcTexel;
KRect krect = KRect(point.x, point.y, point.x+rect.right, point.y+rect.bottom);
m_spTexture->LockRect( &krect, (void**)&pDstBuf, nDstStride );
if( pDstBuf == NULL )
{
assert( 0 && "Texture Pool Lock Failed!!!" );
return;
}
if( nDepth == 4 ) //32Bit 지원
{
SetCopy( pSrcBuf, nSrcStride, pDstBuf, nDstStride, rect.right, rect.bottom );
}
m_spTexture->Unlock();
}
}
SAFE_RELEASE( pSrcTex );
KFileManager::Instance().DeleteStream( stream );
}
}
void SUICreatureCardBaseWnd::OnDeviceLost()
{
refreshInitImg();
refreshCardImg();
KUIControlDynamicTexture* pWndDynamicTex = dynamicCast<KUIControlDynamicTexture*>(GetChild( "image_illust" ));
if( pWndDynamicTex )
pWndDynamicTex->SetRenderTarget( m_spTexture, nCardImgWidth, nCardImgHeight );
}
void SUICreatureCardBaseWnd::modifyIllustImg(int enhance)
{
if (0 == enhance)
return ;
m_strIllustImg.replace(m_strIllustImg.size()-4, 1, "_ultimate01.");
}
//-----------------------------------------------------------------------------------------------------------------
// 셍성자
//-----------------------------------------------------------------------------------------------------------------
SUICreatureCardFrontWnd::SUICreatureCardFrontWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUICreatureCardBaseWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo )
, m_handle( NULL )
, m_needReqSkillTreeData( false )
, m_pAffiliation( NULL )
, m_pAffiliationIcon( NULL )
, m_pOverBreed( NULL )
, m_pOverBreedIcon( NULL )
, m_strAffiliationNamePropertyTag( "" )
, m_strOverBreedPropertyTag( "" )
{
}
//-----------------------------------------------------------------------------------------------------------------
// 컨트롤 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUICreatureCardFrontWnd::InitControls( KPoint kPos )
{
SetCustomMovingRect( KRect( 0,0,289,20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
this->initIllustTexture();
KUIControl* flipWnd( dynamicCast<KUIControl*>( GetChild( "button_flip" ) ) );
if ( flipWnd )
flipWnd->SetTooltip( S( 7221 ) /*뒷장으로*/ );
return SUIWnd::InitControls(kPos);
}
//-----------------------------------------------------------------------------------------------------------------
// 데이터 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUICreatureCardFrontWnd::InitData( bool bReload /*= false*/ )
{
m_pAffiliation = dynamicCast<KUIControlStatic*>( GetChild( "text_type_value" ) );
if( NULL == m_pAffiliation )
{
SDEBUGLOG( "[크리쳐 카드(앞면)] 컨트롤 정보 얻기 실패 - Name[text_type_value]" );
assert( m_pAffiliation );
}
else
{
string strCaption( m_pAffiliation->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strAffiliationNamePropertyTag );
}
m_pAffiliationIcon = dynamicCast<KUIControlIconStatic*>( GetChild( "creature_monster_target_mark_type" ) );
if( NULL == m_pAffiliationIcon )
{
SDEBUGLOG( "[크리쳐 카드(앞면)] 컨트롤 정보 얻기 실패 - Name[creature_monster_target_mark_type]" );
assert( m_pAffiliationIcon );
}
m_pOverBreed = dynamicCast<KUIControlStatic*>( GetChild( "text_overbreed_01" ) );
if( NULL == m_pOverBreed )
{
SDEBUGLOG( "[크리쳐 카드(앞면)] 컨트롤 정보 얻기 실패 - Name[text_overbreed_01]" );
assert( m_pOverBreed );
}
else
{
string strCaption( m_pOverBreed->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strOverBreedPropertyTag );
m_pOverBreed->SetShow( false );
}
m_pOverBreedIcon = dynamicCast<KUIControlStatic*>( GetChild( "mark_overbreed_01" ) );
if( NULL == m_pOverBreedIcon )
{
SDEBUGLOG( "[크리쳐 카드(앞면)] 컨트롤 정보 얻기 실패 - Name[mark_overbreed_01]" );
assert( m_pOverBreedIcon );
}
else
m_pOverBreedIcon->SetShow( false );
return SUIWnd::InitData(bReload);
}
//-----------------------------------------------------------------------------------------------------------------
// 메시지 처리
//-----------------------------------------------------------------------------------------------------------------
void SUICreatureCardFrontWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, false ) );
}
else if (::_stricmp(lpszControlID, "button_flip") == 0)
{
m_pGameManager->StartSound( "ui_button_click.wav" );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, GetRect().left, GetRect().top ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, true ) );
if (m_needReqSkillTreeData)
{
SIMSG_UI_SUMMON_CARD_SKILL_LIST msg(m_handle);
m_pGameManager->ProcMsgAtStatic(&msg);
}
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE:
{
LimitMoveWnd();
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUICreatureCardFrontWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_SUMMON_CARD :
{
SMSG_SUMMON_CARD* pSummonCard = dynamicCast<SMSG_SUMMON_CARD*>(pMsg);
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pSummonCard->card_handle );
if( !pSlot ) return;
m_needReqSkillTreeData = false; /// 2011.05.12 - prodongi
bool isSummon( pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_SUMMON ) );
const SCreatureInfo* pInfo( m_CreatureSlotMgr.GetCreatureInfoByCardHandle( pSummonCard->card_handle ) );
int level = (pInfo) ? pInfo->GetLevel() : 0;
int nSummonID( pSlot->GetSummonID() );
setData(pSummonCard->card_handle, nSummonID, pSlot->GetItemCode(), isSummon, pSlot->GetItem()->socket, pSlot->GetEnhance(), level);
}
break;
case MSG_SUMMON_CARD_ITEM_INFO: /// 2011.03.29 - prodongi
{
m_needReqSkillTreeData = true; /// 2011.05.12 - prodongi
SMSG_SUMMON_CARD_ITEM_INFO* info( dynamicCast<SMSG_SUMMON_CARD_ITEM_INFO*>(pMsg) );
if( info )
{
XFlag< int > xFlag;
xFlag.CopyFrom(&info->item_info.Flag);
bool isSummon = xFlag.IsOn( ItemInstance::ITEM_FLAG_SUMMON );
setData(info->item_info.handle, info->item_info.summon_id, info->item_info.Code, isSummon, info->item_info.socket, info->item_info.enhance, info->item_info.level );
}
}
break;
case IMSG_UI_MOVE_EX:
{
const KSize& rResolution = KUIWndManager::GetResolution();
const KRect &rWndRect = GetRect();
SIMSG_UI_MOVE_EX* pMoveMsg = ( SIMSG_UI_MOVE_EX* )pMsg;
if( pMoveMsg->m_nLeft - GetRect().GetWidth() < 0 )
{
MovePos( pMoveMsg->m_nRight, pMoveMsg->m_nTop );
}
else
{
MovePos( pMoveMsg->m_nLeft - GetRect().GetWidth(), pMoveMsg->m_nTop );
}
pMsg->bUse = true;
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
pMsg->bUse = true;
}
break;
}
}
void SUICreatureCardFrontWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd /*= true*/ )
{
}
void SUICreatureCardFrontWnd::setData(AR_HANDLE cardHandle, int nSummonID, int itemCode, bool isSummon, int const* socket, int enhance, int creatureLevel)
{
const ItemBaseEx_info* pItemBase( GetItemDB().GetItemData( itemCode ) );
if( NULL == pItemBase )
return ;
const _SUMMON_INFO_FILE* pSummonInfo( GetCreatureDB().GetCreatureData( nSummonID ) );
if( pSummonInfo == NULL )
return;
//DB index룰 : 기본, 진화1-> 기본+1, 진화2->기본+2
//gmpbigsun(20130404, #26736) 크리쳐 진화상태 오류 수정
int nTempSummonID = 0;
if( pSummonInfo->nForm > 1 )
{
nTempSummonID = nSummonID - (pSummonInfo->nForm-1);
const _SUMMON_INFO_FILE* pTempSummonInfo = GetCreatureDB().GetCreatureData( nTempSummonID );
if( NULL != pTempSummonInfo )
{
//룰에 의거 기본형을 찾고 유효하면 바꿔준다.
nSummonID = nTempSummonID;
pSummonInfo = pTempSummonInfo;
}
}
//end gmpbigsun
m_handle = cardHandle;
//탑승 전용 크리쳐는 표시 안됨.
if( pSummonInfo->is_riding_only < 0 )
return; //데이타 오류
if( pSummonInfo->is_riding_only == 1 )
return; //라이딩 전용
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD ))
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD, false));
if( !IsShow() )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, true ) );
}
//데이타 변경
int nCreatureNameID = pSummonInfo->name_id;
std::string strCaption = "<left><size:11>"; // sonador 10.4.1 스킬 툴팁 리뉴얼
int gradeIndex = 0;
BYTE byRate( GetCreatureDB().GetRate( nSummonID ) );
switch( byRate )
{
case SummonBase::RATE_BASIC: gradeIndex = 0; break;
case SummonBase::RATE_NORMAL_BASIC: gradeIndex = 1; break;
case SummonBase::RATE_SPECIAL_BASIC: gradeIndex = 2; break;
case SummonBase::RATE_NORMAL_RARE: gradeIndex = 3; break;
case SummonBase::RATE_SPECIAL_RARE: gradeIndex = 4; break;
case SummonBase::RATE_UNIQUE: gradeIndex = 5; break;
// AziaMafia Pet Rarity
case SummonBase::RATE_VERACRUZ: gradeIndex = 6; break;
case SummonBase::RATE_PHANTOM: gradeIndex = 7; break;
case SummonBase::RATE_AURA: gradeIndex = 8; break;
case SummonBase::RATE_SHINNY: gradeIndex = 9; break;
case SummonBase::RATE_GALAXY: gradeIndex = 10; break;
}
strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + gradeIndex];
SetChildCaption( "static_grade_00", strCaption.c_str() );
SetChildTooltip( "static_grade_00", GetCreatureDB().GetRateString( byRate ).c_str() );
KUIControl* gradeWnd = dynamicCast<KUIControl*>(GetChild("static_grade_00"));
assert(!gradeWnd);
gradeWnd->SetTooltip(S(7223 + gradeIndex));
strCaption = "<font:font_01><left><size:9>"; // sonador 10.4.1 스킬 툴팁 리뉴얼
if (isSummon)
{
int const* pLevel = socket;
if( m_pOverBreed && m_pOverBreedIcon )
{
//오버 브리드 계산
//50, 70, 100 : 진화 레벨 상수
int nOverBreed( NULL );
if( pLevel[0+1] > SCreatureDB::EVOLUTION_LV2 )
nOverBreed = pLevel[0+1] - SCreatureDB::EVOLUTION_LV2;
if( pLevel[1+1] > SCreatureDB::EVOLUTION_LV3 )
nOverBreed += pLevel[1+1] - SCreatureDB::EVOLUTION_LV3;
if( nOverBreed )
{
m_pOverBreedIcon->SetShow( true );
m_pOverBreed->SetShow( true );
std::string strOverBreed( m_strOverBreedPropertyTag );
strOverBreed.append( StringFormat( "+%u", nOverBreed ) );
m_pOverBreed->SetCaption( strOverBreed.c_str() );
}
else
{
m_pOverBreedIcon->SetShow( false );
m_pOverBreed->SetShow( false );
}
}
//서버에서 pLevel[0] 은 SID 로 사용 하고 있음.
int nSummonId = pSummonInfo->uid;
m_strIllustImg = pSummonInfo->illust_file_name;
int EvolveLevel = 0;
int nLevel = 0;
if( pLevel[2+1] || pLevel[1+1] || pLevel[0+1] )
{
if( pLevel[2+1] > 0 ) //2에 진화 레벨
{
nLevel = pLevel[2+1];
nSummonId = 0; // ?표시
nCreatureNameID = 88; //무엇인가로 표시
EvolveLevel = 2;
const _SUMMON_INFO_FILE* pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pEvolveSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
nSummonId = pEvolveSummonInfo->uid; //성장 단계 -> 진화 단계
nCreatureNameID = pEvolveSummonInfo->name_id;
}
}
}
else if( pLevel[1+1] ) //1에 성장 레벨
{
nLevel = pLevel[1+1];
EvolveLevel = 1;
const _SUMMON_INFO_FILE* pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
nSummonId = pEvolveSummonInfo->uid; //기본 단계 -> 성장 단계
nCreatureNameID = pEvolveSummonInfo->name_id;
}
else
{
nSummonId = 0;
nCreatureNameID = 88; //무엇인가로 표시
}
}
else if( pLevel[0+1] ) //0에 기본 레벨
{
nLevel = pLevel[0+1];
EvolveLevel = 0;
}
m_strIllustImg = GetCreatureDB().GetIllustImgName( nSummonId );
}
else
{
//단, 편성이 된 크리처의 정보는 알수 있음.
/*
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfoByCardHandle( pSummonCard->card_handle );
if( pInfo )
nLevel = pInfo->GetLevel();
*/
nLevel = creatureLevel;
//한번도 소환 되지 않은 크리처는 레벨을 알 수 없다. 임의로 1레벨 설정
if( nLevel == 0 )
nLevel = 1;
}
if( nLevel > 0 )
//'Lv'을 String DB 9501로 참조하도록 한다 2009.09.25. sfreer
strCaption += CStringUtil::StringFormat( " <#ffff00>%s %s %d", GetStringDB().GetString( nCreatureNameID ), GetStringDB().GetString(9501), nLevel ).c_str();
else //소환 안 된 크리쳐는 레벨을 알 수 없음
strCaption += CStringUtil::StringFormat( " <#ffff00>%s", GetStringDB().GetString( nCreatureNameID ) ).c_str();
SetChildCaption( "text_cardname", strCaption.c_str() );
modifyIllustImg(enhance);
}
else
{
m_strIllustImg = "game_image_card_empty.jpg";
strCaption += CStringUtil::StringFormat( " <#fbe6ad>%s%s", GetStringDB().GetString( pItemBase->nNameId ), GetStringDB().GetString(23) ).c_str();
SetChildCaption( "text_cardname", strCaption.c_str() );
if( m_pOverBreed && m_pOverBreedIcon )
{
m_pOverBreedIcon->SetShow( false );
m_pOverBreed->SetShow( false );
}
}
//카드 이미지 변경
refreshCardImg();
//희귀도
int nRateStringID = (-1);
switch( pSummonInfo->rate )
{
case SummonBase::RATE_BASIC: nRateStringID = 27; break;
case SummonBase::RATE_NORMAL_BASIC: nRateStringID = 28; break;
case SummonBase::RATE_SPECIAL_BASIC: nRateStringID = 29; break;
case SummonBase::RATE_NORMAL_RARE: nRateStringID = 30; break;
case SummonBase::RATE_SPECIAL_RARE: nRateStringID = 31; break;
case SummonBase::RATE_UNIQUE: nRateStringID = 32; break;
// AziaMafia Pet Rarity
case SummonBase::RATE_VERACRUZ: nRateStringID = 2110000005; break;
case SummonBase::RATE_PHANTOM: nRateStringID = 2110000006; break;
case SummonBase::RATE_AURA: nRateStringID = 2110000007; break;
case SummonBase::RATE_SHINNY: nRateStringID = 2110000008; break;
case SummonBase::RATE_GALAXY: nRateStringID = 2110000009; break;
}
if( (-1) != nRateStringID )
{
strCaption = "<font:font_01><left><top><size:9>";
strCaption += GetStringDB().GetString( nRateStringID );
}
SetChildCaption( "text_rarity_value", strCaption.c_str() );
std::string strAffiliationResult( m_strAffiliationNamePropertyTag );
std::string strAffiliation( "" );
std::string strAffiliationDetail( "" );
UINT nAffiliationID( pSummonInfo->affiliation_id );
UINT nAffiliationDetailID( pSummonInfo->affiliationDetail_id );
MONSTER_AFFILIATION_INFO* const pAffiliationInfo( GetMonsterAffiliationDB().GetMonsterAffiliationInfo( nAffiliationID ) );
if( pAffiliationInfo )
{
strAffiliation = S( pAffiliationInfo->m_nStringID );
strAffiliationResult.append( strAffiliation );
}
MONSTER_AFFILIATION_DETAIL_INFO* const pAffiliationDetail( GetMonsterAffiliationDetailDB().GetMonsterAffiliationDetailInfo( nAffiliationDetailID ) );
if( pAffiliationDetail )
{
strAffiliationDetail = S( pAffiliationDetail->m_nStringID );
if( NULL != strAffiliationDetail.compare( strAffiliation ) )
{
strAffiliationResult.append( " : " );
strAffiliationResult.append( strAffiliationDetail );
}
if( m_pAffiliationIcon )
{
if( isSummon )
m_pAffiliationIcon->SetIcon( c_szDEF_SPR_NAME, pAffiliationDetail->m_strTamingTamedIconFileName.c_str() );
else
m_pAffiliationIcon->SetIcon( c_szDEF_SPR_NAME, pAffiliationDetail->m_strTamingPossibleIconFileName.c_str() );
}
}
m_pAffiliation->SetCaption( strAffiliationResult.c_str() );
//특성 설명
// 2010.10.04 color 설정 - prodongi
strCaption = "<font:font_01><size:9><#898989>";
strCaption += GetStringDB().GetString( pSummonInfo->text_feature_id );
SetChildCaption( "text_feature", strCaption.c_str() );
}
void SUICreatureCardFrontWnd::setData()
{
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD ))
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD, false));
if( !IsShow() )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, true ) );
}
}
//-----------------------------------------------------------------------------------------------------------------
// 생성자
//-----------------------------------------------------------------------------------------------------------------
SUICreatureCardBackWnd::SUICreatureCardBackWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo )
, m_nSkillDataSize( NULL )
, m_nScrollPos( NULL )
, m_maxDurGageSize( NULL )
, m_pAffiliationIcon( NULL )
, m_pOverBreed( NULL )
, m_pOverBreedIcon( NULL )
, m_strOverBreedPropertyTag( "" )
{
}
//-----------------------------------------------------------------------------------------------------------------
// 파괴자
//-----------------------------------------------------------------------------------------------------------------
SUICreatureCardBackWnd::~SUICreatureCardBackWnd()
{
m_vSkillSlotList.clear();
m_skillLevelList.clear();
}
//-----------------------------------------------------------------------------------------------------------------
// 메시지 처리
//-----------------------------------------------------------------------------------------------------------------
void SUICreatureCardBackWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
// 2010.08.03 - prodongi
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, false ) );
}
else if (::_stricmp(lpszControlID, "button_flip") == 0)
{
m_pGameManager->StartSound( "ui_button_click.wav" );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, GetRect().left, GetRect().top ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, true ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, false ) );
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
LimitMoveWnd();
break;
case KUI_MESSAGE::KSCROLL_SELECT: // 스크롤 선택
{
int nPos = int(lparam);
nPos = max( nPos, 0 );
m_nScrollPos = nPos;
RefreshScrollbar();
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
//-----------------------------------------------------------------------------------------------------------------
// 컨트롤 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUICreatureCardBackWnd::InitControls( KPoint kPos )
{
SetCustomMovingRect( KRect( 0,0,289,20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
KUIControl* flipWnd( dynamicCast<KUIControl*>( GetChild("button_flip") ) );
if (flipWnd)
flipWnd->SetTooltip( S( 7222 ) /*앞장으로*/ );
return SUIWnd::InitControls(kPos);
}
//-----------------------------------------------------------------------------------------------------------------
// 데이터 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUICreatureCardBackWnd::InitData( bool bReload /*= false*/ )
{
if( !bReload )
{
RECT rc; rc.top = c_nDescDeltaY; rc.left = 0; rc.right = 0; rc.bottom = c_nDescDeltaY;
for( int i = 0; i < c_nMaxScollLine-1; i++ )
{
CopyControl( CStringUtil::StringFormat("icon_item%02d" , i).c_str(), CStringUtil::StringFormat("icon_item%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("text_skillname%02d" , i).c_str(), CStringUtil::StringFormat("text_skillname%02d" , i+1).c_str(), rc );
CopyControl( CStringUtil::StringFormat("text_skillexplan%02d" , i).c_str(), CStringUtil::StringFormat("text_skillexplan%02d" , i+1).c_str(), rc );
}
}
// 2010.09.17 - prodongi
KUIWnd* wnd = GetChild("gauge_repair_line_yellowgreen");
assert(wnd && "failed getChild gauge_repair_line_yellowgreen");
m_maxDurGageSize = wnd->GetRect().GetWidth();
m_pAffiliationIcon = dynamicCast<KUIControlIconStatic*>( GetChild( "creature_monster_target_mark_type" ) );
if( NULL == m_pAffiliationIcon )
{
SDEBUGLOG( "[크리쳐 카드(뒷면)] 컨트롤 정보 얻기 실패 - Name[creature_monster_target_mark_type]" );
assert( m_pAffiliationIcon );
}
m_pOverBreed = dynamicCast<KUIControlStatic*>( GetChild( "text_overbreed_01" ) );
if( NULL == m_pOverBreed )
{
SDEBUGLOG( "[크리쳐 카드(뒷면)] 컨트롤 정보 얻기 실패 - Name[text_overbreed_01]" );
assert( m_pOverBreed );
}
else
{
string strCaption( m_pOverBreed->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strOverBreedPropertyTag );
m_pOverBreed->SetShow( false );
}
m_pOverBreedIcon = dynamicCast<KUIControlStatic*>( GetChild( "mark_overbreed_01" ) );
if( NULL == m_pOverBreedIcon )
{
SDEBUGLOG( "[크리쳐 카드(뒷면)] 컨트롤 정보 얻기 실패 - Name[mark_overbreed_01]" );
assert( m_pOverBreedIcon );
}
else
m_pOverBreedIcon->SetShow( false );
return SUIWnd::InitData(bReload);
}
void SUICreatureCardBackWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case MSG_SUMMON_CARD :
{
SMSG_SUMMON_CARD* pSummonCard = dynamicCast<SMSG_SUMMON_CARD*>(pMsg);
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( pSummonCard->card_handle );
if( !pSlot ) return;
bool isSummon = pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_SUMMON ); /// 2011.03.29 - prodongi
const AR_HANDLE hCreature = m_CreatureSlotMgr.GetEquipedCreature( pSummonCard->card_handle );
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfoByCardHandle( pSummonCard->card_handle );
int creatureLevel = (pInfo) ? pInfo->GetLevel() : 0;
setData(pSummonCard->card_handle,
hCreature,
pSlot->GetItemCode(),
pSlot->GetSummonID(),
isSummon,
pSlot->GetItem()->socket,
pSlot->GetEtherealDurability(),
pSlot->GetEnhance(),
creatureLevel,
m_CreatureSkillSlotMgr.GetSkillList() );
}
break;
case MSG_SUMMON_CARD_ITEM_INFO: /// 2011.03.29 - prodongi
{
SMSG_SUMMON_CARD_ITEM_INFO* info = dynamicCast<SMSG_SUMMON_CARD_ITEM_INFO*>(pMsg);
/// 2011.05.27 - prodongi
XFlag< int > xFlag;
xFlag.CopyFrom(&info->item_info.Flag);
bool isSummon = xFlag.IsOn( ItemInstance::ITEM_FLAG_SUMMON );
std::vector<SSkillSlot*> dummySkillList;
setData(info->item_info.handle,
0,
info->item_info.Code,
info->item_info.summon_id,
isSummon,
info->item_info.socket,
info->item_info.ethereal_durability,
info->item_info.enhance,
info->level,
dummySkillList);
}
break;
/// 2011.05.12 - prodongi
case MSG_SKILL_LEVEL_LIST:
{
SMSG_SKILL_LEVEL_LIST* info = dynamicCast<SMSG_SKILL_LEVEL_LIST*>(pMsg);
setSkillTree(info);
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
pMsg->bUse = true;
}
break;
}
}
void SUICreatureCardBackWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
if (bOpen)
{
/// 2011.05.13 - prodongi
KUIControlVScrollSmallEx* pScrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild( "scrollbar_creature" ));
if(pScrollBar)
{
pScrollBar->SetPosition(0);
RefreshScrollbar();
}
}
}
/// 2011.05.13 - prodongi
void SUICreatureCardBackWnd::setSkillTree(SMSG_SKILL_LEVEL_LIST* info)
{
if (!IsShow())
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, true ) );
m_skillLevelList.clear();
m_vSkillSlotList.clear();
for (int i = 0; i < info->count; ++i)
{
m_skillLevelList.push_back(info->list[i]);
}
RefreshScrollbar();
}
// 2010.05.10 - prodongi
//void SUICreatureCardBackWnd::setCreatureEnhance(SInventorySlot* slot)
void SUICreatureCardBackWnd::setCreatureEnhance(int _etherealDurability, int _enhance)
{
// int enhance = (slot) ? slot->GetEnhance() : 0;
// bool showGage = (slot && 0 != enhance) ? true : false;
int enhance = _enhance;
bool showGage = (0 != enhance) ? true : false;
// enhance
SetChildCaption("number_00", CStringUtil::StringFormat("%d", enhance).c_str());
KUIWnd* wnd = GetChild("gauge_repair_line_yellowgreen");
if (wnd)
{
if (showGage)
{
char const* sprName;
/// 2011.03.29 - prodongi
// int durLevel = getCreatureCardDurPercentLevel(slot, enhance);
int durLevel = getCreatureCardDurPercentLevel(_etherealDurability, enhance);
switch (durLevel)
{
case 0: sprName = "common_guage_titanium_line_red"; break;
case 1: sprName = "common_guage_titanium_line_cyan"; break;
case 2: sprName = "common_guage_titanium_line_yellowgreen"; break;
default: sprName = "common_guage_titanium_line_yellowgreen"; break;
}
wnd->SetAniName(sprName);
/// 2011.03.29 - prodongi
// setStaticWndGage(wnd, m_maxDurGageSize, getCreatureCardDurPercent(slot, enhance));
setStaticWndGage(wnd, m_maxDurGageSize, getCreatureCardDurPercent(_etherealDurability, enhance));
}
wnd->SetShow(showGage);
}
}
void SUICreatureCardBackWnd::RefreshScrollbar()
{
for( int i = 0; i < c_nMaxScollLine ; ++i )
{
SetChildShow( CStringUtil::StringFormat("icon_item%02d", i ).c_str(), false );
SetChildShow( CStringUtil::StringFormat("text_skillname%02d", i ).c_str(), false );
SetChildShow( CStringUtil::StringFormat("text_skillexplan%02d", i ).c_str(), false );
}
/// 2011.05.12 - prodongi
if (!m_vSkillSlotList.empty()) m_nSkillDataSize = (int)m_vSkillSlotList.size();
else if (!m_skillLevelList.empty()) m_nSkillDataSize = (int)m_skillLevelList.size();
else m_nSkillDataSize = 0;
int nScrollRange = max(m_nSkillDataSize - c_nMaxScollLine, 0);
KUIControlVScrollSmallEx* pScrollBar = dynamicCast<KUIControlVScrollSmallEx*>(GetChild( "scrollbar_creature" ));
if( NULL != pScrollBar )
{
pScrollBar->SetMaxRange( DWORD(nScrollRange)+1 );
m_nScrollPos = pScrollBar->GetPosition();
pScrollBar->SetPosition( m_nScrollPos );
}
if( m_nSkillDataSize <= 0 ) return;
/// 2011.05.12 - prodongi
int nCurpos = 0;
for( int i = 0; i < c_nMaxScollLine; ++i )
{
nCurpos = i + m_nScrollPos;
if( nCurpos < m_nSkillDataSize )
{
if (!m_vSkillSlotList.empty())
{
SSkillSlot* pSlot = m_vSkillSlotList[nCurpos];
setSkillData(i, pSlot->GetSkillID(), pSlot->GetBaseLevel());
}
else if (!m_skillLevelList.empty())
{
setSkillData(i, m_skillLevelList[nCurpos].skill_id, m_skillLevelList[nCurpos].skill_level);
}
}
}
}
/// 2011.05.12 - prodongi
void SUICreatureCardBackWnd::setSkillData(int index, int skillId, int skillLevel)
{
SkillBaseEx* s_data = GetSkillDB().GetSkillData(skillId);
if( s_data == NULL ) return ;
KUIControlIconStatic* pIconStatic = NULL;
KUIControlStatic* pCtrlStatic = NULL;
std::string strCaption;
pIconStatic = dynamicCast<KUIControlIconStatic*>(GetChild( CStringUtil::StringFormat("icon_item%02d", index ).c_str() ));
if( pIconStatic )
{
pIconStatic->SetIcon( c_szDEF_SPR_NAME, GetSkillDB().GetIconName( skillId ));
pIconStatic->SetShow( true );
pIconStatic->SetLazyTooltip( new rp::KLazyCreatureSkillTooltip( *m_pDisplayInfo, skillId, skillLevel, true ) );
}
pCtrlStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("text_skillname%02d", index ).c_str() ));
if( pCtrlStatic )
{
/// 2010.10.18 폰트 조정 - prodongi
pCtrlStatic->SetCaption( CStringUtil::StringFormat( "<font:font_01><size:9><#ffffff>%s %s%d", GetStringDB().GetString( s_data->GetNameID() ), GetStringDB().GetString(9501), skillLevel ).c_str() );
pCtrlStatic->SetShow( true );
}
pCtrlStatic = dynamicCast<KUIControlStatic*>(GetChild( CStringUtil::StringFormat("text_skillexplan%02d", index ).c_str() ));
if( pCtrlStatic )
{
std::string strDescription = GetStringDB().GetString( s_data->GetToolTipID() );
int pos = strDescription.rfind("#@detail@#");
if( pos != -1 )
{
strDescription.erase(0, pos);
pos = strDescription.find( "<#ffffcc>" );
if( pos != -1 )
{
strDescription.erase(0, pos);
pos = strDescription.find( "<#ffffff>" );
if( pos != -1 )
{
strDescription.erase(pos, strDescription.size() - 1 );
}
}
}
// #@detail@# 문구가 빠져있다. StringDB를 고쳐야한다! bintitle. 2011.11.15.
#ifdef _DEV
else
{
std::string strMsg = CStringUtil::StringFormat("ID:%d, #@detail@# 문구가 빠져있다. StringDB를 고쳐야한다!", s_data->GetToolTipID());
::MessageBox(NULL,strMsg.c_str(),"Error:StringDB",MB_OK);
}
#endif
/// 2010.10.18 폰트 조정 - prodongi
pos = strDescription.find("<#ffffcc>");
if (-1 != pos)
XStringUtil::Replace(strDescription, "<#ffffcc>", "<#898989>");
else
strDescription = "<#898989>" + strDescription;
// gmpbigsun( 20130410, #26575 ) : 스킬뒷면 사이즈 조정
XStringUtil::Replace( strDescription, "<size:10>", "<size:8>" );
strCaption = "<font:font_01><size:8>"; // sonador 10.4.1 스킬 툴팁 리뉴얼
strCaption += strDescription.c_str();
pCtrlStatic->SetCaption( strCaption.c_str() );
pCtrlStatic->SetShow( true);
}
}
/// 2011.03.29 - prodongi
void SUICreatureCardBackWnd::setData(AR_HANDLE cardHandle, AR_HANDLE creatureHandle, int itemCode, int nSummonID, bool isSummon, int const* socket,
int etherealDurability, int enhance, int creatureLevel, const std::vector<SSkillSlot*>& vecSkillList)
{
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( itemCode );
if( NULL == pItemBase )
return;
const _SUMMON_INFO_FILE* pSummonInfo = GetCreatureDB().GetCreatureData( nSummonID );
if( NULL == pSummonInfo )
return;
//DB index룰 : 기본, 진화1-> 기본+1, 진화2->기본+2
//gmpbigsun(20130404, #26736) 크리쳐 진화상태 오류 수정
int nTempSummonID = 0;
if( pSummonInfo->nForm > 1 )
{
nTempSummonID = nSummonID - (pSummonInfo->nForm-1);
const _SUMMON_INFO_FILE* pTempSummonInfo = GetCreatureDB().GetCreatureData( nTempSummonID );
if( NULL != pTempSummonInfo )
{
//룰에 의거 기본형을 찾고 유효하면 바꿔준다.
nSummonID = nTempSummonID;
pSummonInfo = pTempSummonInfo;
}
}
//end gmpbigsun
//탑승 전용 크리쳐는 표시 안됨.
if( pSummonInfo->is_riding_only < 0 )
return; //데이타 오류
if( pSummonInfo->is_riding_only == 1 )
return; //라이딩 전용
if (IsShow())
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, false ) );
//데이타 변경
int nCreatureNameID = pSummonInfo->name_id;
std::string strCaption = "<left><size:11>"; // sonador 10.4.1 스킬 툴팁 리뉴얼
BYTE byRank( GetCreatureDB().GetRate( nSummonID ) );
switch( byRank )
{
case SummonBase::RATE_BASIC: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+0]; break;
case SummonBase::RATE_NORMAL_BASIC: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+1]; break;
case SummonBase::RATE_SPECIAL_BASIC: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+2]; break;
case SummonBase::RATE_NORMAL_RARE: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+3]; break;
case SummonBase::RATE_SPECIAL_RARE: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+4]; break;
case SummonBase::RATE_UNIQUE: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet+5]; break;
// AziaMafia Pet Rarity
case SummonBase::RATE_VERACRUZ: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + 6]; break;
case SummonBase::RATE_PHANTOM: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + 7]; break;
case SummonBase::RATE_AURA: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + 8]; break;
case SummonBase::RATE_SHINNY: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + 9]; break;
case SummonBase::RATE_GALAXY: strCaption += g_szEmoticonFilter[c_nCreatureRankOffSet + 10]; break;
}
SetChildCaption( "static_grade_00", strCaption.c_str() );
SetChildTooltip( "static_grade_00", GetCreatureDB().GetRateString( byRank ).c_str() );
/// 2010.10.18 폰트 조정 - prodongi
strCaption = "<font:font_01><left><size:9>";
//소환수 들어 있는 것
//if( pSlot->GetXFlag().IsOn( ItemInstance::ITEM_FLAG_SUMMON ) )
if( isSummon ) /// 2011.03.29 - prodongi
{
int const* pLevel = socket;
if( m_pOverBreed && m_pOverBreedIcon )
{
//오버 브리드 계산
//50, 70, 100 : 진화 레벨 상수
int nOverBreed( NULL );
if( pLevel[0+1] > SCreatureDB::EVOLUTION_LV2 )
nOverBreed = pLevel[0+1] - SCreatureDB::EVOLUTION_LV2;
if( pLevel[1+1] > SCreatureDB::EVOLUTION_LV3 )
nOverBreed += pLevel[1+1] - SCreatureDB::EVOLUTION_LV3;
if( nOverBreed )
{
m_pOverBreedIcon->SetShow( true );
m_pOverBreed->SetShow( true );
std::string strOverBreed( m_strOverBreedPropertyTag );
strOverBreed.append( StringFormat( "+%u", nOverBreed ) );
m_pOverBreed->SetCaption( strOverBreed.c_str() );
}
else
{
m_pOverBreedIcon->SetShow( false );
m_pOverBreed->SetShow( false );
}
}
int nSummonId = pSummonInfo->uid;
int EvolveLevel = 0;
int nLevel = 0;
if( pLevel[2+1] || pLevel[1+1] || pLevel[0+1] )
{
if( pLevel[2+1] > 0 ) //2에 진화 레벨
{
nLevel = pLevel[2+1];
nSummonId = 0; // ?표시
nCreatureNameID = 88; //무엇인가로 표시
EvolveLevel = 2;
const _SUMMON_INFO_FILE* pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pEvolveSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
nSummonId = pEvolveSummonInfo->uid; //성장 단계 -> 진화 단계
nCreatureNameID = pEvolveSummonInfo->name_id;
}
}
}
else if( pLevel[1+1] ) //1에 성장 레벨
{
nLevel = pLevel[1+1];
EvolveLevel = 1;
const _SUMMON_INFO_FILE* pEvolveSummonInfo = GetCreatureDB().GetCreatureData( pSummonInfo->nEvolve_target );
if( pEvolveSummonInfo )
{
nSummonId = pEvolveSummonInfo->uid; //기본 단계 -> 성장 단계
nCreatureNameID = pEvolveSummonInfo->name_id;
}
else
{
nSummonId = 0;
nCreatureNameID = 88; //무엇인가로 표시
}
}
else if( pLevel[0+1] ) //0에 기본 레벨
{
nLevel = pLevel[0+1];
EvolveLevel = 0;
}
}
else
{
//단, 편성이 된 크리처의 정보는 알수 있음.
/*
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfoByCardHandle( pSummonCard->card_handle );
if( pInfo )
nLevel = pInfo->GetLevel();
*/
nLevel = creatureLevel;
//한번도 소환 되지 않은 크리처는 레벨을 알 수 없다. 임의로 1레벨 설정
if( nLevel == 0 )
nLevel = 1;
}
if( nLevel > 0 )
//'Lv'을 String DB 9501로 참조하도록 한다 2009.09.25. sfreer
strCaption += CStringUtil::StringFormat( " <#ffff00>%s %s %d", GetStringDB().GetString( nCreatureNameID ), GetStringDB().GetString(9501), nLevel ).c_str();
else //소환 안 된 크리쳐는 레벨을 알 수 없음
strCaption += CStringUtil::StringFormat( " <#ffff00>%s", GetStringDB().GetString( nCreatureNameID ) ).c_str();
SetChildCaption( "text_cardname", strCaption.c_str() );
//탭2 설명
int nNameID_LV1 = pSummonInfo->name_id;
int nNameID_LV2 = 88;
int nNameID_LV3 = 88;
const _SUMMON_INFO_FILE* pEvolveInfo = GetCreatureDB().GetCreatureData( pSummonInfo->nEvolve_target );
if( pEvolveInfo )
{
nNameID_LV2 = pEvolveInfo->name_id;
pEvolveInfo = GetCreatureDB().GetCreatureData( pEvolveInfo->nEvolve_target );
if( pEvolveInfo )
{
nNameID_LV3 = pEvolveInfo->name_id;
}
}
std::string evolveColor[3] = { "<#898989>", "<#898989>", "<#898989>" };
evolveColor[EvolveLevel] = "<#ffffff>";
/// 2010.10.18 폰트 조정 - prodongi
// 기본형
SetChildCaption("text_type_value_04", CStringUtil::StringFormat("<font:font_01><size:9>%s%s", evolveColor[0].c_str(), S(nNameID_LV1)).c_str());
SetChildCaption("text_type_value_01", CStringUtil::StringFormat("<font:font_01><size:9>%s<left>%s", evolveColor[0].c_str(), S(35)).c_str());
// 성장형
SetChildCaption("text_type_value_05", CStringUtil::StringFormat("<font:font_01><size:9>%s%s", evolveColor[1].c_str(), S(nNameID_LV2)).c_str());
SetChildCaption("text_type_value_02", CStringUtil::StringFormat("<font:font_01><size:9>%s<left>%s", evolveColor[1].c_str(), S(36)).c_str());
// 진화형
SetChildCaption("text_type_value_06", CStringUtil::StringFormat("<font:font_01><size:9>%s%s", evolveColor[2].c_str(), S(nNameID_LV3)).c_str());
SetChildCaption("text_type_value_03", CStringUtil::StringFormat("<font:font_01><size:9>%s<left>%s", evolveColor[2].c_str(), S(37)).c_str());
// 2010.05.10 크리쳐 강화 정보- prodongi
//setCreatureEnhance(pSlot);
setCreatureEnhance(etherealDurability, enhance);
}
else
{
strCaption += CStringUtil::StringFormat( " <#fbe6ad>%s%s", GetStringDB().GetString( pItemBase->nNameId ), GetStringDB().GetString(23) ).c_str();
SetChildCaption( "text_cardname", strCaption.c_str() );
//탭2 설명
// 기본형
SetChildCaption("text_type_value_04", "");
// 성장형
SetChildCaption("text_type_value_05", "");
// 진화형
SetChildCaption("text_type_value_06", "");
// 2010.05.10 크리쳐 강화 정보- prodongi
//setCreatureEnhance(NULL);
setCreatureEnhance(0, 0); /// 2011.03.29 - prodongi
if( m_pOverBreed && m_pOverBreedIcon )
{
m_pOverBreedIcon->SetShow( false );
m_pOverBreed->SetShow( false );
}
}
m_vSkillSlotList.clear();
m_skillLevelList.clear();
UINT nAffiliationDetailID( pSummonInfo->affiliationDetail_id );
MONSTER_AFFILIATION_DETAIL_INFO* const pAffiliationDetail( GetMonsterAffiliationDetailDB().GetMonsterAffiliationDetailInfo( nAffiliationDetailID ) );
if( pAffiliationDetail )
{
if( m_pAffiliationIcon )
{
if( isSummon )
m_pAffiliationIcon->SetIcon( c_szDEF_SPR_NAME, pAffiliationDetail->m_strTamingTamedIconFileName.c_str() );
else
m_pAffiliationIcon->SetIcon( c_szDEF_SPR_NAME, pAffiliationDetail->m_strTamingPossibleIconFileName.c_str() );
}
}
/// 2011.03.29 - prodongi
if (creatureHandle)
{
std::vector<SSkillSlot*>::const_iterator it = vecSkillList.begin();
while( it != vecSkillList.end() )
{
SSkillSlot* pSlot = (*it);
++it;
if( pSlot->GetTarget() == creatureHandle )
{
m_vSkillSlotList.push_back( pSlot );
}
}
}
/// 2011.05.27 핸들이 없을 때는 출력할 스킬도 없는게 맞을거 같다. - prodongi
/*
else
{
m_vSkillSlotList.assign(vecSkillList.begin(), vecSkillList.end());
}
*/
RefreshScrollbar();
}
bool SUIBossMonsterCardWnd::InitControls(KPoint kPos)
{
SetCustomMovingRect( KRect( 0,0,289,20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
this->initIllustTexture();
return SUIWnd::InitControls(kPos);
}
bool SUIBossMonsterCardWnd::InitData(bool bReload)
{
m_pAffiliationIcon = dynamicCast<KUIControlIconStatic*>( GetChild( "creature_monster_target_mark_type" ) );
if( NULL == m_pAffiliationIcon )
{
SDEBUGLOG( "[보스 크리쳐 카드(앞면)] 컨트롤 정보 얻기 실패 - Name[creature_monster_target_mark_type]" );
assert( m_pAffiliationIcon );
}
return SUIWnd::InitData(bReload);
}
void SUIBossMonsterCardWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam)
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
if( ::_stricmp( lpszControlID, "button_close" ) == 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD, false ) );
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUIBossMonsterCardWnd::ProcMsgAtStatic(SGameMessage *pMsg)
{
switch( pMsg->nType )
{
case MSG_BOSS_MONSTER_CARD:
{
SMSG_BOSS_MONSTER_CARD* card = dynamicCast<SMSG_BOSS_MONSTER_CARD*>(pMsg);
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( card->card_handle );
if( !pSlot ) return;
const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( pSlot->GetItemCode() );
const _SUMMON_INFO_FILE* pSummonInfo = GetCreatureDB().GetCreatureData( pSlot->GetSummonID() );
if( pSummonInfo == NULL ) return;
//
if( m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT ))
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_FRONT, false));
else if (m_pGameManager->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK))
m_pGameManager->PostMsgAtDynamic(new SIMSG_SHOW_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_CARD_BACK, false));
if( !IsShow() )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_BOSS_MONSTER_CARD, true ) );
}
// 2010.08.26 - prodongi
KUIControl* gradeWnd = dynamicCast<KUIControl*>(GetChild("static_grade_boss_00"));
assert(!gradeWnd);
gradeWnd->SetTooltip(S(7229));
//데이타 변경
int nCreatureNameID = pSummonInfo->name_id;
UINT nAffiliationDetailID( pSummonInfo->affiliationDetail_id );
MONSTER_AFFILIATION_DETAIL_INFO* const pAffiliationDetail( GetMonsterAffiliationDetailDB().GetMonsterAffiliationDetailInfo( nAffiliationDetailID ) );
if( pAffiliationDetail )
{
if( m_pAffiliationIcon )
m_pAffiliationIcon->SetIcon( c_szDEF_SPR_NAME, pAffiliationDetail->m_strTamingTamedIconFileName.c_str() );
}
std::string strCaption( "" );
// name
strCaption = "<font:font_01><left><size:9>";
strCaption += CStringUtil::StringFormat( " <#ffffff>%s", GetStringDB().GetString( nCreatureNameID ) ).c_str();
SetChildCaption( "text_cardname", strCaption.c_str() );
// illust
m_strIllustImg = GetCreatureDB().GetIllustImgName( pSummonInfo->uid );
refreshCardImg();
/// 2010.10.04 color 설정 - prodongi
strCaption = "<font:font_01><size:9><#898989>";
strCaption += GetStringDB().GetString( pSummonInfo->text_feature_id );
SetChildCaption( "text_01", strCaption.c_str() );
// 성능 관련 텍스트
strCaption = "<font:font_01><size:9>";
strCaption += m_displayInfo->getItemEffectTooltipText(pItemBase, 0);
SetChildCaption( "text_feature", strCaption.c_str() );
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
pMsg->bUse = true;
}
break;
}
}