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

1133 lines
37 KiB
C++

#include "stdafx.h"
#include "SUITargetWnd_Player.h"
#include "SLog.h"
#include "Util.h"
#include "CommonUtil.h"
#include "SGame.h"
#include "GameDefine.h"
#include "KUIDefine.h"
#include "SJobDB.h"
#include "SStringDB.h"
#include "SGameManager.h"
#include "SPlayerInfoMgr.h"
#include "SGameAvatarEx.h"
#include "SGameInterface.h"
#include "ContentStruct.h"
#include <tchar.h>
namespace nsTargetUI_Player
{
static const string PLAYER_JOB_ICON_CONTROL_NAME( "player_target_job" ); // 플레이어 직업 아이콘 컨트롤 이름
static const string PLAYER_JOB_ICON_DEFAULT_NAME( "common_mark_icon_unknown_mini" ); // 플레이어 직업 아이콘 기본 이름
static const string PLAYER_NAME_CONTROL_NAME( "player_target_name_text_long" ); // 플레이어 이름 컨트롤 이름
static const string PLAYER_JOB_CONTROL_NAME( "player_target_text_job_01" ); // 플레이어 직업 컨트롤 이름
static const string PLAYER_RACE_CONTROL_NAME( "player_target_text_clan_01" ); // 플레이어 종족 컨트롤 이름
static const string PLAYER_LEVEL_CONTROL_NAME( "player_target_lv_number" ); // 플레이어 레벨 컨트롤 이름
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_STRONG( "creature_monster_target_lv_number_01" ); // 레벨 색상 컨트롤 이름 ( 절대적 강함 )
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_STRONG( "creature_monster_target_lv_number_03" ); // 레벨 색상 컨트롤 이름 ( 매우 강함 )
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_STRONG( "creature_monster_target_lv_number_02" ); // 레벨 색상 컨트롤 이름 ( 강함 )
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_WEAK( "creature_monster_target_lv_number_04" ); // 레벨 색상 컨트롤 이름 ( 약함 )
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_WEAK( "creature_monster_target_lv_number_05" ); // 레벨 색상 컨트롤 이름 ( 매우 약함 )
static const string PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_WEAK( "creature_monster_target_lv_number_06" ); // 레벨 색상 컨트롤 이름 ( 절대적 약함 )
static const string HP_GAUGE_RED_SPRITE_NAME( "common_gauge_titanium_monster_middle" ); // HP 게이지 이미지 (레드) 이름
static const string HP_GAUGE_CONTROL_NAME( "player_target_hpbar" ); // HP 게이지 컨트롤 이름
static const string HP_GAUGE_VALUE_CONTROL_NAME( "Player_static_hp_value" ); // HP 게이지 수치 컨트롤 이름
static const string MP_GAUGE_CONTROL_NAME( "player_target_mpbar" ); // MP 게이지 컨트롤 이름
static const string MP_GAUGE_VALUE_CONTROL_NAME( "player_static_mp_value" ); // MP 게이지 수치 컨트롤 이름
static const string SUBMENU_BUTTON_CONTROL_NAME( "player_target_menu_01" ); // 보조 메뉴 컨트롤 버튼 이름
static const WORD GAUGE_ANIMATION_FILLTIME( 1000 ); // 게이지 차는 애니메이션 시간
};
using namespace GAME_DEFINE;
using namespace nsTargetUI_Player;
//-----------------------------------------------------------------------------------------------------------------
// 생성자
//-----------------------------------------------------------------------------------------------------------------
SUITargetWnd_Player::SUITargetWnd_Player( SGameManager * pGameManager, SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager )
, m_pDisplayInfo( pDisplayInfo )
, m_pJobIcon( NULL )
, m_pHpGauge( NULL )
, m_pHpGaugeValue( NULL )
, m_pMpGauge( NULL )
, m_pMpGaugeValue( NULL )
, m_pPlayerName( NULL )
, m_pPlayerJob( NULL )
, m_pPlayerRace( NULL )
, m_pPlayerLevel( NULL )
, m_pSubMenu( NULL )
, m_strPlayerNamePropertyTag( "" )
, m_strPlayerJobPropertyTag( "" )
, m_strPlayerRacePropertyTag( "" )
, m_strHpGaugeValuePropertyTag( "" )
, m_strMpGaugeValuePropertyTag( "" )
, m_strPlayerLevelPropertyTag( "" )
, m_strLevelTextColorValue_AbsoluteStrong( "FFFFFF" )
, m_strLevelTextColorValue_VeryStrong( "FFFFFF" )
, m_strLevelTextColorValue_Strong( "FFFFFF" )
, m_strLevelTextColorValue_Similar( "FFFFFF" )
, m_strLevelTextColorValue_Weak( "FFFFFF" )
, m_strLevelTextColorValue_VeryWeak( "FFFFFF" )
, m_strLevelTextColorValue_AbsoluteWeak( "FFFFFF" )
, m_bIsInFreePassMarkIcon( false )
{
}
//-----------------------------------------------------------------------------------------------------------------
// 파괴자
//-----------------------------------------------------------------------------------------------------------------
SUITargetWnd_Player::~SUITargetWnd_Player()
{
}
//-----------------------------------------------------------------------------------------------------------------
// 윈도우 생성
//-----------------------------------------------------------------------------------------------------------------
SUIWnd* SUITargetWnd_Player::CreateWnd( const char* szFile, KUIWndManager* pWndManager, KPoint kPos, int nWindowID )
{
SUIWnd::CreateWnd( szFile, pWndManager, kPos, nWindowID );
return this;
}
//-----------------------------------------------------------------------------------------------------------------
// 컨트롤 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::InitControls( KPoint kPos )
{
return SUIWnd::InitControls( kPos );
}
//-----------------------------------------------------------------------------------------------------------------
// 데이터 초기화
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::InitData( bool bReload /*= false*/ )
{
m_pHpGauge = dynamicCast<KUIControlGauge*>( GetChild( HP_GAUGE_CONTROL_NAME.c_str() ) );
if( NULL == m_pHpGauge )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 컨트롤 정보 얻기 실패 - Name[%s]", HP_GAUGE_CONTROL_NAME.c_str() );
assert( m_pHpGauge );
}
m_pHpGaugeValue = dynamicCast<KUIControlStatic*>( GetChild( HP_GAUGE_VALUE_CONTROL_NAME.c_str() ) );
if( NULL == m_pHpGaugeValue )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 컨트롤 정보 얻기 실패 - Name[%s]", HP_GAUGE_VALUE_CONTROL_NAME.c_str() );
assert( m_pHpGaugeValue );
}
else
{
string strCaption( m_pHpGaugeValue->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strHpGaugeValuePropertyTag );
m_pHpGaugeValue->SetShow( true );
}
m_pMpGauge = dynamicCast<KUIControlGauge*>( GetChild( MP_GAUGE_CONTROL_NAME.c_str() ) );
if( NULL == m_pMpGauge )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 컨트롤 정보 얻기 실패 - Name[%s]", MP_GAUGE_CONTROL_NAME.c_str() );
assert( m_pMpGauge );
}
m_pMpGaugeValue = dynamicCast<KUIControlStatic*>( GetChild( MP_GAUGE_VALUE_CONTROL_NAME.c_str() ) );
if( NULL == m_pMpGaugeValue )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 컨트롤 정보 얻기 실패 - Name[%s]", MP_GAUGE_VALUE_CONTROL_NAME.c_str() );
assert( m_pMpGaugeValue );
}
else
{
string strCaption( m_pMpGaugeValue->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strMpGaugeValuePropertyTag );
m_pMpGaugeValue->SetShow( true );
}
m_pPlayerName = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_NAME_CONTROL_NAME.c_str() ) );
if( NULL == m_pPlayerName )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_NAME_CONTROL_NAME.c_str() );
assert( m_pPlayerName );
}
else
{
string strCaption( m_pPlayerName->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strPlayerNamePropertyTag );
}
m_pPlayerJob = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_JOB_CONTROL_NAME.c_str() ) );
if( NULL == m_pPlayerJob )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_JOB_CONTROL_NAME.c_str() );
assert( m_pPlayerJob );
}
else
{
string strCaption( m_pPlayerJob->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strPlayerJobPropertyTag );
}
m_pPlayerRace = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_RACE_CONTROL_NAME.c_str() ) );
if( NULL == m_pPlayerRace )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_RACE_CONTROL_NAME.c_str() );
assert( m_pPlayerRace );
}
else
{
string strCaption( m_pPlayerRace->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strPlayerRacePropertyTag );
}
m_pPlayerLevel = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_CONTROL_NAME.c_str() ) );
if( NULL == m_pPlayerLevel )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_CONTROL_NAME.c_str() );
assert( m_pPlayerLevel );
}
else
{
string strCaption( m_pPlayerLevel->GetCaption() );
GetTextDecoration( strCaption.c_str(), m_strPlayerLevelPropertyTag );
GetTextColorValue( strCaption, m_strLevelTextColorValue_Similar );
}
KUIControlStatic* pLevelTextColor_AbsoluteStorng = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_STRONG.c_str() ) );
if( NULL == pLevelTextColor_AbsoluteStorng )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_STRONG.c_str() );
assert( pLevelTextColor_AbsoluteStorng );
}
else
{
string strCaption( pLevelTextColor_AbsoluteStorng->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_AbsoluteStrong );
}
KUIControlStatic* pLevelTextColor_VeryStorng = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_STRONG.c_str() ) );
if( NULL == pLevelTextColor_VeryStorng )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_STRONG.c_str() );
assert( pLevelTextColor_VeryStorng );
}
else
{
string strCaption( pLevelTextColor_VeryStorng->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_VeryStrong );
}
KUIControlStatic* pLevelTextColor_Storng = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_STRONG.c_str() ) );
if( NULL == pLevelTextColor_Storng )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_STRONG.c_str() );
assert( pLevelTextColor_Storng );
}
else
{
string strCaption( pLevelTextColor_Storng->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_Strong );
}
KUIControlStatic* pLevelTextColor_Weak = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_WEAK.c_str() ) );
if( NULL == pLevelTextColor_Weak )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_WEAK.c_str() );
assert( pLevelTextColor_Weak );
}
else
{
string strCaption( pLevelTextColor_Weak->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_Weak );
}
KUIControlStatic* pLevelTextColor_VeryWeak = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_WEAK.c_str() ) );
if( NULL == pLevelTextColor_VeryWeak )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_VERY_WEAK.c_str() );
assert( pLevelTextColor_VeryWeak );
}
else
{
string strCaption( pLevelTextColor_VeryWeak->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_VeryWeak );
}
KUIControlStatic* pLevelTextColor_AbsoluteWeak = dynamicCast<KUIControlStatic*>( GetChild( PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_WEAK.c_str() ) );
if( NULL == pLevelTextColor_AbsoluteWeak )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_LEVEL_COLOR_CONTROL_NAME_ABSOLUTE_WEAK.c_str() );
assert( pLevelTextColor_AbsoluteWeak );
}
else
{
string strCaption( pLevelTextColor_AbsoluteWeak->GetCaption() );
GetTextColorValue( strCaption, m_strLevelTextColorValue_AbsoluteWeak );
}
m_pJobIcon = dynamicCast<KUIControlIconStatic*>( GetChild( PLAYER_JOB_ICON_CONTROL_NAME.c_str() ) );
if( NULL == m_pJobIcon )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", PLAYER_JOB_ICON_CONTROL_NAME.c_str() );
assert( m_pJobIcon );
}
m_pSubMenu = dynamicCast<KUIControlSimpleButton*>( GetChild( SUBMENU_BUTTON_CONTROL_NAME.c_str() ) );
if( NULL == m_pSubMenu )
{
SDEBUGLOG( "[타겟윈도우(NPC)] 컨트롤 정보 얻기 실패 - Name[%s]", SUBMENU_BUTTON_CONTROL_NAME.c_str() );
assert( m_pSubMenu );
}
else
m_pSubMenu->SetTooltip( S( 2351 /*메뉴*/ ) );
m_stMarkState.hideAll();
return SUIWnd::InitData(bReload);
}
//-----------------------------------------------------------------------------------------------------------------
// 메시지 처리
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::PumpUpMessage( LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam )
{
if( NULL == lpszControlID )
return;
if( NULL == m_pGameManager )
return;
string strControlID( lpszControlID );
switch( nMessage )
{
case KBUTTON_CLICK:
case KBUTTON_PRESSING:
{
if( NULL == strControlID.compare( "player_target_off_01" ) ) // 닫기 버튼 클릭
{
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGET_PLAYER, false ) );
m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGET_STATE, false ) );
// 타겟 해제, 게임 내에 NULL 타겟을 보낸다
SIMSG_UI_ACT_TARGET msg;
msg.m_nTargetHandle = NULL;
m_pGameManager->ProcMsgAtStatic(&msg);
}
}
break;
default:
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::ProcMsgAtStatic( SGameMessage* pMsg )
{
if( NULL == pMsg )
return;
switch( pMsg->nType )
{
case MSG_CHANGE_NAME:
{
SMSG_CHANGE_NAME* pChangeNameMsg( static_cast<SMSG_CHANGE_NAME*>( pMsg ) );
ProcessMessage_ChangeName( pChangeNameMsg );
}
break;
case MSG_PROPERTY:
{
SMSG_PROPERTY* pProperty( static_cast<SMSG_PROPERTY*>( pMsg ) );
if( pProperty )
{
if( SMSG_PROPERTY::PROPERTY_JOB == pProperty->nPropertyType )
ProcessMessage_Property_Job( pProperty );
if( SMSG_PROPERTY::PROPERTY_LEVEL == pProperty->nPropertyType )
ProcessMessage_Property_Level( pProperty );
}
}
break;
case IMSG_UI_TARGET_INFO:
{
SIMSG_UI_TARGET_INFO_PLAYER* pTargetMsg( static_cast<SIMSG_UI_TARGET_INFO_PLAYER*>( pMsg ) );
ProcessMessage_UITargetInfo( pTargetMsg );
}
break;
case IMSG_UI_TARGET_STAT:
{
SIMSG_UI_TARGET_STAT* pStatMsg = static_cast<SIMSG_UI_TARGET_STAT*>( pMsg );
ProcessMessage_UITargetStat( pStatMsg );
}
break;
case IMSG_UI_STATE_LIST_UPDATE:
{
SIMSG_UI_STATE_LIST_UPDATE* pStateMsg( static_cast<SIMSG_UI_STATE_LIST_UPDATE*>( pMsg ) );
if ( SIMSG_UI_STATE_LIST_UPDATE::STATE_UPDATE_MARK == pStateMsg->nUpdateType )
UpdateMarkStateList( pStateMsg->hPlayer );
}
break;
case IMSG_MARK_STATUS_CHANGE:
{
SMSG_MARK_STATUS_CHANGE* status( static_cast<SMSG_MARK_STATUS_CHANGE*>( pMsg ) );
UpdateMarkStatusList( status->m_handle, status->m_status );
}
break;
}
pMsg->bUse = true;
}
//-----------------------------------------------------------------------------------------------------------------
// 마우스 메시지 처리
//-----------------------------------------------------------------------------------------------------------------
DWORD SUITargetWnd_Player::OnMouseMessage(DWORD dwMessage, int x, int y)
{
if( m_pSubMenu && m_pSubMenu->GetRect().IsInRect( x, y ) )
return SUIWnd::OnMouseMessage(dwMessage, x, y);
m_bIsInFreePassMarkIcon = m_stMarkState.IsInRectFreePass( this, KPoint( x, y ) );
return KUIGenWnd::OnMouseMessage( dwMessage, x, y );;
}
//-----------------------------------------------------------------------------------------------------------------
// Idle 처리
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::Process( DWORD dwTime )
{
if( m_bIsInFreePassMarkIcon )
m_stMarkState.UpdateFreePassEndTimeTooltip( this, m_pDisplayInfo );
SUIWnd::Process( dwTime );
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - 이름 변경
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_ChangeName( SMSG_CHANGE_NAME* const pChangeNameMsg )
{
if( false == IsShow() )
return false;
if( NULL == pChangeNameMsg )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 포인터가 유효하지 않습니다." );
assert( pChangeNameMsg );
return false;
}
if( NULL == pChangeNameMsg->handle )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 핸들 정보가 유효하지 않습니다." );
assert( pChangeNameMsg->handle );
return false;
}
if( pChangeNameMsg->handle != m_PlayerInfoMgr.GetTarget() )
return false;
if( m_pPlayerName )
{
string strPlayerName( m_strPlayerNamePropertyTag );
string strTempName( m_PlayerInfoMgr.GetTargetName() );
if( NULL == strTempName.length() )
strPlayerName.append( "Unknown Name" );
else
strPlayerName.append( strTempName );
m_pPlayerName->SetCaption( strPlayerName.c_str() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - 직업 변경
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_Property_Job( SMSG_PROPERTY* const pPropertyJobMsg )
{
if( false == IsShow() )
return false;
if( NULL == pPropertyJobMsg )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 포인터가 유효하지 않습니다." );
assert( pPropertyJobMsg );
return false;
}
if( NULL == pPropertyJobMsg->handle )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 핸들 정보가 유효하지 않습니다." );
assert( pPropertyJobMsg->handle );
return false;
}
if( pPropertyJobMsg->handle != m_PlayerInfoMgr.GetTarget() )
return false;
SGame* pGame( m_pGameManager->GetActiveGame() );
if( NULL == pGame )
return false;
SGameAvatarEx* pTargetPlayer( dynamicCast<SGameAvatarEx*>( pGame->GetGameObject( pPropertyJobMsg->handle ) ) );
if( NULL == pTargetPlayer )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 타겟 플레이어 포인터가 유효하지 않습니다." );
assert( pTargetPlayer );
return false;
}
int nJobID( atoi( pPropertyJobMsg->strValue.c_str() ) );
if( m_pPlayerJob && m_pJobIcon )
{
string strPlayerJob( m_strPlayerJobPropertyTag );
string strPlayerToolTip( "" );
if( nJobID > 0 )
{
string strJobDBName( GetJobDB().GetJobName( nJobID ) );
if( NULL == strJobDBName.length() )
{
strPlayerJob.append( "Unknown Job" );
strPlayerToolTip.append( "[Unknown Job]" );
}
else
{
strPlayerJob.append( strJobDBName );
strPlayerToolTip.append( pTargetPlayer->GetName() );
strPlayerToolTip.append( "[" );
strPlayerToolTip.append( strJobDBName );
strPlayerToolTip.append( "]" );
}
m_pJobIcon->SetIcon( c_szDEF_SPR_NAME, GetJobDB().GetJobIconName( nJobID ) );
m_pJobIcon->SetTooltip( strPlayerToolTip.c_str() );
}
else
{
strPlayerJob.append( "Unknown Job" );
strPlayerToolTip.append( "[Unknown Job]" );
m_pJobIcon->SetIcon( c_szDEF_SPR_NAME, PLAYER_JOB_ICON_DEFAULT_NAME.c_str() );
}
m_pPlayerJob->SetCaption( strPlayerJob.c_str() );
}
if( m_pPlayerRace )
{
string strPlayerRace( m_strPlayerRacePropertyTag );
CLAN eClan( (CLAN)pTargetPlayer->GetRace() );
switch( eClan )
{
case CLAN::GCLAN_GAIA:
strPlayerRace.append( S( 1 ) );
break;
case CLAN::GCLAN_DEVA:
strPlayerRace.append( S( 2 ) );
break;
case CLAN::GCLAN_ASURA:
strPlayerRace.append( S( 3 ) );
break;
default:
strPlayerRace.append( "Unknown Race" );
break;
};
strPlayerRace.append( " : " );
BYTE byJobClass( static_cast<BYTE>( GetJobDB().GetJobClass( nJobID ) ) );
switch( byJobClass )
{
case JobInfo::FIGHTER:
strPlayerRace.append( S( 690000043 ) );
break;
case JobInfo::HUNTER:
strPlayerRace.append( S( 690000044 ) );
break;
case JobInfo::MAGICIAN:
strPlayerRace.append( S( 690000045 ) );
break;
case JobInfo::SUMMONER:
strPlayerRace.append( S( 690000046 ) );
break;
default:
strPlayerRace.append( "Unknown Job Class" );
break;
};
m_pPlayerRace->SetCaption( strPlayerRace.c_str() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - 레벨 변경
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_Property_Level( SMSG_PROPERTY* const pPropertyLevelMsg )
{
if( false == IsShow() )
return false;
if( NULL == pPropertyLevelMsg )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 포인터가 유효하지 않습니다." );
assert( pPropertyLevelMsg );
return false;
}
if( NULL == pPropertyLevelMsg->handle )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 핸들 정보가 유효하지 않습니다." );
assert( pPropertyLevelMsg->handle );
return false;
}
if( pPropertyLevelMsg->handle != m_PlayerInfoMgr.GetTarget() )
return false;
if( m_pPlayerLevel )
{
int nTargetLevel( NULL );
string strPlayerLevel( m_strPlayerLevelPropertyTag );
if( NULL != pPropertyLevelMsg->strValue.length() )
nTargetLevel = _ttoi( pPropertyLevelMsg->strValue.c_str() );
ReplaceTextColorValue( strPlayerLevel, GetLevelTextColorValue( nTargetLevel ) );
if( NULL != pPropertyLevelMsg->strValue.length() )
strPlayerLevel.append( pPropertyLevelMsg->strValue );
else
strPlayerLevel.append( "0" );
m_pPlayerLevel->SetCaption( strPlayerLevel.c_str() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 스텟 ( HP, MP 게이지 )
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetStat_Gauge( SIMSG_UI_TARGET_STAT* const pStatMsg )
{
if( NULL == m_pDisplayInfo )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 디스플레이 정보 포인터가 유효하지 않습니다." );
assert( m_pDisplayInfo );
return false;
}
BYTE byType( NULL );
bool bFriend( m_pDisplayInfo->IsFriend( pStatMsg->handle, byType ) ? true : false );
int nMaxHP( max( pStatMsg->m_nVar1, pStatMsg->m_nVar3 ) );
int nCurrentHP( max( pStatMsg->m_nVar1, 0LL ) );
int nMaxMP( max( pStatMsg->m_nVar2, pStatMsg->m_nVar4 ) );
int nCurrentMP( max( pStatMsg->m_nVar2, 0LL ) );
if( m_pHpGaugeValue )
{
string strHpGaugeValue( m_strHpGaugeValuePropertyTag );
int nExp = 100, nRest = 0;
m_pDisplayInfo->GetPercentValue( nCurrentHP, nMaxHP, &nExp, &nRest );
strHpGaugeValue.append( StringFormat( "%d.%d", nExp, nRest ) );
strHpGaugeValue += "%";
#ifdef _DEV // HP TEXT 출력 부분 ( 개발 버젼에서만 보임 )
strHpGaugeValue.append( StringFormat( "[DEV]%u/%u", nCurrentHP, nMaxHP ) );
#endif
m_pHpGaugeValue->SetCaption( strHpGaugeValue.c_str() );
}
if( m_pHpGauge )
RefreshGauge( m_pHpGauge, nCurrentHP, nMaxHP, true, bFriend );
if( m_pMpGaugeValue )
{
string strMpGaugeValue( m_strMpGaugeValuePropertyTag );
int nExp = 100, nRest = 0;
m_pDisplayInfo->GetPercentValue( nCurrentMP, nMaxMP, &nExp, &nRest );
strMpGaugeValue.append( StringFormat( "%d.%d", nExp, nRest ) );
strMpGaugeValue += "%";
#ifdef _DEV // HP TEXT 출력 부분 ( 개발 버젼에서만 보임 )
strMpGaugeValue.append( StringFormat( "[DEV]%u/%u", nCurrentMP, nMaxMP ) );
#endif
m_pMpGaugeValue->SetCaption( strMpGaugeValue.c_str() );
}
if( m_pMpGauge )
RefreshGauge( m_pMpGauge, nCurrentMP, nMaxMP, true, bFriend );
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 스텟
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetStat( SIMSG_UI_TARGET_STAT* const pStatMsg )
{
if( false == IsShow() )
return false;
if( NULL == pStatMsg )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 포인터가 유효하지 않습니다." );
assert( pStatMsg );
return false;
}
if( NULL == pStatMsg->handle )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 핸들 정보가 유효하지 않습니다." );
assert( pStatMsg->handle );
return false;
}
if( pStatMsg->handle != m_PlayerInfoMgr.GetTarget() )
return false;
ProcessMessage_UITargetStat_Gauge( pStatMsg );
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 정보 ( HP, MP 게이지 )
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetInfo_Gauge( SIMSG_UI_TARGET_INFO_PLAYER* const pTargetMsg )
{
if( NULL == m_pDisplayInfo )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 디스플레이 정보 포인터가 유효하지 않습니다." );
assert( m_pDisplayInfo );
return false;
}
BYTE byType( NULL );
bool bFriend( m_pDisplayInfo->IsFriend( pTargetMsg->handle, byType ) ? true : false );
int nMaxHP( max( pTargetMsg->nHP, pTargetMsg->nMaxHP ) );
int nCurrentHP( max( pTargetMsg->nHP, 0 ) );
int nMaxMP( max( pTargetMsg->nMP, pTargetMsg->nMaxMP ) );
int nCurrentMP( max( pTargetMsg->nMP, 0 ) );
if( m_pHpGaugeValue )
{
string strHpGaugeValue( m_strHpGaugeValuePropertyTag );
int nExp = 100, nRest = 0;
m_pDisplayInfo->GetPercentValue( nCurrentHP, nMaxHP, &nExp, &nRest );
strHpGaugeValue.append( StringFormat( "%d.%d", nExp, nRest ) );
strHpGaugeValue += "%";
#ifdef _DEV // HP TEXT 출력 부분 ( 개발 버젼에서만 보임 )
strHpGaugeValue.append( StringFormat( "[DEV]%u/%u", nCurrentHP, nMaxHP ) );
#endif
m_pHpGaugeValue->SetCaption( strHpGaugeValue.c_str() );
}
if( m_pHpGauge )
RefreshGauge( m_pHpGauge, nCurrentHP, nMaxHP, false, bFriend );
if( m_pMpGaugeValue )
{
string strMpGaugeValue( m_strMpGaugeValuePropertyTag );
int nExp = 100, nRest = 0;
m_pDisplayInfo->GetPercentValue( nCurrentMP, nMaxMP, &nExp, &nRest );
strMpGaugeValue.append( StringFormat( "%d.%d", nExp, nRest ) );
strMpGaugeValue += "%";
#ifdef _DEV // HP TEXT 출력 부분 ( 개발 버젼에서만 보임 )
strMpGaugeValue.append( StringFormat( "[DEV]%u/%u", nCurrentMP, nMaxMP ) );
#endif
m_pMpGaugeValue->SetCaption( strMpGaugeValue.c_str() );
}
if( m_pMpGauge )
RefreshGauge( m_pMpGauge, nCurrentMP, nMaxMP, false, bFriend );
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 정보 ( 직업 정보 )
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetInfo_JobInfo( SIMSG_UI_TARGET_INFO_PLAYER* const pTargetMsg )
{
if( m_pPlayerJob && m_pJobIcon )
{
string strPlayerJob( m_strPlayerJobPropertyTag );
string strPlayerToolTip( "" );
int nJobID( pTargetMsg->nJobID );
if( nJobID > 0 )
{
string strJobDBName( GetJobDB().GetJobName( nJobID ) );
if( NULL == strJobDBName.length() )
{
strPlayerJob.append( "Unknown Job" );
strPlayerToolTip.append( "[Unknown Job]" );
}
else
{
strPlayerJob.append( strJobDBName );
strPlayerToolTip.append( pTargetMsg->strName );
strPlayerToolTip.append( "[" );
strPlayerToolTip.append( strJobDBName );
strPlayerToolTip.append( "]" );
}
m_pJobIcon->SetIcon( c_szDEF_SPR_NAME, GetJobDB().GetJobIconName( nJobID ) );
m_pJobIcon->SetTooltip( strPlayerToolTip.c_str() );
}
else
{
strPlayerJob.append( "Unknown Job" );
strPlayerToolTip.append( "[Unknown Job]" );
m_pJobIcon->SetIcon( c_szDEF_SPR_NAME, PLAYER_JOB_ICON_DEFAULT_NAME.c_str() );
}
m_pPlayerJob->SetCaption( strPlayerJob.c_str() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 정보 ( 종족 정보 )
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetInfo_Race( SIMSG_UI_TARGET_INFO_PLAYER* const pTargetMsg )
{
if( m_pPlayerRace )
{
string strPlayerRace( m_strPlayerRacePropertyTag );
CLAN eClan( pTargetMsg->eClan );
switch( eClan )
{
case CLAN::GCLAN_GAIA:
strPlayerRace.append( S( 1 ) );
break;
case CLAN::GCLAN_DEVA:
strPlayerRace.append( S( 2 ) );
break;
case CLAN::GCLAN_ASURA:
strPlayerRace.append( S( 3 ) );
break;
default:
strPlayerRace.append( "Unknown Race" );
break;
};
strPlayerRace.append( " : " );
BYTE byJobClass( static_cast<BYTE>( GetJobDB().GetJobClass( pTargetMsg->nJobID ) ) );
switch( byJobClass )
{
case JobInfo::FIGHTER:
strPlayerRace.append( S( 690000043 ) );
break;
case JobInfo::HUNTER:
strPlayerRace.append( S( 690000044 ) );
break;
case JobInfo::MAGICIAN:
strPlayerRace.append( S( 690000045 ) );
break;
case JobInfo::SUMMONER:
strPlayerRace.append( S( 690000046 ) );
break;
default:
strPlayerRace.append( "Unknown Job Class" );
break;
};
m_pPlayerRace->SetCaption( strPlayerRace.c_str() );
}
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - UI 타겟 정보
//-----------------------------------------------------------------------------------------------------------------
bool SUITargetWnd_Player::ProcessMessage_UITargetInfo( SIMSG_UI_TARGET_INFO_PLAYER* const pTargetMsg )
{
if( NULL == pTargetMsg )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 포인터가 유효하지 않습니다." );
assert( pTargetMsg );
return false;
}
if( NULL == pTargetMsg->handle )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] Msg 핸들 정보가 유효하지 않습니다." );
assert( pTargetMsg->handle );
return false;
}
if( m_pPlayerName )
{
string strPlayerName( m_strPlayerNamePropertyTag );
string strTempName( pTargetMsg->strName );
if( NULL == strTempName.length() )
strPlayerName.append( "Unknown Name" );
else
strPlayerName.append( strTempName );
m_pPlayerName->SetCaption( strPlayerName.c_str() );
}
if( m_pPlayerLevel )
{
int nTargetLevel( pTargetMsg->nLevel );
string strPlayerLevel( m_strPlayerLevelPropertyTag );
string strTempName( StringFormat( "%u", nTargetLevel ) );
ReplaceTextColorValue( strPlayerLevel, GetLevelTextColorValue( nTargetLevel ) );
if( NULL == pTargetMsg->nLevel )
strPlayerLevel.append( "0" );
else
strPlayerLevel.append( strTempName );
m_pPlayerLevel->SetCaption( strPlayerLevel.c_str() );
}
ProcessMessage_UITargetInfo_Race( pTargetMsg );
ProcessMessage_UITargetInfo_JobInfo( pTargetMsg );
ProcessMessage_UITargetInfo_Gauge( pTargetMsg );
UpdateMarkStateList( pTargetMsg->handle );
UpdateMarkStatusList( pTargetMsg->handle );
return true;
}
//-----------------------------------------------------------------------------------------------------------------
// 정적 메시지 처리 - 게이지 갱신
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::RefreshGauge( KUIControlGauge* pGaugeControl, const int nCurrent, const int nMax, const bool bAnimation, const bool bFriend )
{
if( NULL == pGaugeControl )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게이지 컨트롤 포인터가 유효하지 않습니다." );
assert( pGaugeControl );
return;
}
WORD wGaugeFillTime( NULL );
if( bAnimation )
wGaugeFillTime = GAUGE_ANIMATION_FILLTIME;
BYTE byPercent( NULL );
if( nMax > 0 )
byPercent = ( static_cast<float>( nCurrent ) / static_cast<float>( nMax ) ) * 100;
pGaugeControl->SetMax( static_cast<DWORD>(nMax) );
if( HP_GAUGE_CONTROL_NAME.compare( pGaugeControl->GetID() ) == NULL )
{
if( bFriend )
setHPGaugeTexture( byPercent, pGaugeControl, 11 );
else
pGaugeControl->SetBack( c_szDEF_SPR_NAME, HP_GAUGE_RED_SPRITE_NAME.c_str() );
}
pGaugeControl->SetGauge( static_cast<DWORD>(nCurrent), wGaugeFillTime );
}
//-----------------------------------------------------------------------------------------------------------------
// 상태 마크 - State List 마크 갱신
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::UpdateMarkStateList( AR_HANDLE hTarget )
{
if( NULL == m_pGameManager )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게임 메니져 포인터가 유효하지 않습니다." );
assert( m_pGameManager );
return ;
}
if( hTarget != m_PlayerInfoMgr.GetTarget() )
return ;
SGame* pGame( m_pGameManager->GetActiveGame() );
if( NULL == pGame )
return ;
SGameAvatarEx* pTargetPlayer( dynamicCast<SGameAvatarEx*>( pGame->GetGameObject( hTarget ) ) );
if( NULL == pTargetPlayer )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 타겟 플레이어 포인터가 유효하지 않습니다." );
assert( pTargetPlayer );
return ;
}
m_stMarkState.updateMarkStateList( this, m_pDisplayInfo, pTargetPlayer );
}
//-----------------------------------------------------------------------------------------------------------------
// 상태 마크 - Status List 마크 갱신
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::UpdateMarkStatusList( const AR_HANDLE hTarget )
{
if( NULL == m_pGameManager )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게임 메니져 포인터가 유효하지 않습니다." );
assert( m_pGameManager );
return ;
}
SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() );
if( NULL == pGameInterface )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게임 인터페이스 포인터가 유효하지 않습니다." );
assert( pGameInterface );
return ;
}
if( hTarget != m_PlayerInfoMgr.GetTarget() )
return ;
int nMarkStatus( NULL );
if( hTarget )
{
nMarkStatus = pGameInterface->getCharacterWndMarkStatus( hTarget );
m_stMarkState.updateMarkStatusList( this, m_pDisplayInfo, nMarkStatus );
}
}
//-----------------------------------------------------------------------------------------------------------------
// 상태 마크 - Status List 마크 갱신
//-----------------------------------------------------------------------------------------------------------------
void SUITargetWnd_Player::UpdateMarkStatusList( const AR_HANDLE hTarget, const int nStatus )
{
if( NULL == m_pGameManager )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게임 메니져 포인터가 유효하지 않습니다." );
assert( m_pGameManager );
return ;
}
SGameInterface* pGameInterface( m_pGameManager->GetGameInterface() );
if( NULL == pGameInterface )
{
SDEBUGLOG( "[타겟윈도우(PLAYER)] 게임 인터페이스 포인터가 유효하지 않습니다." );
assert( pGameInterface );
return ;
}
if( hTarget != m_PlayerInfoMgr.GetTarget() )
return ;
m_stMarkState.updateMarkStatusList( this, m_pDisplayInfo, nStatus );
}
//-----------------------------------------------------------------------------------------------------------------
// 레벨 문자열 색상 값 얻기
//-----------------------------------------------------------------------------------------------------------------
string SUITargetWnd_Player::GetLevelTextColorValue( const int nTargetLevel )
{
int nDiffLevel( m_PlayerInfoMgr.GetPlayerInfo().GetLevel() - nTargetLevel );
if( nDiffLevel <= -9 )
return m_strLevelTextColorValue_AbsoluteStrong;
if( nDiffLevel <= -6 && nDiffLevel >= -8 )
return m_strLevelTextColorValue_VeryStrong;
if( nDiffLevel <= -3 && nDiffLevel >= -5 )
return m_strLevelTextColorValue_Strong;
if( nDiffLevel <= 2 && nDiffLevel >= -2 )
return m_strLevelTextColorValue_Similar;
if( nDiffLevel <= 5 && nDiffLevel >= 3 )
return m_strLevelTextColorValue_Weak;
if( nDiffLevel <= 8 && nDiffLevel >= 6 )
return m_strLevelTextColorValue_VeryWeak;
if( nDiffLevel >= 9 )
return m_strLevelTextColorValue_AbsoluteWeak;
// 에러 상황이다. 이 경우 기본 값으로 색상을 리턴
return m_strLevelTextColorValue_Similar;
}