Files
Leviathan/Client/Game/game/Interface/SUICreaturePageWnd.cpp
T
2026-06-01 12:46:52 +02:00

1340 lines
50 KiB
C++

#include "stdafx.h"
#include "KUITabControl.h"
#include "KUIControlStatic.h"
#include "KUIControlGauge.h"
#include "SGameManager.h"
#include "SUICreaturePageWnd.h"
#include "SGameMessage.h"
//#include "SGameMessageUI.h"
#include "SUIDisplayInfo.h"
#include "SSummonSlotMgr.h"
#include "SCreatureDB.h"
#include "SItemDB.h"
#include "SStringDB.h"
#include "SInventoryMgr.h"
#include "MonsterBase.h" //크리처 class얻어오기 위해서 추가 -N4-
// 2010.05.10 - prodongi
#include "SCreatureEnhanceDB.h"
// 2010.05.11 - prodongi
//#include "SUIUtil.h"
#include "Util.h"
#include "SUILazyTooltip.h"
#include "SGameSystem.h"
extern SGameSystem * g_pCurrentGameSystem;
using namespace CStringUtil;
namespace{
const int c_nTabClickArea = 9; // 탭 클릭 영역
const int c_nMaxCreatureItem = SCreatureSlotMgr::MAX_CREATURE_SLOT;
const DWORD c_dwGaugeFillTime = 1000;
enum{
TAB_PARAMETER = 0,
TAB_SKILL,
};
};
SUICreaturePageWnd::SUICreaturePageWnd( SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo )
, m_bShowDetailWnd( false )
, m_pOverBreed( NULL )
, m_pOverBreedIcon( NULL )
, m_pEvolutionRankIcon( NULL )
, m_strOverBreedPropertyTag( "" )
{
}
bool SUICreaturePageWnd::InitControls( KPoint kPos )
{
SetCustomMovingRect( KRect( 0, 0, 310, 20 ) ); // 타이틀 바 선택 영역, 이동위해 클릭 Area
CreateTab();
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( "icon_creature00" ));
if( pIcon )
pIcon->SetIconLayer( 4 );
return SUIWnd::InitControls( kPos );
}
bool SUICreaturePageWnd::InitData( bool bReload )
{
m_bShowDetailWnd = false;
SetChildShow( "creature_gradenumber_plus", true );
SetChildShow( "creature_gradenumber", false );
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 );
m_pEvolutionRankIcon = dynamicCast<KUIControlIconStatic*>( GetChild( "creature_monster_mark_evolution_01" ) );
if( NULL == m_pEvolutionRankIcon )
{
SDEBUGLOG( "[크리쳐 파라메터] 컨트롤 정보 얻기 실패 - Name[creature_monster_mark_evolution_01]" );
assert( m_pEvolutionRankIcon );
}
return SUIWnd::InitData(bReload);
}
void SUICreaturePageWnd::CreateTab()
{
// 탭 만들기
KUISimpleTabControl* pTabControl = dynamicCast<KUISimpleTabControl*>(GetChild("creature_tab"));
if( pTabControl )
{
//TODO : Hardcoding
pTabControl->SetTabProperty( 0, false, 2 );
pTabControl->AddTabItem( S(6253)/*"<size:10>파라미터"*/, S(6303)/*"기본 정보"*/ );
pTabControl->AddTabItem( S(6230)/*"<size:10>스킬"*/ , S(6304)/*"스킬 정보"*/ );
pTabControl->SetSelectedItem( 0 );
}
}
void SUICreaturePageWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
if( bOpen )
{
if( m_CreatureSlotMgr.GetEquipedCreatureCount() <= 0 )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false ) );
}
else
{
m_pGameManager->StartSound( "ui_popup_window01.wav" );
RefreshTab();
RefreshInfo( MODE_ALL, m_CreatureSlotMgr.GetSelectedCreature() );
}
}
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, (bOpen & m_bShowDetailWnd) ) );
}
void SUICreaturePageWnd::OnRefresh( SGameMessage* pMsg )
{
if( IsShow() )
RefreshInfo( MODE_ALL, m_CreatureSlotMgr.GetSelectedCreature() );
}
void SUICreaturePageWnd::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_PAGE , false) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, false) );
}
if( ::_stricmp( lpszControlID, "button_detail" ) == 0 )
{
m_bShowDetailWnd = !m_bShowDetailWnd;
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, m_bShowDetailWnd ) );
}
}
break;
case KUI_MESSAGE::KGENWND_MOVE: // 윈도우 이동
{
LimitMoveWnd(); // 게임 외부로 나가지 못하게 제한
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, GetRect().right, GetRect().bottom ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL , GetRect().left , GetRect().top ) );
}
break;
case KUI_MESSAGE::KTAB_SELECT:
{
// 내 자신이면,, 걍 두고
// 스킬이면.. 닫고 여는 짓을 한다
KUISimpleTabControl* pTab = dynamicCast<KUISimpleTabControl*>(GetChild( "creature_tab" ));
if( pTab )
{
if( pTab->GetSelectedItem() == TAB_PARAMETER ) return;
else
{
// 닫고..
// 스킬 열어준다
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE , false) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, false) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, GetRect().left, GetRect().top ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, true) );
}
}
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
void SUICreaturePageWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_TOGGLE_UIWINDOW:
case IMSG_SHOW_UIWINDOW:
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, GetRect().right, GetRect().bottom ) );
pMsg->bUse = true;
}
break;
case MSG_STAT_INFO:
{
SMSG_STAT_INFO* pStatInfoMsg = (SMSG_STAT_INFO*)pMsg;
if( pStatInfoMsg->type == TS_SC_STAT_INFO::TOTAL )
{
RefreshParameter( pStatInfoMsg->handle );
RefreshStat( pStatInfoMsg->handle );
RefreshItemParameter( pStatInfoMsg->handle );
RefreshItemStat( pStatInfoMsg->handle );
}
else if( pStatInfoMsg->type == TS_SC_STAT_INFO::BY_ITEM )
{
RefreshItemParameter( pStatInfoMsg->handle );
RefreshParameter( pStatInfoMsg->handle );
RefreshItemStat( pStatInfoMsg->handle );
RefreshStat( pStatInfoMsg->handle );
}
pMsg->bUse = true;
}
break;
case IMSG_UI_TARGET_STAT:
{
SIMSG_UI_TARGET_STAT* pUIMsg = dynamicCast<SIMSG_UI_TARGET_STAT*>(pMsg);
if( pUIMsg->handle != m_CreatureSlotMgr.GetSelectedCreature() ) return;
RefreshHP( pUIMsg->m_nVar1, pUIMsg->m_nVar3 );
RefreshMP( pUIMsg->m_nVar2, pUIMsg->m_nVar4 );
pMsg->bUse = true;
}
break;
case MSG_LEVEL_UPDATE:
{
RefreshCreatureLevel( ((SMSG_LEVEL_UPDATE*)pMsg)->handle );
RefreshCreatureExp( ((SMSG_LEVEL_UPDATE*)pMsg)->handle );
RefreshCreaturerOverbreed( ((SMSG_LEVEL_UPDATE*)pMsg)->handle );
RefreshCreaturerEvolutionFormIcon( ((SMSG_LEVEL_UPDATE*)pMsg)->handle );
pMsg->bUse = true;
}
break;
case MSG_EXP_UPDATE:
{
RefreshCreatureExp( ((SMSG_EXP_UPDATE*)pMsg)->handle );
RefreshCreatureJP( ((SMSG_EXP_UPDATE*)pMsg)->handle );
pMsg->bUse = true;
}
break;
case MSG_SP:
{
RefreshCreatureStat( ((SMSG_SP*)pMsg)->handle );
pMsg->bUse = true;
}
case MSG_PROPERTY:
{
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)pMsg;
switch( pPropertyMsg->nPropertyType )
{
case SMSG_PROPERTY::PROPERTY_LEVEL:
case SMSG_PROPERTY::PROPERTY_EXP:
case SMSG_PROPERTY::PROPERTY_JP:
{
RefreshCreatureStat( pPropertyMsg->handle );
RefreshCreatureLevel( pPropertyMsg->handle );
RefreshCreatureExp( pPropertyMsg->handle );
RefreshCreatureJP( pPropertyMsg->handle );
RefreshCreaturerOverbreed( pPropertyMsg->handle );
RefreshCreaturerEvolutionFormIcon( pPropertyMsg->handle );
}
break;
}
pMsg->bUse = true;
}
break;
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY );
m_pGameManager->PostMsgAtDynamic( new SIMSG_UI_MOVE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, GetRect().right, GetRect().bottom ) );
pMsg->bUse = true;
}
break;
case MSG_CHANGE_NAME:
{
SMSG_CHANGE_NAME* pNameMsg = (SMSG_CHANGE_NAME*)pMsg;
RefreshCreatureName(pNameMsg->handle);
RefreshCreaturerOverbreed(pNameMsg->handle);
RefreshCreaturerEvolutionFormIcon( pNameMsg->handle );
}
break;
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
if( pData->m_strString == "refresh_durability" )
{
RefreshInfo( MODE_ALL, m_CreatureSlotMgr.GetSelectedCreature() );
}
}
break;
}
}
// =============================
// Refresh
// =============================
void SUICreaturePageWnd::RefreshInfo( int nMode, AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
switch(nMode)
{
case MODE_ALL:
{
RefreshHPMP( hCreature );
RefreshCreatureFace(hCreature);
RefreshCreatureLevel(hCreature);
RefreshCreatureExp(hCreature);
RefreshCreatureJP(hCreature);
RefreshCreatureStat( hCreature );
RefreshCreaturerRank(hCreature);
RefreshCreatureName(hCreature);
RefreshCreatureClass(hCreature);
RefreshCreaturerOverbreed(hCreature);
RefreshCreaturerEvolutionFormIcon(hCreature);
RefreshParameter(hCreature);
RefreshItemParameter(hCreature);
RefreshStat( hCreature );
RefreshItemStat( hCreature );
UISendStringMessage(m_pGameManager, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, "refresh_durability");
}
break;
case MODE_STAT:
RefreshParameter(hCreature);
RefreshStat( hCreature );
break;
case MODE_ITEM:
RefreshItemParameter(hCreature);
RefreshItemStat( hCreature );
break;
case MODE_REGEN:
break;
}
}
// face id
void SUICreaturePageWnd::RefreshCreatureFace( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
KUIControlMultiIcon* pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( "icon_creature00" ));
if( pIcon )
{
//gmpbigsun(20130411): BORDER추가
ResetMultiIcon( pIcon, 0, 4 );
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetSelectedCreatureCard());
int enhance = (slot) ? slot->GetEnhance() : 0;
char iconName[128];
::getEnhanceIconName(iconName, pInfo, enhance);
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, iconName );
std::string strTemp;
int nDurability = (slot) ? slot->GetEtherealDurability() : 0;
getIconNameSummonCard_BORDER( strTemp, pInfo->GetID(), enhance, nDurability );
pIcon->SetIcon( 1, c_szDEF_SPR_NAME, strTemp.c_str() );
}
}
}
// level
void SUICreaturePageWnd::RefreshCreatureLevel( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
SetChildCaption( "static_creature_lv_value", CStringUtil::StringFormat( "<vcenter><hcenter>%s%d", S(6425), pInfo != NULL ? pInfo->GetLevel() : 0 ).c_str() );
}
void SUICreaturePageWnd::RefreshHPMP( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
RefreshHP( pInfo->GetHP(), pInfo->GetMaxHP() );
RefreshMP( pInfo->GetMP(), pInfo->GetMaxMP() );
}
}
// exp
void SUICreaturePageWnd::RefreshCreatureExp( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
double fPer;
if (0 == pInfo->GetMaxExp())
fPer = 0.0f;
else
fPer = ((double)(pInfo->GetCurExp())/pInfo->GetMaxExp())*100.f;
if (100.0f < fPer)
fPer = 100.0f;
KUIControlGauge* pGuage = dynamicCast<KUIControlGauge*>(GetChild( CStringUtil::StringFormat("gauge_exp").c_str() ));
if( pGuage )
{
pGuage->SetMax( 1000 );
pGuage->SetGauge( (double)pInfo->GetCurExp() / pInfo->GetMaxExp() * 1000, 0 );
}
static char s_szUnit[] = " KMGTPEZY";
__int64 cxp = pInfo->GetCurExp();
__int64 mxp = pInfo->GetMaxExp();
int c, m;
for ( c = 0; (s_szUnit[c] != NULL) && (cxp > 999999); ++c )
cxp /= 1000;
for ( m = 0; (s_szUnit[m] != NULL) && (mxp > 999999); ++m )
mxp /= 1000;
/// 2011.07.22 - prodongi
SetChildCaption( "static_exp_value",
CStringUtil::StringFormat( "%s<font:font_01><b><hcenter><vcenter><size:8>%I64d<#ffff00>%c<#ffffff> / %I64d<#ffff00>%c<#ffffff>",
S(6425), cxp, s_szUnit[c], mxp, s_szUnit[m] ).c_str() );
SetChildCaption( "static_exp_percent_value",
CStringUtil::StringFormat( "%s<shadow><size:8><right>%02.02f%s", S(6425), fPer, "%" ).c_str() );
// SetChildShow( "creature_exp_number" , (nExp>0 || nRest>0) );
// SetChildShow( "creature_exp_decimal", (nExp>0 || nRest>0) );
// SetChildCaption( "creature_exp_number" , CStringUtil::StringFormat("%d", nExp ).c_str() );
// SetChildCaption( "creature_exp_number02", CStringUtil::StringFormat("%d", nRest).c_str() );
}
}
// name
void SUICreaturePageWnd::RefreshCreatureName( AR_HANDLE hCreature )
{
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
std::string strName( "" );
strName += CStringUtil::StringFormat( "<size:12><left>%s", pInfo->GetName() );
SetChildCaption( "static_creature_name", strName.c_str() );
}
}
//overbreed
void SUICreaturePageWnd::RefreshCreaturerOverbreed( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() )
return;
const SCreatureInfo* pInfo( m_CreatureSlotMgr.GetCreatureInfo( hCreature ) );
if( NULL == pInfo )
return;
if( NULL == m_pOverBreed ||
NULL == m_pOverBreedIcon )
return;
int nOverBreed( pInfo->GetOverBreed() );
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 );
}
}
//overbreed
void SUICreaturePageWnd::RefreshCreaturerEvolutionFormIcon( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() )
return;
const SCreatureInfo* pInfo( m_CreatureSlotMgr.GetCreatureInfo( hCreature ) );
if( NULL == pInfo )
return;
if( NULL == m_pEvolutionRankIcon )
return;
string strGetEvolutionFormIconFileName( GetCreatureDB().GetEvolutionFormIconFileName( pInfo->GetID() ) );
if( strGetEvolutionFormIconFileName.empty() )
{
m_pEvolutionRankIcon->SetShow( false );
}
else
{
m_pEvolutionRankIcon->SetIcon( c_szDEF_SPR_NAME, strGetEvolutionFormIconFileName.c_str() );
m_pEvolutionRankIcon->SetTooltip( GetCreatureDB().GetEvolutionFormString( pInfo->GetID() ).c_str() );
m_pEvolutionRankIcon->SetShow( true );
}
}
// class
void SUICreaturePageWnd::RefreshCreatureClass( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
_SUMMON_INFO_FILE * pSummon = GetCreatureDB().GetCreatureData( pInfo->GetID() );
if( pSummon )
SetChildCaption( "static_creature_type", CStringUtil::StringFormat( "<#fcc42f><size:10><left>%s", GetStringDB().GetString( pSummon->name_id ) ).c_str() );
else
SetChildCaption( "static_creature_type", CStringUtil::StringFormat( "<#fcc42f><size:10><left>%s", pInfo->GetName() ).c_str() );
}
}
//Rank
void SUICreaturePageWnd::RefreshCreaturerRank(AR_HANDLE hCreature)
{
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
std::string strRank( "" ), strRankTooltip( "" );
if( pInfo )
{
BYTE byRank( GetCreatureDB().GetRate( pInfo->GetID() ) );
switch( byRank )
{
case SummonBase::RATE_BASIC: strRank = "#@C1R@#"; break;
case SummonBase::RATE_NORMAL_BASIC: strRank = "#@C2R@#"; break;
case SummonBase::RATE_SPECIAL_BASIC: strRank = "#@C3R@#"; break;
case SummonBase::RATE_NORMAL_RARE: strRank = "#@C4R@#"; break;
case SummonBase::RATE_SPECIAL_RARE: strRank = "#@C5R@#"; break;
case SummonBase::RATE_UNIQUE: strRank = "#@C6R@#"; break;
// AziaMafia Pet Rarity
case SummonBase::RATE_VERACRUZ: strRank = "#@C7R@#"; break;
case SummonBase::RATE_PHANTOM: strRank = "#@C8R@#"; break;
case SummonBase::RATE_AURA: strRank = "#@C9R@#"; break;
case SummonBase::RATE_SHINNY: strRank = "#@C10R@#"; break;
case SummonBase::RATE_GALAXY: strRank = "#@C11R@#"; break;
}
strRankTooltip = GetCreatureDB().GetRateString( byRank );
}
SetChildCaption( "static_grade_00", strRank.c_str() );
SetChildTooltip( "static_grade_00", strRankTooltip.c_str() );
}
// jp
void SUICreaturePageWnd::RefreshCreatureJP( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
// K/M 처리
if( pInfo )
{
/// 2011.04.27 정리 - prodongi
/*
const char* szCaption = m_pDisplayInfo->GetJP( &nJP );
SetChildShow( "static_jp_k_font", ( szCaption != NULL ) );
SetChildCaption( "static_creature_jp_value", CStringUtil::StringFormat( "<right>%s%d", S(6425), nJP ).c_str() );
*/
std::string jpStr;
jpToString(pInfo->GetJP(), jpStr);
SetChildCaption( "static_creature_jp_value", jpStr.c_str());
}
}
void SUICreaturePageWnd::SetGauge( KUIControlGauge* pGauge, __int64 nCur, __int64 nMax )
{
if( pGauge )
{
pGauge->SetMax( nMax );
pGauge->SetGauge( nCur, 0 );
}
}
void SUICreaturePageWnd::RefreshHP( int nHP, int nMaxHP )
{
int nExp, nRest;
m_pDisplayInfo->GetPercentValue( nHP, nMaxHP, &nExp, &nRest );
KUIControlGauge* pGuage01 = dynamicCast<KUIControlGauge*>(GetChild( "gauge_hp" ));
if( pGuage01 )
{
m_pDisplayInfo->RefreshGaugeAndStatic( pGuage01, nHP, nMaxHP, nExp, c_dwGaugeFillTime );
// 게이지 남은 양에 따라 텍스처 바꿔줌 // 2012.02.03 - servantes
setHPGaugeTexture( nExp, pGuage01, 11 );
}
/// 2011.07.22 - prodongi
SetChildCaption( "static_hp_value" , CStringUtil::StringFormat( "%s<font:font_01><b><hcenter><vcenter><size:8>%d/%d", S(6425), nHP, nMaxHP ).c_str() );
SetChildCaption( "static_hp_percent_value", CStringUtil::StringFormat( "%s<shadow><size:8><right>%d.%d%s", S(6425), nExp, nRest, "%" ).c_str() );
}
void SUICreaturePageWnd::RefreshMP( int nMP, int nMaxMP )
{
int nExp, nRest;
m_pDisplayInfo->GetPercentValue( nMP, nMaxMP, &nExp, &nRest );
KUIControlGauge* pGuage02 = dynamicCast<KUIControlGauge*>(GetChild( CStringUtil::StringFormat("gauge_mp").c_str() ));
SetGauge( pGuage02, nMP, nMaxMP );
/// 2011.07.22 - prodongi
SetChildCaption( "static_mp_value" , CStringUtil::StringFormat( "%s<font:font_01><b><hcenter><vcenter><size:8>%d/%d", S(6425), nMP, nMaxMP ).c_str() );
SetChildCaption( "static_mp_percent_value", CStringUtil::StringFormat( "%s<shadow><size:8><right>%d.%d%s", S(6425), nExp, nRest, "%" ).c_str() );
}
// hp/mp/sp
void SUICreaturePageWnd::RefreshCreatureStat( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureInfo* pInfo = m_CreatureSlotMgr.GetCreatureInfo( hCreature );
if( pInfo )
{
//int nExp, nRest;
// 2011.11.29 - servantes : sp 예전 nui에 있던것 현재 없음 주석처리
//아직 MAX SP 없음
//m_pDisplayInfo->GetPercentValue( pInfo->GetSP(), pInfo->GetSP(), &nExp, &nRest );
//KUIControlGauge* pGuage04 = dynamicCast<KUIControlGauge*>(GetChild( CStringUtil::StringFormat("gauge_sp").c_str() ));
//SetGauge( pGuage04, pInfo->GetSP(), pInfo->GetSP() );
//SetChildCaption( "static_sp_value" , CStringUtil::StringFormat( "%s<shadow><hcenter><vcenter><size:8>%d/%d", S(6425), pInfo->GetSP(), pInfo->GetSP() ).c_str() );
//SetChildCaption( "static_sp_percent_value", CStringUtil::StringFormat( "%s<shadow><size:8><right>%d.%d%s", S(6425), nExp, nRest, "%" ).c_str() );
//SetChildNumber( "creature_maxhp_number", pInfo->GetMaxHP() );
//SetChildNumber( "creature_maxmp_number", pInfo->GetMaxMP() );
//SetChildNumber( "creature_maxsp_number", pInfo->GetSP() );
}
}
// 파라미터
void SUICreaturePageWnd::RefreshParameter( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_SELF );
if( pInfo == NULL ) return;
// basic
SetChildCaption( "static_basic01_value", GetValue( pInfo->GetAttribute().nAttackPointRight ).c_str() );// 공격력 오른쪽
SetChildCaption( "static_basic02_value", GetValue( pInfo->GetAttribute().nAccuracyRight ).c_str() );// 명중 오른쪽
SetChildCaption( "static_basic03_value", GetValue( pInfo->GetAttribute().nMagicPoint ).c_str() );// 마력
SetChildCaption( "static_basic04_value", GetValue( pInfo->GetAttribute().nDefence ).c_str() );// 방어력
SetChildCaption( "static_basic05_value", GetValue( pInfo->GetAttribute().nAvoid ).c_str() );// 회피
SetChildCaption( "static_basic06_value", GetValue( pInfo->GetAttribute().nAttackSpeed ).c_str() );// 공속
SetChildCaption( "static_basic07_value", GetValue( pInfo->GetAttribute().nCastingSpeed ).c_str() );// 시전
SetChildCaption( "static_basic08_value", GetValue( pInfo->GetAttribute().nMagicAccuracy ).c_str() );// 마명중
SetChildCaption( "static_basic09_value", GetValue( pInfo->GetAttribute().nMagicDefence ).c_str() );// 마방
SetChildCaption( "static_basic10_value", GetValue( pInfo->GetAttribute().nMagicAvoid ).c_str() );// 마저항
SetChildCaption( "static_basic11_value", GetValue( pInfo->GetAttribute().nMoveSpeed ).c_str() );// 이속
// expand
SetChildCaption( "static_expand01_value", GetValue( pInfo->GetAttribute().nHPRegenPercentage, true ).c_str() ); // hp 재생률
SetChildCaption( "static_expand02_value", GetValue( pInfo->GetAttribute().nMPRegenPercentage, true ).c_str() ); // mp 재생률
SetChildCaption( "static_expand03_value", GetValue( pInfo->GetAttribute().nBlockChance, true).c_str() ); // 블럭률
SetChildCaption( "static_expand04_value", GetValue( pInfo->GetAttribute().nCritical, true ).c_str() ); // 치명타율
SetChildCaption( "static_expand05_value", GetValue( pInfo->GetAttribute().nCoolTimeSpeed ).c_str() ); // 재시전속도
SetChildCaption( "static_expand08_value", GetValue( pInfo->GetAttribute().nHPRegenPoint ).c_str() ); // HP회복력
SetChildCaption( "static_expand09_value", GetValue( pInfo->GetAttribute().nMPRegenPoint ).c_str() ); // MP회복력
SetChildCaption( "static_expand10_value", GetValue( pInfo->GetAttribute().nBlockDefence ).c_str() ); // 블럭방어력
SetChildCaption( "static_expand11_value", GetValue( pInfo->GetAttribute().nCriticalPower, true ).c_str() ); // 치명타위력
SetChildCaption( "static_expand12_value", GetValue( pInfo->GetAttribute().nPerfectBlock, true ).c_str() ); // 퍼펙트 블럭률
}
void SUICreaturePageWnd::RefreshItemParameter( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_ITEM );
if( pInfo == NULL ) return;
// basic
SetValue( "static_basic01_plus_value", pInfo->GetAttribute().nAttackPointRight);// 공격력
SetValue( "static_basic02_plus_value", pInfo->GetAttribute().nAccuracyRight); // 명중
SetValue( "static_basic03_plus_value", pInfo->GetAttribute().nMagicPoint); // 마력
SetValue( "static_basic04_plus_value", pInfo->GetAttribute().nDefence); // 방어력
SetValue( "static_basic05_plus_value", pInfo->GetAttribute().nAvoid); // 회피
SetValue( "static_basic06_plus_value", pInfo->GetAttribute().nAttackSpeed); // 공속
SetValue( "static_basic07_plus_value", pInfo->GetAttribute().nCastingSpeed); // 시전
SetValue( "static_basic08_plus_value", pInfo->GetAttribute().nMagicAccuracy); // 마명중
SetValue( "static_basic09_plus_value", pInfo->GetAttribute().nMagicDefence); // 마방
SetValue( "static_basic10_plus_value", pInfo->GetAttribute().nMagicAvoid); // 마저항
SetValue( "static_basic11_plus_value", pInfo->GetAttribute().nMoveSpeed); // 이속
// basic sign
RefreshAddInfo( "static_basic01_p_value", pInfo->GetAttribute().nAttackPointRight); // 공격력
RefreshAddInfo( "static_basic02_p_value", pInfo->GetAttribute().nAccuracyRight); // 명중
RefreshAddInfo( "static_basic03_p_value", pInfo->GetAttribute().nMagicPoint); // 마력
RefreshAddInfo( "static_basic04_p_value", pInfo->GetAttribute().nDefence); // 방어력
RefreshAddInfo( "static_basic05_p_value", pInfo->GetAttribute().nAvoid); // 회피
RefreshAddInfo( "static_basic06_p_value", pInfo->GetAttribute().nAttackSpeed); // 공속
RefreshAddInfo( "static_basic07_p_value", pInfo->GetAttribute().nCastingSpeed); // 시전
RefreshAddInfo( "static_basic08_p_value", pInfo->GetAttribute().nMagicAccuracy); // 마명중
RefreshAddInfo( "static_basic09_p_value", pInfo->GetAttribute().nMagicDefence); // 마방
RefreshAddInfo( "static_basic10_p_value", pInfo->GetAttribute().nMagicAvoid); // 마저항
RefreshAddInfo( "static_basic11_p_value", pInfo->GetAttribute().nMoveSpeed); // 이속
// expand
SetValue( "static_expand01_plus_value", pInfo->GetAttribute().nHPRegenPercentage, true);//HP재생률
SetValue( "static_expand02_plus_value", pInfo->GetAttribute().nMPRegenPercentage, true);//MP재생률
SetValue( "static_expand03_plus_value", pInfo->GetAttribute().nBlockChance, true); // 블럭률
SetValue( "static_expand04_plus_value", pInfo->GetAttribute().nCritical, true); // 치명타율
SetValue( "static_expand05_plus_value", pInfo->GetAttribute().nCoolTimeSpeed); // 재시전
SetValue( "static_expand08_plus_value", pInfo->GetAttribute().nHPRegenPoint); //HP회복력
SetValue( "static_expand09_plus_value", pInfo->GetAttribute().nMPRegenPoint); //MP회복력
SetValue( "static_expand10_plus_value", pInfo->GetAttribute().nBlockDefence); // 블럭
SetValue( "static_expand11_plus_value", pInfo->GetAttribute().nCriticalPower, true); // 크리
SetValue( "static_expand12_plus_value", pInfo->GetAttribute().nPerfectBlock, true); // 퍼펙트 블럭률
// expand sign
RefreshAddInfo( "static_expand01_p_value", pInfo->GetAttribute().nHPRegenPercentage); //HP재생률
RefreshAddInfo( "static_expand02_p_value", pInfo->GetAttribute().nMPRegenPercentage); //MP재생률
RefreshAddInfo( "static_expand03_p_value", pInfo->GetAttribute().nBlockChance); // 블럭률
RefreshAddInfo( "static_expand04_p_value", pInfo->GetAttribute().nCritical); // 치명타율
RefreshAddInfo( "static_expand05_p_value", pInfo->GetAttribute().nCoolTimeSpeed); // 재시전
RefreshAddInfo( "static_expand08_p_value", pInfo->GetAttribute().nHPRegenPoint); //HP회복력
RefreshAddInfo( "static_expand09_p_value", pInfo->GetAttribute().nMPRegenPoint); //MP회복력
RefreshAddInfo( "static_expand10_p_value", pInfo->GetAttribute().nBlockDefence); // 블럭
RefreshAddInfo( "static_expand11_p_value", pInfo->GetAttribute().nCriticalPower); // 크리
RefreshAddInfo( "static_expand12_p_value", pInfo->GetAttribute().nPerfectBlock); //퍼펙트 블럭률
}
void SUICreaturePageWnd::RefreshStat( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_SELF );
if( pInfo == NULL ) return;
SetChildCaption( "static_status01_value", GetValue( pInfo->GetStat().strength ).c_str() ); // 힘
SetChildCaption( "static_status02_value", GetValue( pInfo->GetStat().vital ).c_str() ); // 체력
SetChildCaption( "static_status03_value", GetValue( pInfo->GetStat().agility ).c_str() ); // 민첩
SetChildCaption( "static_status04_value", GetValue( pInfo->GetStat().intelligence ).c_str() ); // 지력
SetChildCaption( "static_status05_value", GetValue( pInfo->GetStat().mentality ).c_str() ); // 정신
SetChildCaption( "static_status06_value", GetValue( pInfo->GetStat().dexterity ).c_str() ); // 집중
SetChildCaption( "static_status07_value", GetValue( pInfo->GetStat().luck ).c_str() ); // 행운
}
void SUICreaturePageWnd::RefreshAddInfo( const char * pControlName, int nValue )
{
if( nValue == 0 )
SetChildShow( pControlName, false );
else
{
SetChildShow( pControlName, true );
if( nValue > 0 )
SetChildCaption( pControlName, "<vcenter><size:10><right>+" );
else if( nValue < 0 )
SetChildCaption( pControlName, "<vcenter><size:10><right>-" );
}
}
void SUICreaturePageWnd::RefreshItemStat( AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_ITEM );
if( pInfo == NULL ) return;
RefreshAddInfo( "static_status01_p_value", pInfo->GetStat().strength ); // 힘
RefreshAddInfo( "static_status02_p_value", pInfo->GetStat().vital ); // 체력
RefreshAddInfo( "static_status03_p_value", pInfo->GetStat().agility ); // 민첩
RefreshAddInfo( "static_status04_p_value", pInfo->GetStat().intelligence ); // 지력
RefreshAddInfo( "static_status05_p_value", pInfo->GetStat().mentality ); // 정신
RefreshAddInfo( "static_status06_p_value", pInfo->GetStat().dexterity ); // 집중
RefreshAddInfo( "static_status07_p_value", pInfo->GetStat().luck ); // 행운
SetValue( "static_status01_plus_value", pInfo->GetStat().strength ); // 힘
SetValue( "static_status02_plus_value", pInfo->GetStat().vital ); // 체력
SetValue( "static_status03_plus_value", pInfo->GetStat().agility ); // 민첩
SetValue( "static_status04_plus_value", pInfo->GetStat().intelligence ); // 지력
SetValue( "static_status05_plus_value", pInfo->GetStat().mentality ); // 정신
SetValue( "static_status06_plus_value", pInfo->GetStat().dexterity ); // 집중
SetValue( "static_status07_plus_value", pInfo->GetStat().luck ); // 행운
}
// 리젠
void SUICreaturePageWnd::RefreshRegen( bool bHP, int nPer, int nPoint, AR_HANDLE hCreature )
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
if( bHP )
{
// HP리젠
SetChildCaption( "static_expand01_value", GetValue( nPer ).c_str() );
if( nPoint )
SetChildCaption( "static_expand01_plus_value", CStringUtil::StringFormat( "<size:10><#74D6FF><right>%d", nPoint ).c_str() );
else
SetChildShow( "static_expand01_plus_value", false );
RefreshAddInfo( "static_expand01_plus_value", nPoint);
}
else
{
// MP리젠
SetChildCaption( "static_expand02_value", GetValue( nPer ).c_str() );
if( nPoint )
SetChildCaption( "static_expand02_plus_value", CStringUtil::StringFormat( "<size:10><#74D6FF><right>%d", nPoint ).c_str() );
else
SetChildShow( "static_expand02_plus_value", false );
RefreshAddInfo( "static_expand02_plus_value", nPoint);
}
}
void SUICreaturePageWnd::SetValue( std::string strName, int nValue, bool bPercent )
{
SetChildShow( CStringUtil::StringFormat( "%s", strName.c_str() ).c_str(), (0 == nValue) ? false : true );
if( nValue == 0 ) return;
std::string strPer = "%"; if( !bPercent ) strPer = "";
if( nValue > 0 )
{
SetChildCaption( CStringUtil::StringFormat( "%s", strName.c_str() ).c_str(), CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right><#87D1EC>%d%s", nValue, strPer.c_str() ).c_str() );
}
else
{
nValue *= -1;
SetChildCaption( CStringUtil::StringFormat( "%s", strName.c_str() ).c_str(), CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right><#D70404>%d%s", nValue, strPer.c_str() ).c_str() );
}
}
std::string SUICreaturePageWnd::GetValue( int nValue, bool bPer )
{
std::string strFilter = "%";
if( !bPer ) strFilter = "";
return CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right>%d%s ", nValue, strFilter.c_str() );
}
// 탭 선택
void SUICreaturePageWnd::RefreshTab()
{
KUISimpleTabControl* pTab = dynamicCast<KUISimpleTabControl*>(GetChild( "creature_tab" ));
if( pTab ) pTab->SetSelectedItem(TAB_PARAMETER);
}
//////////////////////////////////////////////////////////////////////////
// detail
//////////////////////////////////////////////////////////////////////////
SUIDetailCreaturePageWnd::~SUIDetailCreaturePageWnd()
{
for(int x=0; x<m_vcDurability.size(); x++)
{
SAFE_DELETE( m_vcDurability[ x ] );
}
m_vcDurability.clear();
}
bool SUIDetailCreaturePageWnd::InitControls( KPoint kPos )
{
return SUIWnd::InitControls( kPos );
}
bool SUIDetailCreaturePageWnd::InitData( bool bReload )
{
KUIControlMultiIcon* pMultiIcon = NULL;
for( int i = 0; i < c_nMaxCreatureItem; i++ )
{
// 2010.05.10 - prodongi
pMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_00", i ).c_str() ));
// pMultiIcon = ( KUIControlMultiIcon* )GetChild( CStringUtil::StringFormat( "icon_itemcard%02d", i ).c_str() );
if( pMultiIcon )
{
//2010.01.19. 아이템내구도처리sfreer
pMultiIcon->SetIconLayer(8);
ResetMultiIcon( pMultiIcon, 0, 8 );
pMultiIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_nocardicon" );
pMultiIcon->SetTooltip();
}
}
SetChildCaption( "static_evaluation00_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
SetChildCaption( "static_evaluation01_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
SetChildCaption( "static_evaluation02_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
SetChildCaption( "static_evaluation03_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
SetChildCaption( "static_evaluation04_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
SetChildCaption( "static_evaluation05_value", CStringUtil::StringFormat( "%s", "?" ).c_str() );
//SetChildCaption( "static_property00_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property00_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property01_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property01_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property02_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property02_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property03_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property03_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property04_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property04_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property05_offense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
//SetChildCaption( "static_property05_defense_value", CStringUtil::StringFormat( "%d", 0 ).c_str() );
SetChildShow( "static_property00_offense_value" );
SetChildShow( "static_property00_defense_value" );
SetChildShow( "static_property01_offense_value" );
SetChildShow( "static_property01_defense_value" );
SetChildShow( "static_property02_offense_value" );
SetChildShow( "static_property02_defense_value" );
SetChildShow( "static_property03_offense_value" );
SetChildShow( "static_property03_defense_value" );
SetChildShow( "static_property04_offense_value" );
SetChildShow( "static_property04_defense_value" );
SetChildShow( "static_property05_offense_value" );
SetChildShow( "static_property05_defense_value" );
SetChildShow( "static_property00_offense_plus00" );
SetChildShow( "static_property00_offense_plus01" );
SetChildShow( "static_property00_offense_plus02" );
SetChildShow( "static_property00_offense_plus03" );
SetChildShow( "static_property00_offense_plus04" );
SetChildShow( "static_property00_offense_plus05" );
SetChildShow( "static_property00_offense_plus06" );
SetChildShow( "static_property00_offense_minus00" );
SetChildShow( "static_property00_offense_minus01" );
SetChildShow( "static_property00_offense_minus02" );
SetChildShow( "static_property00_offense_minus03" );
SetChildShow( "static_property00_offense_minus04" );
SetChildShow( "static_property00_offense_minus05" );
SetChildShow( "static_special00" );
SetChildShow( "static_special01" );
SetChildShow( "static_special02" );
SetChildShow( "static_special03" );
SetChildShow( "static_special04" );
SetChildShow( "static_special00_value" );
SetChildShow( "static_special01_value" );
SetChildShow( "static_special02_value" );
SetChildShow( "static_special03_value" );
SetChildShow( "static_special04_value" );
//m_pDurability = dynamicCast<KUIControlStatic*>( GetChild("creature_card_durabillity_gauge00") );
//if( m_pDurability )
// m_fGaugeWidth = (float)m_pDurability->GetRect().GetWidth(); // 내구도게이지 기본넓이
//m_pCreatureCard = dynamicCast<KUIControlIconStatic*>( GetChild("creatureform_cardslot00") );
//SetChildAsTop("creatureform_cardslot00");
m_sCreatureCardDurability.pIcon = dynamicCast<KUIControlMultiIcon*>( GetChild("creatureform_cardslot00") );
m_sCreatureCardDurability.pIcon->SetIconLayer( 8 );
m_sCreatureCardDurability.pGauge = dynamicCast<KUIControlStatic*> ( GetChild("creature_card_durabillity_gauge00") );
m_sCreatureCardDurability.pGauge->SetShow(false);
SetChildAsTop("creatureform_cardslot00");
SetChildAsTop("creature_card_durabillity_gauge00");
m_fGaugeWidth = (float)m_sCreatureCardDurability.pGauge->GetRect().GetWidth(); // 내구도게이지 기본넓이
// 크리처 아이템 6개
for(int i=0; i<SCreatureSlotMgr::MAX_CREATURE_SLOT; i++)
{
SItemDurability* pSD = new SItemDurability; // ITEM0
pSD->pIcon = dynamicCast<KUIControlMultiIcon*>( GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_00", i).c_str() ) );
pSD->pGauge = dynamicCast<KUIControlStatic*> ( GetChild( CStringUtil::StringFormat( "creature_slot_%02d_durabillity_gauge00", i).c_str() ) );
pSD->pGaugeBase = dynamicCast<KUIControlStatic*> ( GetChild( CStringUtil::StringFormat( "guage_slot_%02d_base_00", i).c_str() ) );
pSD->pGauge->SetShow(false);
// Fraun 7/16/2025 temporary debug in logs
//std::string strOutput = "i: ";
//strOutput += std::to_string(static_cast<long long>(i));
//strOutput += "; pSD: ";
//strOutput += std::to_string(static_cast<long long>( pSD ? 0 : 1));
//strOutput += "\n";
//SLOG(strOutput.c_str());
if (pSD)
{
m_vcDurability.push_back( pSD );
}
}
KUIControlStatic* pGaugeBase = dynamicCast<KUIControlStatic*>( GetChild("guage_slot_05_base_00") );
if( pGaugeBase )
pGaugeBase->SetShow( false );
SetChildShow( "creatureform_cardslot01" ); // creatureform_cardslot01 컨트롤 삭제해야할듯
SetChildShow( "creatureform_cardslot02" ); // creatureform_cardslot02 컨트롤 삭제해야할듯
return SUIWnd::InitData(bReload);
}
void SUIDetailCreaturePageWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
SUIWnd::OnNotifyUIWindowOpen(bOpen);
if( bOpen )
{
RefreshInfo(m_CreatureSlotMgr.GetSelectedCreature());
// 아이템 장착 정보
RefreshCreatureItemSlots();
KUIWnd *pInfoWnd = m_pManager->FindWnd( "window_summon_info" );
if( pInfoWnd ) MovePos( pInfoWnd->GetRect().right, pInfoWnd->GetRect().bottom - GetRect().GetHeight() );
}
}
// 장착 아이템
void SUIDetailCreaturePageWnd::RefreshCreatureItemSlots()
{
// 크리처 핸들로 카드 해들 알아내어 장착하고 있는 크리처인지 검사
if( !m_CreatureSlotMgr.GetSelectedCreature() || !m_CreatureSlotMgr.IsEquipedCreature(m_CreatureSlotMgr.GetSelectedCreature()) )
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_DETAIL, false) );
return;
}
KUIControlMultiIcon* pIcon = NULL;
// 아이템 가져온다
int nCount = m_CreatureSlotMgr.GetCreatureItemCount( m_CreatureSlotMgr.GetSelectedCreature() );
nCount = max( nCount, c_nMaxCreatureItem );
// 2010.05.10 - prodongi
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetSelectedCreatureCard());
int enhance = (slot) ? slot->GetEnhance() : 0;
int maxOpenSlotNum = GetCreatureEnhanceDB().getSlotAmount(enhance);
// 소환수 카드 아이콘을 찾는다
if( slot )
{
m_sCreatureCardDurability.pIcon->SetShow( true );
ResetMultiIcon( m_sCreatureCardDurability.pIcon, 0, 8);
if( false == setSummonCardIcon( m_sCreatureCardDurability.pIcon, slot ) )
{
m_sCreatureCardDurability.pIcon->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( slot->GetItemCode()) );
}
//gmpbigsun( 20130422) : 장비마크 제거
//m_sCreatureCardDurability.pIcon->SetIcon( 1, c_szDEF_SPR_NAME, "common_mark_titanium_equipicon" );
refreshItemDurability( slot, dynamicCast<KUIWnd*>(m_sCreatureCardDurability.pGauge), m_fGaugeWidth );
}
for( int i = 0; i < nCount; i++ )
{
m_vcDurability[i]->pGauge->SetShow( false );
AR_HANDLE hItem = m_CreatureSlotMgr.GetCreatureItem( m_CreatureSlotMgr.GetSelectedCreature(), i );
// 2010.05.10 - prodongi
pIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_00", i ).c_str() ));
if (!pIcon) continue;
bool is = false;
if (hItem)
{
SInventorySlot* pSlot = m_InventoryMgr.GetItemInfo( hItem );
if (pSlot)
{
if( pIcon )
{
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, GetItemDB().GetIconName( pSlot->GetItemCode()) );
/// 2011.04.04 - prodongi
//pIcon->SetIcon( 1, c_szDEF_SPR_NAME, "static_inventory_equipicon" );
pIcon->SetIcon( 1, c_szDEF_SPR_NAME, "common_mark_titanium_equipicon" );
EquipItemAddtionalIconSetter icon_setter( pIcon, pSlot );
pIcon->SetLazyTooltip( new rp::KLazyItemTooltip( *m_pDisplayInfo, pSlot, true ) );
if( i >= ITEM0 && i < MAX )
{
int nResult = refreshItemDurability( pSlot, dynamicCast<KUIWnd*>(m_vcDurability[ i ]->pGauge), m_fGaugeWidth );
if( nResult == 2 )
m_vcDurability[i]->pGaugeBase->SetShow( false );
else
m_vcDurability[i]->pGaugeBase->SetShow( true );
}
if( i == 5 ) // 마지막 아이템은 아직 사용 안함
{
m_vcDurability[i]->pGaugeBase->SetShow( false );
}
}
is = true;
}
else
{
EnableCreatureItemSlots(i);
}
}
else
{
EnableCreatureItemSlots(i);
}
if (!is)
{
// 2010.05.10 - prodongi
char const* sprName;
if (i < maxOpenSlotNum)
{
switch (i)
{
case 0:
case 1: sprName = "static_common_nocardicon"; break;
case 2: sprName = "static_creature_itemslot_accessory"; break;
case 3:
case 4: sprName = "static_creature_itemslot_artifact"; break;
case 5: sprName = "static_common_nocardicon"; break;
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:sprName = "static_creature_itemslot_artifact"; break;
default:sprName = "static_inventory_beltslot";
}
}
else
{
sprName = "static_inventory_beltslot";
}
pIcon->SetIcon( 0, c_szDEF_SPR_NAME, sprName);
pIcon->SetIcon( 1 );
pIcon->SetIcon( 2 );
pIcon->SetIcon( 3 );
pIcon->SetTooltip();
m_vcDurability[i]->pGaugeBase->SetShow( false );
}
}
// 2010.05.10 - prodongi
refreshCreatureEnhance();
}
void SUIDetailCreaturePageWnd::EnableCreatureItemSlots( int nPos, bool bEnable, bool bAll )
{
KUIControlMultiIcon* pMultiIcon = NULL;
if( !bAll ) // 모두 비활성
{
// 2010.05.06 - prodongi
pMultiIcon = dynamicCast<KUIControlMultiIcon*>(GetChild( CStringUtil::StringFormat( "creature_itemcard_icon%02d_00", nPos ).c_str() ));
//pMultiIcon = ( KUIControlMultiIcon* )GetChild( CStringUtil::StringFormat( "icon_itemcard%02d", nPos ).c_str() );
if( pMultiIcon )
{
ResetMultiIcon( pMultiIcon, 0, 8 );
pMultiIcon->SetIcon( 0, c_szDEF_SPR_NAME, "static_common_nocardicon" );
pMultiIcon->SetTooltip();
}
}
}
void SUIDetailCreaturePageWnd::ProcMsgAtStatic( SGameMessage* pMsg )
{
switch( pMsg->nType )
{
case IMSG_UI_MOVE:
{
SIMSG_UI_MOVE* pMoveMsg = ( SIMSG_UI_MOVE* )pMsg;
MovePos( pMoveMsg->m_nX, pMoveMsg->m_nY - GetRect().GetHeight() );
pMsg->bUse = true;
}
break;
case MSG_ITEM_WEAR_INFO:
{
RefreshCreatureItemSlots();
pMsg->bUse = true;
}
break;
case MSG_EQUIP_SUMMON: // 처음 시작할때, 아이템 정보받을때 저장한 크리처 아이템의 장착 정보 가져온다
{
RefreshCreatureItemSlots();
pMsg->bUse = true;
}
break;
case MSG_STAT_INFO:
{
SMSG_STAT_INFO* pStatInfoMsg = (SMSG_STAT_INFO*)pMsg;
if( pStatInfoMsg->handle == m_CreatureSlotMgr.GetSelectedCreature() )
{
if( pStatInfoMsg->type == TS_SC_STAT_INFO::TOTAL )
RefreshParameter(pStatInfoMsg->handle);
else if( pStatInfoMsg->type == TS_SC_STAT_INFO::BY_ITEM )
RefreshInfo(pStatInfoMsg->handle);
}
pMsg->bUse = true;
}
break;
case IMSG_UI_SEND_DATA:
{
SIMSG_UI_SEND_DATA *pData = (SIMSG_UI_SEND_DATA *)pMsg;
if( pData->m_strString == "refresh_durability" )
{
if( IsShow() )
RefreshCreatureItemSlots();
}
}
break;
}
}
void SUIDetailCreaturePageWnd::RefreshInfo(AR_HANDLE hCreature)
{
RefreshParameter(hCreature);
RefreshItemParameter(hCreature);
}
void SUIDetailCreaturePageWnd::RefreshParameter(AR_HANDLE hCreature)
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_SELF );
if( pInfo == NULL ) return;
SetValue("static_expand06_value", pInfo->GetAttribute().nPhysicalDefIgnore, false); /// 물리 방어 무시
SetValue("static_expand07_value", pInfo->GetAttribute().nPhysicalPenetration, false); /// 물리 피해 관통
SetValue("static_expand15_value", pInfo->GetAttribute().nPhysicalDefIgnoreRatio, true); /// 물리 방어 무시 %
SetValue("static_expand16_value", pInfo->GetAttribute().nPhysicalPenetrationRatio, true); /// 물리 피해 관통 %
SetValue("static_expand13_value", pInfo->GetAttribute().nMagicalDefIgnore, false); /// 마법 방어 무시
SetValue("static_expand14_value", pInfo->GetAttribute().nMagicalPenetration, false); /// 마법 피해 관통
SetValue("static_expand17_value", pInfo->GetAttribute().nMagicalDefIgnoreRatio, true); /// 마법 방어 무시 %
SetValue("static_expand18_value", pInfo->GetAttribute().nMagicalPenetrationRatio, true); /// 마법 피해 관통 %
}
void SUIDetailCreaturePageWnd::RefreshItemParameter(AR_HANDLE hCreature)
{
if( hCreature != m_CreatureSlotMgr.GetSelectedCreature() ) return;
const SCreatureStat* pInfo = m_CreatureSlotMgr.GetCreatureStat( hCreature, SCreatureSlot::TYPE_ITEM );
if( pInfo == NULL ) return;
SetItemValue("static_expand06_plus_value", "static_expand06_p", pInfo->GetAttribute().nPhysicalDefIgnore, false); /// 물리 방어 무시
SetItemValue("static_expand07_plus_value", "static_expand07_p", pInfo->GetAttribute().nPhysicalPenetration, false); /// 물리 피해 관통
SetItemValue("static_expand15_plus_value", "static_expand15_p", pInfo->GetAttribute().nPhysicalDefIgnoreRatio, true); /// 물리 방어 무시 %
SetItemValue("static_expand16_plus_value", "static_expand16_p", pInfo->GetAttribute().nPhysicalPenetrationRatio, true); /// 물리 피해 관통 %
SetItemValue("static_expand13_plus_value", "static_expand13_p", pInfo->GetAttribute().nMagicalDefIgnore, false); /// 마법 방어 무시
SetItemValue("static_expand14_plus_value", "static_expand14_p", pInfo->GetAttribute().nMagicalPenetration, false); /// 마법 피해 관통
SetItemValue("static_expand17_plus_value", "static_expand17_p", pInfo->GetAttribute().nMagicalDefIgnoreRatio, true); /// 마법 방어 무시 %
SetItemValue("static_expand18_plus_value", "static_expand18_p", pInfo->GetAttribute().nMagicalPenetrationRatio, true); /// 마법 피해 관통 %
}
void SUIDetailCreaturePageWnd::SetValue( char const* strName, int nValue, bool bPercent )
{
std::string strFilter = "%";
if( !bPercent ) strFilter = "";
SetChildCaption(strName, CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right>%d%s ", nValue, strFilter.c_str()).c_str());
}
void SUIDetailCreaturePageWnd::SetItemValue(char const* strName, char const* strSignName, int nValue, bool bPercent)
{
SetItemSignValue(strSignName, nValue);
SetChildShow( strName, (0 == nValue) ? false : true );
if( nValue == 0 ) return;
std::string strPer = "%";
if( !bPercent ) strPer = "";
std::string strCaption;
if( nValue > 0 )
{
strCaption = CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right><#87D1EC>%d%s", nValue, strPer.c_str() );
}
else
{
strCaption = CStringUtil::StringFormat( "<font:font_default><bottom><size:10><right><#D70404>%d%s", nValue*(-1), strPer.c_str() );
}
SetChildCaption( strName, strCaption.c_str());
}
void SUIDetailCreaturePageWnd::SetItemSignValue(char const* strName, int nValue)
{
if( nValue == 0 )
{
SetChildShow( strName, false );
}
else
{
SetChildShow( strName, true );
if( nValue > 0 )
SetChildCaption( strName, "<font:font_default><bottom><size:10><right>+" );
else if( nValue < 0 )
SetChildCaption( strName, "<font:font_default><bottom><size:10><right>-" );
}
}
// 2010.05.10 - prodongi
void SUIDetailCreaturePageWnd::refreshCreatureEnhance()
{
SInventorySlot* slot = m_InventoryMgr.GetItemInfo(m_CreatureSlotMgr.GetSelectedCreatureCard());
int enhance = (slot) ? slot->GetEnhance() : 0;
bool showGage = (slot && 0 != enhance) ? true : false;
// enhance
SetChildCaption("number_00", CStringUtil::StringFormat("%d", enhance).c_str());
// duration gage
SetChildShow("text_01", showGage);
SetChildShow("gauge_frame_00", showGage);
}