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

2410 lines
67 KiB
C++

#include "stdafx.h"
#include <toolkit/XStringUtil.h>
#include "KUIWndManager.h"
#include "./Controls/KUIControlStatic.h"
#include "./Controls/KUIControlGauge.h"
#include "./Controls/KUIControlDamage.h"
#include "./Controls/KUIControlButton.h"
#include "./Controls/KUIControlSkillCastGauge.h"
#include "./Controls/KUIControlEffectText.h"
#include "SUICharacterWnd.h"
#include "SUIDisplayInfo.h"
#include "SGameManager.h"
#include "SGameMessage.h"
#include "SPlayerInfoMgr.h"
#include "SItemDB.h"
#include "SStringDB.h"
#include <toolkit/nsluni.h>
//#include "SGameMessageUI.h" //-N4- PumpUpMessageHP에서 게이지 클릭해도 타겟되게 하는 부분 메세지 보내기 위해 추가
//-N4- Booth가 판매인지 구매인지 알아보기 위해서 추가된 부분
#include "SGameAvatarEx.h"
#include "SNetMessage.h"
#include "SGame.h"
#include "SDebug_Util.h"
#include "SGameOption.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "SGameSystem.h"
//#include "SUIUtil.h" /// 2010.11.24 - prodongi
#include "SQuestMgr.h" /// 2011.08.05 - prodongi
#include "SGameWorld.h"
#include "SGameMob.h"
#include "SGameNpc.h"
#include "SFieldPropResourceDB.h"
#include "SGameFieldQuestProp.h"
#include "KResourceManager.h"
#include "STitleMgr.h"
//#include <vector>
extern SGameSystem* g_pCurrentGameSystem;
namespace
{
const DWORD c_dwGaugeFillTime = 1000;
const int CHAT_MAX_WIDTH = 200;
const int CHAT_OFFSET_Y = -38 + 65;
const int CHAT_HEIGHT = 18;
const int CHAT_MARGIN_WIDTH = 12; // [ 챗 메시지 ] 에서 쳇 메시지 와 프레임간의 공백
const int BOOTH_OFFSET_Y = -65 + 65;
const int BOOTH_HEIGHT = 40;
const int BOOTH_TYPE_HEIGHT = 30; // sonador 3.9.3 개인상점 [사기/팔기] 비주얼 강화(텍스트 추가)
const int NAME_OFFSET_Y = -18 + 65;
// 2010.07.29 폰트별로 다르게 해줘야 될거 같으나, 처음 설정이 상수로 되어있어서, 추가 height값을 주기로 한다- prodongi
//const int NAME_HEIGHT = 18;
const int NAME_HEIGHT = 20;
const int ICON_WIDTH = 16;
const int GAUGE_OFFSET_X = 40;
const int GAUGE_WIDTH = 104;
const int GAGUE_HEIGHT = 3;
const int SKILL_GAUGE_WIDTH = 195;
const int SKILL_GAUGE_HEIGHT = 9;
const int BOW_GAUGE_WIDTH = 195;
const int BOW_GAUGE_HEIGHT = 9;
const int GAUGE_OFFSET_Y = 4 + 65;
const int DAMAGE_OFFSET_X = 80;
const int DAMAGE_OFFSET_Y = -35 + 65;
const int TITLE_HEIGHT = 20;
const int BOOTH_ADJUST = 2;
const int VS_ICON_WIDTH = 23; // pk, pvp 아이콘 크기
const int VS_ICON_ADJUST_Y = 3; // 위아래 조정
const int CHARWND_POS_Y = 50;//c_nCharWindowPos
const int EMBLEM_OFFSET_X = 40; // original = 40 /Edited = 160
const int EMBLEM_OFFSET_Y = 26; // original = 26 /Edited = 52
// 태그 변경시 해당 태그의 스트링으로 SGameInterface에서도 검색하여 수정해야 한다.
const char* c_szChatTag = "<font:font_01><hcenter><vcenter>"; // 채팅 태그
const char* c_szGuildNameTag = "<font:font_01><#ffffff><size:9><b><hcenter><vcenter>"; // 길드 이름 태그
const char* c_szMonsterNameTag = "<font:font_02><hcenter><vcenter><size:11><#ffcfb5><@5a4435><out>"; // 몬스터 이름 태그
const char* c_szAttaMonNameTag = "<font:font_02><hcenter><vcenter><size:11><#e54c4c><@401717><out>"; // 선공몹 이름 태그
const char* c_szNPCNameTag = "<font:font_02><hcenter><vcenter><size:11><#ff8400><@3f2115><out>"; // NPC 이름 태그
const char* c_szPropItemNameTag = "<font:font_02><out><#ffffff><@313246><size:10><hcenter><vcenter>"; // 필드 획득용 아이템 이름 태그
const char* c_szCreatureNameTag = c_szMonsterNameTag; // 크리쳐 이름 태그
const char* c_szTitleNameTag = "<font:font_02><out><#05c5d1><@1b1717><size:10><hcenter><vcenter>"; // 호칭 이름 태그
//<<다른 유저 캐릭터용 태그>>
const char* c_szCharNameTag = "<font:font_02><hcenter><vcenter><size:11><@313246><out>"; // 캐릭터 이름 태그
const char* c_szCharPKOnNameTag = "<font:font_02><hcenter><vcenter><size:11><#f49595><@970000><out>"; // 캐릭터 PK_ON 태그
const char* c_szCharPKBloodyTag = "<font:font_02><hcenter><vcenter><size:11><#ee4444><@820000><out>"; // 캐릭터 PK_Bloody 태그
const char* c_szCharPKDemonicTag = "<font:font_02><hcenter><vcenter><size:11><#fe0101><@220000><out>"; // 캐릭터 PK_Demonic 태그
// !!!!!!!!!!!!!!!!위아래는 세트고 폰트 사이즈만 다르므로 같이 수정해야한다.!!!!!!!!!!!!!!!!!!
//<<내 캐릭터용 태그>>
const char* c_szCharNameTag_ME = "<font:font_02><hcenter><vcenter><size:13><@313246><out>"; // 캐릭터 이름 태그
const char* c_szCahrPKOnNameTag_ME = "<font:font_02><hcenter><vcenter><size:13><#f49595><@970000><out>"; // 캐릭터 PK_ON 태그
const char* c_szCharPKBloodyTag_ME = "<font:font_02><hcenter><vcenter><size:13><#ee4444><@820000><out>"; // 캐릭터 PK_Bloody 태그
const char* c_szCharPKDemonicTag_ME = "<font:font_02><hcenter><vcenter><size:13><#fe0101><@220000><out>"; // 캐릭터 PK_Demonic 태그
const char* c_szDefaultTooltipAniName = "static_fulldown_outframe";
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//SUIDropItemWnd
SUIDropItemWnd::SUIDropItemWnd( class SGameManager* pGameManager, AR_HANDLE handle, int nItemID, count_t nCnt ) : SUIWnd( pGameManager )
{
m_hItemHandle = handle;
m_nItemID = nItemID;
m_nCnt = nCnt;
m_pControl = NULL;
}
SUIDropItemWnd::~SUIDropItemWnd()
{
}
void SUIDropItemWnd::Create(KUIWND_CREATE_ARG& CREATE_ARG)
{
KUIWnd::Create( CREATE_ARG ) ;
//아이템 이름
if( m_nItemID )
m_sTip = GetStringDB().GetString( GetItemDB().GetTextID(m_nItemID) );
else
{
m_sTip = CStringUtil::StringFormat( "%I64d %s", m_nCnt.getAmount(), GetStringDB().GetString(67) ).c_str(); //RP
}
// Chat control
KUIWND_CREATE_ARG arg;
arg.lpszAniName = c_szDefaultTooltipAniName;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = m_sTip.c_str();
arg.lpszID = "tool_tip";
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;;
arg.dwStyle = 0;
DWORD dwMessageWidth = KTextPhrase::GetOneLineStringSize( m_sTip.c_str() );
KRect rcNewrect = m_rcRegion;
rcNewrect.left = rcNewrect.left + ((m_rcRegion.right-m_rcRegion.left)*0.39f) - (dwMessageWidth/2) - CHAT_MARGIN_WIDTH;
rcNewrect.right = rcNewrect.left + dwMessageWidth + CHAT_MARGIN_WIDTH;
arg.rcRect = rcNewrect;
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;;
m_pControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pControl->SetCaptionAlign( KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER );
////Debug 용
//#ifndef NDEBUG
//arg.lpszAniName = "static_talk_outframe00";
//arg.lpszSprName = m_sSprName.c_str();
//arg.lpszClassName = "static";
//arg.lpszID = "_char_back_ground";
//arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
//arg.dwStyle = 0;
//arg.rcRect = m_rcRegion;
//arg.pParent = this;
//arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
//m_pManager->CreateControl(arg);
//#endif
}
void SUIDropItemWnd::Process(DWORD dwTime)
{
}
void SUIDropItemWnd::Render( KViewportObject *pViewport, bool isFront )
{
KUIGenWnd::Render(pViewport, isFront);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//SUIGaugeWnd
SUIGaugeWnd::SUIGaugeWnd( class SGameManager* pGameManager, class SUIDisplayInfo* pDisplayInfo )
: SUIWnd( pGameManager ), m_pDisplayInfo(pDisplayInfo)
{
m_dwTime = 0;
m_dwActivateTime = 0;
m_dwActivateContinueTime = 0;
m_dwBowActivateTime = 0;
m_dwBowActivateContinueTime = 0;
m_pBowGauge = NULL;
m_pSkillGauge = NULL;
m_pSkillGaugeBack = NULL;
m_bDeactiveBow = false;
m_bBowEnd = false;
}
SUIGaugeWnd::~SUIGaugeWnd()
{
}
void SUIGaugeWnd::Create(KUIWND_CREATE_ARG& CREATE_ARG)
{
KUIWnd::Create( CREATE_ARG) ;
// //Debug 용
//#ifndef NDEBUG
//KUIWND_CREATE_ARG arg;
//arg.lpszAniName = "static_talk_outframe00";
//arg.lpszSprName = m_sSprName.c_str();
//arg.lpszClassName = "static";
//arg.lpszID = "_char_back_ground";
//arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
//arg.dwStyle = 0;
//arg.rcRect = m_rcRegion;
//arg.pParent = this;
//arg.dwFlag = KFLAG_GET_PASS_MESSAGE;
//m_pManager->CreateControl(arg);
//#endif
}
void SUIGaugeWnd::Process(DWORD dwTime)
{
m_dwTime = dwTime;
//Bow Gauge 상태
if(NULL != m_pBowGauge && m_pBowGauge->IsActivate() )
{
m_pBowGauge->Process( m_dwTime );
if( m_bDeactiveBow )
{
if( !( m_dwBowActivateTime + m_dwBowActivateContinueTime < m_dwTime ) )
m_pBowGauge->SetGauge( m_dwBowActivateContinueTime - (m_dwTime - m_dwBowActivateTime), 1 );
else
{
m_pBowGauge->SetGauge( 0, 1 );
if( m_bBowEnd )
{ //휴지기 처리
SetBowActivate( false );
m_bBowEnd = false;
}
}
}
else
{
if( !( m_dwBowActivateTime + m_dwBowActivateContinueTime < m_dwTime ) )
m_pBowGauge->SetGauge( m_dwTime - m_dwBowActivateTime, 1 );
//else
// m_pBowGauge->SetGauge( m_dwBowActivateContinueTime, 1 );
if( m_bBowEnd )
{ //휴지기 처리
SetBowActivate( false );
m_bBowEnd = false;
}
}
}
if( NULL != m_pSkillGauge )
{
m_pSkillGauge->Process( m_dwTime );
}
}
void SUIGaugeWnd::Render( KViewportObject *pViewport, bool isFront/* = false*/ )
{
KUIGenWnd::Render(pViewport, isFront);
}
void SUIGaugeWnd::ActivateBowGauge(DWORD dwContinueTime)
{
if(NULL == m_pBowGauge) return;
m_bDeactiveBow = false;
m_bBowEnd = false;
/// 2011.07.22 - prodongi
m_pBowGauge->SetBack( c_szDEF_SPR_NAME, "common_gauge_titanium_bow_cast" );
m_pBowGauge->SetShow( true );
m_pBowGauge->SetActivate( true );
/// 2011.08.16 SetBack을 하면 m_rcRect가 바뀌기 때문에 다시 설정해 줘야 된다 - prodongi
KRect r = m_pBowGauge->GetRect();
r.bottom = r.top + BOW_GAUGE_HEIGHT;
m_pBowGauge->Resize(r);
m_pBowGauge->SetMax( dwContinueTime );
m_pBowGauge->SetGauge(0, 1);
m_dwBowActivateTime = m_dwTime;
m_dwBowActivateContinueTime = dwContinueTime;
}
void SUIGaugeWnd::DeActivateBowGauge(DWORD dwContinueTime)
{
if(NULL == m_pBowGauge) return;
m_bDeactiveBow = true;
m_bBowEnd = false;
// m_pBowGauge->SetShow( true );
// m_pBowGauge->SetActivate( true );
/// 2011.07.22 - prodongi
m_pBowGauge->SetBack( c_szDEF_SPR_NAME, "common_gauge_titanium_bow_cast_cool" );
m_pBowGauge->SetMax( dwContinueTime );
/// 2011.08.16 SetBack을 하면 m_rcRect가 바뀌기 때문에 다시 설정해 줘야 된다 - prodongi
KRect r = m_pBowGauge->GetRect();
r.bottom = r.top + BOW_GAUGE_HEIGHT;
m_pBowGauge->Resize(r);
m_dwBowActivateTime = m_dwTime;
m_dwBowActivateContinueTime = dwContinueTime;
}
void SUIGaugeWnd::SetBowGaugeBack()
{
if( NULL != m_pBowGauge)
RemoveChild(m_pBowGauge);
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = "common_gauge_titanium_bow_cast";
arg.lpszClassName = "gauge";
arg.lpszID = "_bow_gauge";
arg.pParent = this;
arg.rcRect = m_rcRegion;
//가운데 정렬
int nWidth = 38;
arg.rcRect.left = arg.rcRect.left + nWidth;
arg.rcRect.right = arg.rcRect.left + BOW_GAUGE_WIDTH;
arg.rcRect.top = GAGUE_HEIGHT + GAGUE_HEIGHT;
arg.rcRect.bottom = arg.rcRect.top + BOW_GAUGE_HEIGHT;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS | KFLAG_NO_GET_MESSAGE;
m_pBowGauge = dynamicCast<KUIControlGauge*>( m_pManager->CreateControl( arg ) );
m_pBowGauge->SetShow( false );
m_pBowGauge->SetActivate( false );
SetChildAsTop( "_bow_gauge" );
}
void SUIGaugeWnd::SetSkillGaugeBack(bool bLocalCraeture)
{
if( NULL != m_pSkillGauge )
RemoveChild(m_pSkillGauge );
if( NULL != m_pSkillGaugeBack)
RemoveChild(m_pSkillGaugeBack);
KUIWND_CREATE_ARG arg;
char const* bgAniName;
/// 2011.07.22 - prodongi
if( bLocalCraeture ) //플레이어의 크리처이면 크리처용 캐스팅 개이지 .tag를 쎄팅 -N4-
{
arg.lpszAniName = "common_gauge_titanium_creature_skill_cast";
bgAniName = "common_gauge_titanium_creature_skill_cast_bg";
}
else
{
arg.lpszAniName = "common_gauge_titanium_player_skill_cast";
bgAniName = "common_gauge_titanium_player_skill_cast_bg";
}
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "skill_cast_gauge";
arg.lpszID = "_skill_gauge";
arg.pParent = this;
arg.rcRect = m_rcRegion;
//가운데 정렬
int nWidth = 15;
arg.rcRect.left = arg.rcRect.left + nWidth;
arg.rcRect.right = arg.rcRect.left + SKILL_GAUGE_WIDTH;
arg.rcRect.top += ( 20 + GAGUE_HEIGHT + GAGUE_HEIGHT );
arg.rcRect.bottom = arg.rcRect.top + SKILL_GAUGE_HEIGHT;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS | KFLAG_NO_GET_MESSAGE;
m_pSkillGauge = dynamicCast<KUIControlSkillCastGauge*>( m_pManager->CreateControl( arg ) );
m_pSkillGauge->SetShow( false );
m_pSkillGauge->SetActivate( false);
//Gauge Back
arg.lpszAniName = bgAniName;
arg.lpszClassName = "static";
arg.lpszID = "_skill_back";
arg.pParent = this;
m_pSkillGaugeBack = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl( arg ) );
m_pSkillGaugeBack->SetShow( false );
m_pSkillGaugeBack->SetActivate( false );
SetChildAsTop( "_skill_gauge" );
}
void SUIGaugeWnd::SetActivate( bool bActivate )
{
if( !m_pSkillGauge ) return;
m_pSkillGauge->SetShow( bActivate );
m_pSkillGauge->SetActivate( bActivate );
if( m_pSkillGaugeBack )
{
m_pSkillGaugeBack->SetShow( bActivate );
m_pSkillGaugeBack->SetActivate( bActivate );
}
////진행중에 Fire가 들어왔으면 완료된 진행률을 표시한다
//if( !( m_dwActivateTime + m_dwActivateContinueTime < m_dwTime ) )
// m_pSkillGauge->DelayCast( m_dwActivateContinueTime );
}
void SUIGaugeWnd::ActivateGauge(DWORD dwContinueTime, const char * pSkillName)
{
if( NULL == m_pSkillGauge) return;
m_dwActivateTime = m_dwTime;
m_dwActivateContinueTime = dwContinueTime;
m_pSkillGauge->SetShow( true );
m_pSkillGauge->SetActivate( true );
if( m_pSkillGaugeBack )
{
m_pSkillGaugeBack->SetShow( true );
m_pSkillGaugeBack->SetActivate( true );
}
m_pSkillGauge->Cast( pSkillName, (dwContinueTime) );
}
//캐스팅중 공격이나 마법을 맞았을경우 게이지에 딜레이가 생긴다
void SUIGaugeWnd::DelayGauge(DWORD dwDelayTime )
{
if(NULL != m_pSkillGauge && m_pSkillGauge->IsActivate() )
{
m_dwActivateContinueTime = dwDelayTime;
//진행중이여야 딜레이가 적용된다
if( !( m_dwActivateTime + m_dwActivateContinueTime < m_dwTime ) )
m_pSkillGauge->DelayCast( dwDelayTime );
}
}
void SUIGaugeWnd::ChangeMaxGauge( DWORD dwMaxOffsetTime )
{
if( m_pSkillGauge == NULL ) return;
DWORD dwContinueTime = m_pSkillGauge->GetCastTime() + dwMaxOffsetTime;
m_pSkillGauge->DelayCast( dwContinueTime );
//m_dwActivateTime = m_dwTime;
m_dwActivateContinueTime = dwContinueTime;
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//SUICharacterWnd
SUICharacterWnd::SUICharacterWnd( class SGameManager* pGameManager, AR_HANDLE handle, bool bUseBooth, SUIDisplayInfo* pDisplayInfo, bool bIsMain )
: SUIWnd( pGameManager ), m_hOwner( handle ), m_bUseBooth( bUseBooth ), m_pDisplayInfo(pDisplayInfo), m_bMain( bIsMain )
{
m_dwStartTime = 0;
m_dwTime = 0;
m_dwChatRemoveTime = 5000;
m_dwChatLastRemoveTime = 0;
m_hTargetHandle = NULL;
m_pNameControl = NULL;
m_pNameBackControl = NULL;
m_pBoothTitleControl = NULL;
m_pBoothBackControl = NULL;
m_pChatControl = NULL;
m_pHPGauge = NULL;
// m_pHPGaugeBack = NULL;
m_pDotControl = NULL;
m_pLocalNameControl = NULL;
m_pLocalNameBackControl = NULL;
m_dwLocalNameDisplayTime = 5000;
m_dwLocalNameStartTime = 0;
m_nGuild_id = 0;
m_nDamageCnt01 = 0;
m_nDamageCnt02 = 0;
m_nAlarmCount = 0;
m_dwAlarmTime = 0;
m_sPK_Color = c_szCharPKOnNameTag;
m_dwBeforeRefrshTime = 0;
m_bIcon = false;
m_bIsExistGuild = false;
m_pGuildIconControl = NULL;
m_pGuildNameControl = NULL;
m_questIconControl = NULL; /// 2011.08.05 - prodongi
m_nObjType = 0;
m_bNowMutate = false;
m_pPVPIconControl = NULL;
m_pIconControl = NULL;
m_pEmblemControl = NULL;
/// 2011.01.17 - prodongi
m_markStatus = 0;
m_strTitleName = "";
m_pTitleName = NULL;
m_UpAndDownState = -1;
m_curHP = 1;
m_maxHP = 1;
m_IsEnemyUnit = false;
m_vMoveControl.push_back( stMovingCTL("_guild_name") ); // 길드 이름
m_vMoveControl.push_back( stMovingCTL("_guild_icon_back") ); // 길드 아이콘
m_vMoveControl.push_back( stMovingCTL("_character_chat") ); // 채팅 // 채팅은 채팅 생성시에 조절 되도록 한다.
//m_vMoveControl.push_back("_effect_text_group"); // 이펙트 그룹? // 이건.. 뭔지 잘...
m_vMoveControl.push_back( stMovingCTL("_booth_title", BOOTH_ADJUST) ); // 노점(삽니다/팝니다)
m_vMoveControl.push_back( stMovingCTL("_booth_name_back", BOOTH_ADJUST) ); // 노점 이름
}
SUICharacterWnd::~SUICharacterWnd()
{
m_vMoveControl.clear();
}
void SUICharacterWnd::Create(KUIWND_CREATE_ARG& CREATE_ARG)
{
KUIWnd::Create( CREATE_ARG) ;
// Chat control
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "static_talk_outframe00";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = m_sChatMessage.c_str();
arg.lpszID = "_character_chat";
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
arg.dwStyle = 0;
KRect rcChat = CREATE_ARG.rcRect;
rcChat.left -= CHAT_MAX_WIDTH / 2;
rcChat.top += CHAT_OFFSET_Y + CHARWND_POS_Y;
rcChat.right = rcChat.left + CHAT_MAX_WIDTH;
rcChat.bottom = rcChat.top + CHAT_HEIGHT + CHARWND_POS_Y;
CalcTitleHeight(rcChat);
arg.rcRect = rcChat;
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pChatControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pChatControl->SetShow( false );
m_pChatControl->SetCaptionAlign( KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER );
// 채팅창 표시되는 이모티콘 표시 비활성화. 유럽
m_pChatControl->UseEmoticonFilter(false);
//상태이상 데미지
rcChat = m_rcRegion;
//rcChat.top = rcChat.top + m_rcRegion.GetHeight();
//rcChat.bottom = rcChat.top + 10;
//rcChat.left = rcChat.left + (m_rcRegion.GetWidth() * 0.5f);
//rcChat.right = rcChat.left + 10;
arg.rcRect = rcChat;
arg.pParent = this;
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "effect_text_group";
arg.lpszCaption = "";
arg.lpszID = "_effect_text_group";
m_pDotControl = dynamicCast<KUIControlEffectTextGroup*>( m_pManager->CreateControl(arg) );
// //Debug 용
#ifndef NDEBUG
//arg.lpszAniName = "static_talk_outframe00";
//arg.lpszSprName = m_sSprName.c_str();
//arg.lpszClassName = "static";
//arg.lpszID = "_char_back_ground";
//arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
//arg.dwStyle = 0;
//arg.rcRect = m_rcRegion;
//arg.pParent = this;
//m_pManager->CreateControl(arg);
#endif
}
void SUICharacterWnd::PositionUpper( int nAdd )
{
std::list<KUIWnd*>::iterator it = m_DamageList.begin();
while( it != m_DamageList.end() )
{
KUIWnd* pWnd = (*it);
//위치 수정
const KRect rect = pWnd->GetRect();
int nPosition = rect.top - nAdd;
pWnd->MovePos(rect.left,nPosition);
it++;
}
}
void SUICharacterWnd::ForcedProcess(DWORD dwTime)
{
//데미지 처리
std::list<KUIWnd*>::iterator itDamage = m_DamageList.begin();
while( itDamage != m_DamageList.end() )
{
KUIWnd* pWnd = (*itDamage);
if( pWnd->IsDestroy() == false )
pWnd->Process(dwTime);
++itDamage;
}
}
void SUICharacterWnd::Process(DWORD dwTime)
{
std::list<KUIWnd*>::iterator it = m_listChild.begin();
while( it != m_listChild.end() )
{
KUIWnd* pWnd = (*it);
pWnd->Process(dwTime);
if( pWnd->IsDestroy() )
{
it = m_listChild.erase(it);
}
else
{
it++;
}
}
// Damage handling
std::list<KUIWnd*>::iterator itDamage = m_DamageList.begin();
while( itDamage != m_DamageList.end() )
{
KUIWnd* pWnd = (*itDamage);
if( pWnd->IsDestroy() )
{
#ifdef _KUI_INVALIDATION
this->RemovePopupControl( reinterpret_cast< KUIControl* >( pWnd ) );
#endif
SAFE_DELETE(pWnd);
itDamage = m_DamageList.erase(itDamage);
}
else
{
++itDamage;
}
}
#ifdef _KUI_INVALIDATION
//상태이상 효과 메시지 윈도우
std::list<KUIWnd*>::iterator itState = m_StateEffectTextList.begin();
while( itState != m_StateEffectTextList.end() )
{
KUIWnd* pWnd = (*itState);
if( pWnd->IsDestroy() )
{
this->RemovePopupControl( reinterpret_cast< KUIControl* >( pWnd ) );
SAFE_DELETE(pWnd);
itState = m_StateEffectTextList.erase(itState);
}
else
{
++itState;
}
}
#endif
m_dwTime = dwTime;
if( m_dwStartTime == 0 ) m_dwStartTime = m_dwTime;
// 채팅을 지워주자.
if(m_dwChatLastRemoveTime + m_dwChatRemoveTime < m_dwTime && NULL != m_pChatControl &&
m_pChatControl->IsShow())
{
m_pChatControl->SetShow(false);
}
if( m_pLocalNameControl && m_pLocalNameBackControl
&& m_pLocalNameControl->IsShow()
&& m_pLocalNameBackControl->IsShow() )
{
if(dwTime - m_dwLocalNameStartTime < m_dwLocalNameDisplayTime)
{
float fAlpha = 1.0f - (float)(m_dwTime - m_dwLocalNameStartTime) / m_dwLocalNameDisplayTime;
m_pLocalNameControl->ChangeAlpha(fAlpha);
m_pLocalNameBackControl->ChangeAlpha(fAlpha);
}
else
{
m_pLocalNameControl->SetShow(false);
m_pLocalNameBackControl->SetShow(false);
RemoveChild(m_pLocalNameControl);
RemoveChild(m_pLocalNameBackControl);
m_pLocalNameControl = NULL;
m_pLocalNameBackControl = NULL;
}
}
//Alarm
if( m_nAlarmCount )
{
if( (m_dwTime - m_dwAlarmTime) > 500 )
{
if( (m_nAlarmCount % 2) ? true : false )
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", c_szCharNameTag_ME, m_sName.c_str() ).c_str(), false );
else
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", c_szCahrPKOnNameTag_ME, m_sName.c_str() ).c_str(), false );
--m_nAlarmCount;
m_dwAlarmTime = m_dwTime;
}
}
procQuestIcon(); /// 2011.08.05 - prodongi
if( (m_nAlarmCount <= 0) && (m_bMain==false) ) // 내가 아니고, pk알람이 꺼져있을 때 리프레시
ReFreshCheck(dwTime);
}
/// 2010.11.10 - prodongi
//#ifdef _DEV
//extern bool g_bDebugMode;
//#endif
void SUICharacterWnd::Render( KViewportObject *pViewport, bool isFront )
{
const _OPT_DATA& data = GetGameOption().GetOptData();
unsigned char Type;
int AvatarType = m_pDisplayInfo->IsFriend(m_hOwner, Type);
/// field prop은 다은 함수에서 체크해 준다 - prodongi
if (TS_ENTER::GAME_FIELD_PROP == Type)
{
KUIGenWnd::Render(pViewport, isFront);
return ;
}
bool bShow(false);
if( data.nName )
{
if( Type == TS_ENTER::GAME_PLAYER ) bShow = data.nPlayerName;
if( Type == TS_ENTER::GAME_NPC ) bShow = data.nNPCName;
if( Type == TS_ENTER::GAME_SUMMON ) bShow = data.nCreatureName;
if( Type == TS_ENTER::GAME_MOB ) bShow = data.nMobName;
if( Type == TS_ENTER::GAME_PET ) bShow = data.nCreatureName;
}
else
bShow = false;
if( m_pNameControl )
m_pNameControl->SetShow( bShow );
if( data.nHPGage )
{
if( AvatarType == SUIDisplayInfo::LocalPlayer ) bShow = data.nPlayerGage;
if( AvatarType == SUIDisplayInfo::Party ) bShow = data.nPlayerGage;
if( AvatarType == SUIDisplayInfo::enemy ) bShow = data.nMobGage;
bool bShowMobHPMP = true;
if( Type == TS_ENTER::GAME_MOB )
{
bShow = data.nMobGage;
if( m_pDisplayInfo->ShowMobHPMP( m_hOwner ) == false )
bShowMobHPMP = false;
if( bShowMobHPMP == false )
{
bShow = false;
}
}
if( Type == TS_ENTER::GAME_SUMMON ) bShow = true;
if( Type != TS_ENTER::GAME_PLAYER && g_pCurrentGameSystem->IsTarget(m_hOwner) )
{
if( bShowMobHPMP )
bShow = data.nTargetGage;
}
}
else
bShow = false;
if( m_pHPGauge )
m_pHPGauge->SetShow( bShow );
// SetChildShow("_hp_gauge", bShow);
KUIGenWnd::Render(pViewport, isFront);
}
void SUICharacterWnd::PumpUpMessage( LPCSTR lpszControlID, DWORD dwMessage, DWORD lParam, DWORD wParam )
{
if( KUI_MESSAGE::KBUTTON_CLICK == dwMessage && !_stricmp( lpszControlID, "_booth_name_back" ) )
{
// 노점 열자~
if( m_hTargetHandle != this->m_pDisplayInfo->GetPlayerInfoManager()->GetPlayerHandle() )
{
if( !m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SHOP ) &&
!m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TRADE ) &&
!m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORAGE ) &&
!m_pGameManager->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_STORE_HOST ) )
{
SMSG_WATCH_BOOTH msg( m_hTargetHandle, true );
m_pGameManager->ProcMsgAtStatic( &msg );
}
}
}
if( KUI_MESSAGE::KFOCUS_ACTIVATED == dwMessage ) //-N4- HP게이지 클릭해도 타겟되게 하는 부분
{
KUIWnd* pHpWnd = GetChild("_hp_gauge");
if( pHpWnd && pHpWnd->IsShow() && pHpWnd->IsInRect(lParam, wParam) ) //보이지도 않는데 타겟이 되게 할 필요없다.
{
SIMSG_UI_ACT_TARGET* pMsg = new SIMSG_UI_ACT_TARGET;
pMsg->m_nTargetHandle = m_hOwner;
m_pGameManager->PostMsgAtDynamic( pMsg );
}
}
}
DWORD SUICharacterWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
{
return KUIGenWnd::OnMouseMessage(dwMessage, x, y);
// return KMR_NO_GET;;
}
DWORD SUICharacterWnd::OnKeyMessage(DWORD dwMessage, DWORD dwKeyCode)
{
return KUIWnd::OnKeyMessage(dwMessage, dwKeyCode);
}
void SUICharacterWnd::OnPosChangeNofity(int XOffset, int YOffset)
{
KUIWnd::OnPosChangeNofity( XOffset, YOffset);
}
void SUICharacterWnd::SetEmblem(int nID)
{
// AziaMafia Fix Emblem
//m_nBackBoard = nID - ItemBase::CODE_BASE_BACKBOARD;
m_nBackBoard = nID ;
if(m_nBackBoard > 0)
{
if(m_pEmblemControl)
{
if (m_nBackBoard <= 603115 )
m_pEmblemControl->SetIcon("05_ui.spr", GetItemDB().GetAdditionalTexture(m_nBackBoard) );
m_pEmblemControl->SetShow( true );
}
}
else
{
if (m_pEmblemControl)
m_pEmblemControl->SetShow( false );
}
}
void SUICharacterWnd::SetNameAlarm( int nAlarmCount )
{
m_nAlarmCount = nAlarmCount;
m_dwAlarmTime = m_dwTime;
}
void SUICharacterWnd::SetPKNameColor( unsigned status )
{
m_nAlarmCount = 0;
m_dwAlarmTime = 0;
m_status = status;
std::string strPK_Color = "<@000000FF>";
if( m_bNowMutate == false )
{
//새로 프로토콜을 만들어야 될 것 같음
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON )
{
if( m_pIconControl )
ShowPKIcon( true );
}
else
{
if( m_pIconControl )
ShowPKIcon( false );
}
}
//1:1 대련 #kappamind
//2009-02-26:
if( m_status & TS_ENTER::PlayerInfo::FLAG_COMPETING )
{
if( m_pPVPIconControl )
ShowPVPIcon( true );
}
else
{
if( m_pPVPIconControl )
ShowPVPIcon( false );
}
if( m_pPVPIconControl )
m_pPVPIconControl->SetBack( m_sSprName.c_str(), "common_mark_state_pvp_normal" );
if( m_status & TS_ENTER::PlayerInfo::FLAG_BLOODY )
{
if( m_bMain )
strPK_Color = c_szCharPKBloodyTag_ME;
else
strPK_Color = c_szCharPKBloodyTag;
if( m_pIconControl )
m_pIconControl->SetBack( m_sSprName.c_str(), "common_mark_state_pk_demoniac" );
}
else if( m_status & TS_ENTER::PlayerInfo::FLAG_DEMONIAC )
{
if( m_bMain )
strPK_Color = c_szCharPKDemonicTag_ME;
else
strPK_Color = c_szCharPKDemonicTag;
if( m_pIconControl )
m_pIconControl->SetBack( m_sSprName.c_str(), "common_mark_state_pk_demoniac" );
}
else
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON )
{
if( m_bMain )
strPK_Color = c_szCahrPKOnNameTag_ME;
else
strPK_Color = c_szCharPKOnNameTag;
}
else
{
strPK_Color = m_sNameEffect.c_str();
}
if( m_pIconControl )
m_pIconControl->SetBack( m_sSprName.c_str(), "common_mark_state_pk_normal" );
}
// if( stricmp( m_sPK_Color.c_str(), strPK_Color.c_str() ) != 0 ) //그냥 갱신시키자
{
m_sPK_Color = (m_IsEnemyUnit)? c_szAttaMonNameTag : strPK_Color ;
if( m_bNowMutate == false )
{
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_sPK_Color.c_str(), m_sName.c_str() ).c_str(), false );
}
}
// 2012. 6. 5 - marine 타 유저일 경우 pvp이면 이름 태그 변경
if( IsThisLocalPlayer() == false )
{
if(m_pPVPIconControl->IsShow())
{
std::string str = c_szAttaMonNameTag;
str += m_sName;
m_pNameControl->SetCaption(str.c_str());
}
}
/// 2011.01.17 - prodongi
bool isPKStatus, isPVPStatus, isPKNormalStatus;
if( m_bNowMutate == false )
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON ) isPKStatus = true;
else isPKStatus = false;
}
if( m_status & TS_ENTER::PlayerInfo::FLAG_COMPETING ) isPVPStatus = true;
else isPVPStatus = false;
if( m_status & TS_ENTER::PlayerInfo::FLAG_BLOODY ) isPKNormalStatus = false;
else if( m_status & TS_ENTER::PlayerInfo::FLAG_DEMONIAC ) isPKNormalStatus = false;
else isPKNormalStatus = true;
unsigned int markStatus = 0;
if (isPVPStatus) markStatus |= SMSG_MARK_STATUS_CHANGE::PVP;
if (isPKStatus) markStatus |= (isPKNormalStatus) ? SMSG_MARK_STATUS_CHANGE::PK_NORMAL : SMSG_MARK_STATUS_CHANGE::PK_DEMONIAC;
if (markStatus != m_markStatus)
{
if (g_pCurrentGameSystem->IsLocalPlayer(m_hOwner) || g_pCurrentGameSystem->IsTarget(m_hOwner))
{
SMSG_MARK_STATUS_CHANGE msg(m_hOwner, markStatus);
m_pGameManager->ProcMsgAtStatic(&msg);
}
m_markStatus = markStatus;
}
}
void SUICharacterWnd::SetName(LPCSTR lpszName, LPCSTR lpszNameEffect, int objType)
{
m_sName = lpszName;
m_sNameEffect = lpszNameEffect;
if(NULL != m_pNameControl )
RemoveChild( m_pNameControl );
if(NULL != m_pNameBackControl)
RemoveChild( m_pNameBackControl );
if( NULL != m_pIconControl )
RemoveChild( m_pIconControl );
//1:1 대련
if( NULL != m_pPVPIconControl )
RemoveChild( m_pPVPIconControl );
KUIWND_CREATE_ARG arg;
if (TS_ENTER::GAME_FIELD_PROP != objType)
{
// Background
arg = KUIWND_CREATE_ARG();
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszID = "_character_name_back";
arg.rcRect = _GetNameBackRect();
if( m_bMain )
{
arg.rcRect.top += 2; //아래 이동
arg.rcRect.bottom += 2;
}
else
{
arg.rcRect.top += 1; //아래 이동
arg.rcRect.bottom += 1;
}
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pNameBackControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
//m_rcRegion.right == -1 영향 받지 않음
m_pNameBackControl->SetUsePosEnable( false );
}
// 이름 글자
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str();
arg.lpszID = "_character_name";
arg.dwFlag = 0;
arg.dwStyle = 0;
arg.rcRect = _GetNameBackRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE| KFLAG_NO_GET_FOCUS;
m_pNameControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pNameControl->SetCaptionAlign(KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER);
if (TS_ENTER::GAME_FIELD_PROP != objType)
{
//아이콘
arg.lpszAniName = "common_mark_state_pk_normal";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "iconstatic";
arg.lpszCaption = "";
arg.rcRect = _GetIconRect();
arg.lpszID = "_pk_icon";
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE| KFLAG_NO_GET_FOCUS;
m_pIconControl = dynamicCast<KUIControlIconStatic*>( m_pManager->CreateControl(arg) );
m_pIconControl->SetShow( false );
//1:1대련
arg.lpszAniName = "common_mark_state_pvp_normal";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "iconstatic";
arg.lpszCaption = "";
arg.rcRect = _GetPVPIconRect();
arg.lpszID = "_PVP_icon";
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE| KFLAG_NO_GET_FOCUS;
m_pPVPIconControl = dynamicCast<KUIControlIconStatic*>( m_pManager->CreateControl(arg) );
m_pPVPIconControl->SetShow( false );
#ifndef NDEBUG
//길드 아이콘 관련 수정할 부분 <여기서 길드아이콘 add하게 하던가 하믄 안된다>
//서버에서 길드아이콘에 관한 메세지가 왔을때 하게끔 위치 설정
//함수 바로위에 include한거 삭제할 것
// SMSG_CHATTING_REQUEST msg;
// msg.strText = "/guildicon";
// m_pGameManager->GetActiveGame()->ProcMsgAtStatic(&msg);
// std::string hh;
// if( m_pGuildMgr )
// hh = m_GuildMgr.GetGuildName();
// SetGuildInfo( hh.c_str(), "test001_0000000000_060519_030321" );
// SetGuildInfo( "guild_test", "test001_0000000000_060519_030321" );
SetGuildInfo( "guild_test", NULL );
#endif
}
}
void SUICharacterWnd::SetBoothName(AR_HANDLE hTargetHandle, LPCSTR lpszName)
{
if( !m_bUseBooth ) return;
m_hTargetHandle = hTargetHandle;
m_sBoothName = lpszName;
bool bIsSellBooth(false);
SGame* pGame = m_pGameManager->GetActiveGame();
if( pGame )
{
SGameAvatarEx* pPlayer = (SGameAvatarEx*)(pGame->GetGameObject(m_hTargetHandle));
unsigned int PlayerStatus(0);
if( pPlayer ) PlayerStatus = pPlayer->GetStatus();
if( PlayerStatus & TS_ENTER::PlayerInfo::FLAG_SELL_BOOTH )
bIsSellBooth = true;
else if( PlayerStatus & TS_ENTER::PlayerInfo::FLAG_BUY_BOOTH )
bIsSellBooth = false;
}
// { m_sBoothName 길이 제한
std::wstring wname = nsl::uni::conv( m_sBoothName );
if( wname.size() > 12 )
{
wname.resize( 12 );
wname.push_back( '.' );
wname.push_back( '.' );
wname.push_back( '.' );
}
m_sBoothName = nsl::uni::conv( wname );
// }
if( NULL != m_pBoothBackControl)
{
RemoveChild( m_pBoothBackControl );
m_pBoothBackControl = NULL;
}
if( NULL != m_pBoothTitleControl)
{
RemoveChild( m_pBoothTitleControl );
m_pBoothTitleControl = NULL;
}
if( m_sBoothName.empty() )
{
m_hTargetHandle = NULL;
return;
}
// Background
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "simplebutton";
arg.lpszID = "_booth_name_back";
arg.rcRect = _GetBoothBackRect();
if( m_bIsExistGuild )
{
arg.rcRect.top -= 13;//10;
arg.rcRect.bottom -= 13;//10;
}
CalcTitleHeight(arg.rcRect);
arg.rcRect.top += 14;
arg.rcRect.bottom += 14;
arg.pParent = this;
std::string strBoothName;
if( bIsSellBooth )
{ arg.lpszAniName = "button_booth_buy";
strBoothName = "<#7EBFFC><hcenter><size:11>"; }
else
{ arg.lpszAniName = "button_booth_sell";
strBoothName = "<#FFEA00><hcenter><size:11>"; }
strBoothName += m_sBoothName;
arg.lpszCaption = strBoothName.c_str();
m_pBoothBackControl = dynamicCast<KUIControlSimpleButton*>( m_pManager->CreateControl(arg) );
SetChildAsTop("_booth_name_back");
// sonador 3.9.3 개인상점 [사기/팔기] 비주얼 강화(텍스트 추가)
{
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszID = "_booth_title";
arg.lpszAniName = "";
arg.rcRect = _GetBoothBackRect();
arg.rcRect.top -= BOOTH_TYPE_HEIGHT + 3;
arg.rcRect.bottom -= BOOTH_TYPE_HEIGHT + 3;
CalcTitleHeight(arg.rcRect);
arg.pParent = this;
arg.dwFlag = KUI_FLAG::KFLAG_NO_GET_FOCUS | KUI_FLAG::KFLAG_NO_GET_MESSAGE;
arg.lpszCaption = bIsSellBooth ? S( 3355 ) : S( 3356 );
m_pBoothTitleControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
SetChildAsTop("_booth_title");
}
}
void SUICharacterWnd::SetLocalName(LPCSTR lpszLocalName, bool bShow)
{
if(NULL != m_pLocalNameControl )
{
RemoveChild( m_pLocalNameControl );
m_pLocalNameControl = NULL;
}
if(NULL != m_pLocalNameBackControl)
{
RemoveChild( m_pLocalNameBackControl );
m_pLocalNameBackControl = NULL;
}
if( bShow == false ) return;
// Background
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszID = "_local_name_back";
arg.rcRect = _GetLocalNameBackRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pLocalNameBackControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
// 이름 글자
arg.lpszAniName = "";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = lpszLocalName;
arg.lpszID = "_local_name";
arg.dwFlag = 0;
arg.dwStyle = 0;
arg.rcRect = _GetLocalNameBackRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pLocalNameControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pLocalNameControl->SetCaptionAlign(KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER);
m_dwLocalNameStartTime = m_dwTime;
}
/*
void SUICharacterWnd::SetBoothTitle( bool bIsSellBooth )
{
if( !m_bUseBooth ) return;
if( !m_pBoothTitleControl ) return;
if( bIsSellBooth ) m_pBoothTitleControl->SetBack( "", );
else m_pBoothTitleControl->SetBack( "", "static_streetstall_buytitle" );
// Background가 없으면 Size가 이상해 지므로 Move를 해주지 않음.
if( NULL == lpszBackAni)
return;
DWORD dwBackWidth = m_pBoothBackControl->GetRect().GetWidth();
int nXPos = m_rcRegion.left - (dwBackWidth + 1) / 2;
DWORD dwBackHeight = m_pBoothBackControl->GetRect().GetHeight();
int nYPos = m_rcRegion.top + BOOTH_OFFSET_Y / 2 - (dwBackHeight + 1) / 2;
m_pBoothBackControl->MovePos(nXPos,nYPos);
}*/
void SUICharacterWnd::SetNameBackAni(LPCSTR lpszBackAni, int nIndex)
{
if(NULL == m_pNameBackControl)
return;
m_pNameBackControl->SetBack( c_szDEF_SPR_NAME, lpszBackAni );
}
void SUICharacterWnd::SetChatMessage(LPCSTR lpszMesasge)
{
// 노점 중에는 머리위에 채팅 표시 안함
if( !m_sBoothName.empty() ) return;
if(NULL == lpszMesasge ||strlen(lpszMesasge) == 0)
{
m_pChatControl->SetShow( false);
return;
}
m_sChatMessage = lpszMesasge;
DWORD dwMessageWidth = KTextPhrase::GetOneLineStringSize( lpszMesasge );
KRect rcNewrect = m_rcRegion;
rcNewrect.left = rcNewrect.left + ((m_rcRegion.right-m_rcRegion.left)*0.39f) - (dwMessageWidth/2) - CHAT_MARGIN_WIDTH;
rcNewrect.right = rcNewrect.left + dwMessageWidth + CHAT_MARGIN_WIDTH;
if( !m_bIsExistGuild )
rcNewrect.top += CHAT_OFFSET_Y + CHARWND_POS_Y;
else
rcNewrect.top += (CHAT_OFFSET_Y - 25 + CHARWND_POS_Y );
rcNewrect.bottom = rcNewrect.top + CHAT_HEIGHT;
CalcTitleHeight(rcNewrect);
// 채팅 메세지는 항상 위에 오도록...
SetChildAsTop( "_character_chat" );
m_pChatControl->Resize( rcNewrect);
/// 2012.07.30 디폴트 폰트외의 폰트 태그를 설정 했을 때, lpszMesasge가 일정 길이 이상 ‰瑛?때,
/// 출력이 되지 않고 있다. 왜 그런지는 확인을 해봐야 되지만 우선은 기존처럼 폰트 태그를 삭제함 - prodongi
/*
std::string strChat = c_szChatTag;
strChat += lpszMesasge;
m_pChatControl->SetCaption( strChat.c_str(), false );
*/
m_pChatControl->SetCaption( lpszMesasge, false);
m_pChatControl->SetShow( true);
m_dwChatLastRemoveTime = m_dwTime;
}
void SUICharacterWnd::ChangeGuildName()
{
ChangeGuildName(m_sGuildName.c_str());
}
void SUICharacterWnd::ChangeGuildName( LPCSTR lpszGuildName )
{
if( lpszGuildName == NULL ) return;
//길드 이름
{
if(NULL != m_pGuildNameControl )
{
RemoveChild( m_pGuildNameControl );
m_pGuildNameControl = NULL;
}
m_sGuildName = lpszGuildName;
// 이름 글자
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "";//static_talk_outframe00";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = CStringUtil::StringFormat( "%s%s", c_szGuildNameTag ,m_sGuildName.c_str() ).c_str();
arg.lpszID = "_guild_name";
arg.dwFlag = 0;
arg.dwStyle = 0;
arg.rcRect = _GetGuildNameRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pGuildNameControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pGuildNameControl->SetCaptionAlign(KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER);
}
}
void SUICharacterWnd::SetGuildInfo( LPCSTR lpszGuildName, LPCSTR lpszIconAniName )
{
if( lpszGuildName == NULL ) return;
if( lpszIconAniName == NULL ) return;
if( !_strnicmp( lpszGuildName, "#@DELETEGUILD@#", _countof("#@DELETEGUILD@#") ) )
{
if(NULL != m_pGuildIconControl )
{
RemoveChild( m_pGuildIconControl );
m_pGuildIconControl = NULL;
}
if(NULL != m_pGuildNameControl )
{
RemoveChild( m_pGuildNameControl );
m_pGuildNameControl = NULL;
}
m_bIsExistGuild = false;
m_sGuildName = "#@DELETEGUILD@#";
m_sGuildAniName = "#@DELETEGUILD@#";
return;
}
m_bIsExistGuild = true;
//길드 이름
if( stricmp( m_sGuildName.c_str(), lpszGuildName ) != 0 )
{
if(NULL != m_pGuildNameControl )
{
RemoveChild( m_pGuildNameControl );
m_pGuildNameControl = NULL;
}
m_sGuildName = lpszGuildName;
// 이름 글자
KUIWND_CREATE_ARG arg;
arg.lpszAniName = "";//static_talk_outframe00";
arg.lpszSprName = m_sSprName.c_str();
arg.lpszClassName = "static";
arg.lpszCaption = CStringUtil::StringFormat( "%s%s",c_szGuildNameTag, m_sGuildName.c_str() ).c_str();
arg.lpszID = "_guild_name";
arg.dwFlag = 0;
arg.dwStyle = 0;
arg.rcRect = _GetGuildNameRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pGuildNameControl = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pGuildNameControl->SetCaptionAlign(KTextRender::KTALIGN_HCENTER | KTextRender::KTALIGN_VCENTER);
if( m_bNowMutate )
m_pGuildNameControl->SetShow( false );
}
//길드 아이콘
if( stricmp( m_sGuildAniName.c_str(), lpszIconAniName ) != 0 )
{
if(NULL != m_pGuildIconControl )
{
RemoveChild( m_pGuildIconControl );
m_pGuildIconControl = NULL;
}
// Icon
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = lpszIconAniName ? lpszIconAniName : "static_job_unknownicon";
arg.lpszClassName = "iconstatic";
arg.lpszID = "_guild_icon_back";
arg.rcRect = _GetGuildIconRect();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pGuildIconControl = dynamicCast<KUIControlIconStatic*>( m_pManager->CreateControl(arg) );
m_sGuildAniName = arg.lpszAniName;
if( m_bNowMutate )
m_pGuildIconControl->SetShow( false );
}
}
void SUICharacterWnd::SetProperty(DWORD dwChatRemoveTime)
{
m_dwChatRemoveTime = dwChatRemoveTime;
}
void SUICharacterWnd::MoveDotControl( int nX, int nY )
{
if( m_pDotControl )
m_pDotControl->MovePos( nX, nY );
if( m_pHPGauge )
{
if( m_pHPGauge->IsShow() )
m_pHPGauge->ReSizeBackGround();
}
}
void SUICharacterWnd::RefreshHP( int nCur, int nMax )
{
m_curHP = nCur; m_maxHP = nMax;
if( !m_pHPGauge ) return;
bool bFriend(false); unsigned char Type;
bFriend = m_pDisplayInfo->IsFriend(m_hOwner, Type);
bool bEnemy(false);
// 2012. 6. 5 - marine 적군으로 게이지 표시를 해야 할 때가 있다.
// pvp 상대, 던전시즈, 아레나 적 캐릭터 나 크리쳐
if( IsPvpUnit(Type) || m_IsEnemyUnit )
{
bEnemy = true;
bFriend = false;
}
if( bFriend ) //동료들은 게이지를 표시해준다 -N4-
{
if( Type != TS_ENTER::GAME_NPC ) //NPC는 적은 아니지만 머리위의 게이지가 없다
{
int nPer = static_cast<int>(m_pDisplayInfo->GetPercent( nCur, nMax ));
m_pDisplayInfo->RefreshGaugeAndStatic( m_pHPGauge, nCur, nMax, nPer, c_dwGaugeFillTime );
// 게이지 남은 양에 따라 텍스처 바꿔줌 // 2012.02.03 - servantes
setHPGaugeTexture( nPer, m_pHPGauge, 5 );
m_pHPGauge->ReSizeBackGround();
}
}
else //동료가 아니지만 몬스터들은 다른 리소스를 이용해서 표시해준다
{
if( Type == TS_ENTER::GAME_MOB || bEnemy )
{
int nPer = static_cast<int>(m_pDisplayInfo->GetPercent( nCur, nMax ));
m_pDisplayInfo->RefreshGaugeAndStatic( m_pHPGauge, nCur, nMax, nPer, c_dwGaugeFillTime );
/// 2010.11.24 - prodongi
m_pHPGauge->SetBack( c_szDEF_SPR_NAME, "common_gauge_titanium_monster_mini" );
m_pHPGauge->ReSizeBackGround();
}
}
}
bool SUICharacterWnd::IsPvpUnit(unsigned char Type)
{
if( Type == TS_ENTER::GAME_PLAYER && (IsThisLocalPlayer() == false) ) // 내가 아니여여 한다.
{
if(m_pPVPIconControl->IsShow()) // pvp상황
return true;
}
return false;
}
void SUICharacterWnd::RemoveHpGuage()
{
if( NULL != m_pHPGauge)
{
RemoveChild(m_pHPGauge);
m_pHPGauge= NULL;
};
}
bool SUICharacterWnd::IsShowHpGuage()
{
if( NULL != m_pHPGauge)
return m_pHPGauge->IsShow();
return false;
}
void SUICharacterWnd::SetHPGaugeBack(LPCSTR lpszBack)
{
if( NULL != m_pHPGauge)
RemoveChild(m_pHPGauge);
// if( NULL != m_pHPGaugeBack)
// RemoveChild(m_pHPGaugeBack);
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = lpszBack;
arg.lpszClassName = "gauge";
arg.lpszID = "_hp_gauge";
arg.pParent = this;
arg.rcRect = m_rcRegion;
//가운데 정렬
int nWidth = 26;
arg.rcRect.left = arg.rcRect.left + nWidth + 8;
arg.rcRect.right = arg.rcRect.left + GAUGE_WIDTH;
arg.rcRect.top = arg.rcRect.top + GAUGE_OFFSET_Y + CHARWND_POS_Y;
arg.rcRect.bottom = arg.rcRect.top + 4;
arg.dwFlag = KFLAG_NO_GET_FOCUS;
m_pHPGauge = dynamicCast<KUIControlGauge*>( m_pManager->CreateControl( arg ) );
bool bFlag = true;
//m_rcRegion.right == -1 영향 받지 않음
m_pHPGauge->SetUsePosEnable( false );
m_pHPGauge->SetShow( bFlag );
m_pHPGauge->SetActivate( bFlag );
m_pHPGauge->ReSizeBackGround();
SetChildAsTop( "_hp_gauge" );
}
KPoint SUICharacterWnd::GetDamageCenterPoint() const
{
return KPoint( m_rcRegion.left + DAMAGE_OFFSET_X, m_rcRegion.top + DAMAGE_OFFSET_Y );
}
//KUIControlDamage* SUICharacterWnd::AddDamageOptionAni( const char* szAniName, bool bMoveDefaultPos/* = true*/ )
//{
// ++m_nDamageCnt01;
//
// return NULL;
//
// //TODO
// KUIWND_CREATE_ARG arg;
// arg.lpszSprName = m_sSprName.c_str();
// arg.lpszClassName = "damage";
//// arg.lpszAniName =
//
// arg.lpszID = CStringUtil::StringFormat( "_add_damage_option%d", m_nDamageCnt01 ).c_str();
// arg.pParent = this;
// arg.rcRect = m_rcRegion;
// arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;;
//
// KUIControlDamage* pDamageOption = static_cast<KUIControlDamage*>( m_pManager->CreateControl( arg ) );
//// pDamageOption->SetDamageOptionAni( szAniName );
//
// m_DamageList.push_back( pDamageOption );
//
// if( bMoveDefaultPos )
// {
// KPoint ptDamageCenter = GetDamageCenterPoint();
// pDamageOption->MovePos
// ( ptDamageCenter.x - ((pDamageOption->GetRect().GetWidth()) / 2)
// , ptDamageCenter.y );
// }
// return pDamageOption;
//}
//KUIControlNumberEffectBase* SUICharacterWnd::AddMsg( const char* pMsg, bool bMoveDefaultPos/* = true*/ )
//{
// ++m_nDamageCnt01;
//
// KUIWND_CREATE_ARG arg;
// arg.lpszSprName = m_sSprName.c_str();
// arg.lpszAniName = "font_number_white_195"; //font_number_white_195// szFontAniName;
// arg.lpszClassName = "damage_critical";
// arg.lpszID = CStringUtil::StringFormat( "_add_msg%d", m_nDamageCnt01 ).c_str();
//// arg.lpszCaption = CStringUtil::StringFormat( "
// arg.pParent = this;
// arg.rcRect = m_rcRegion;
// arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;;
//
// // 데미지
// KUIControlDamageCritical* pDamage = static_cast<KUIControlDamageCritical*>( m_pManager->CreateControl( arg ) );
// pDamage->SetCaption( pMsg );
//
// m_DamageList.push_back( pDamage );
//
// if( bMoveDefaultPos )
// {
// KPoint ptDamageCenter = GetDamageCenterPoint();
// pDamage->MovePos
// ( ptDamageCenter.x - ((pDamage->GetRect().GetWidth()) / 2)
// , ptDamageCenter.y );
// }
// return pDamage;
//}
void SUICharacterWnd::AddState( const char * pString, KUIControlEffectText::EFFECT_TYPE nType, bool bScaleDown )
{
if( !m_pDotControl ) return;
#ifdef _KUI_INVALIDATION
if( m_dwTime && m_dwStartTime )
{
if( (m_dwTime - m_dwStartTime) >= c_dwGaugeFillTime*20 )
{
KUIControl* pEffectText = m_pDotControl->AddEffectControl( this, pString, nType, bScaleDown );
if( pEffectText )
{
m_StateEffectTextList.push_back( pEffectText );
this->AddPopupControl( pEffectText );
}
}
}
#else
if( m_dwTime && m_dwStartTime )
{
if( (m_dwTime - m_dwStartTime) >= c_dwGaugeFillTime*20 )
m_pDotControl->AddEffectControl( pString, nType, bScaleDown );
}
#endif
}
KUIControl* SUICharacterWnd::AddDamage( int nDamageflag, ADD_DAMAGE_INFO * pAddDamageInfo, bool bMoveDefaultPos/* = true*/ )
{
++m_nDamageCnt02;
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = pAddDamageInfo->strAniName00.c_str();
switch( nDamageflag )
{
case FONT_DEFAULT : arg.lpszClassName = "damage";
arg.lpszCaption = CStringUtil::StringFormat( "%d", pAddDamageInfo->nDamage00 ).c_str();
arg.rcRect = m_rcRegion;
break;
case FONT_HEAL : arg.lpszClassName = "healing";
arg.lpszCaption = CStringUtil::StringFormat( "%d", pAddDamageInfo->nDamage00 ).c_str();
arg.rcRect = m_rcRegion;
break;
case FONT_CRITICAL: arg.lpszClassName = "damage"; // AziaMafia FixSkill "damage";
arg.lpszCaption = CStringUtil::StringFormat( "%d", pAddDamageInfo->nDamage00 ).c_str();
arg.rcRect = m_rcRegion;
break;
case FONT_ETC : arg.lpszClassName = "damage_etc";
arg.rcRect = m_rcRegion;
arg.rcRect.left += 45;
arg.rcRect.right = -1;
arg.rcRect.top += 30;
arg.rcRect.bottom = -1;
break;
case FONT_MAX_HEAL : arg.lpszClassName = "healing_maximize";
arg.rcRect = m_rcRegion;
break;
}
arg.lpszID = CStringUtil::StringFormat( "_add_damage%d", m_nDamageCnt02 ).c_str();
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
// 데미지
KUIControl* pDamage = NULL;
int nWidth = 0;
switch( nDamageflag )
{
case FONT_DEFAULT :
{
KUIControlDamage* pDamageFont = dynamicCast<KUIControlDamage*>( m_pManager->CreateControl( arg ) );
pDamage = pDamageFont;
if( !pAddDamageInfo->strAniName01.empty() )
pDamageFont->AddDamageEtcText( pAddDamageInfo->strAniName01.c_str(), pAddDamageInfo->strAniName02.c_str() );
if( pAddDamageInfo->nDamage01 > 0 )
pDamageFont->AddExtraDamage( pAddDamageInfo->strAniName03.c_str(), pAddDamageInfo->strAniName04.c_str(), CStringUtil::StringFormat( "%d", pAddDamageInfo->nDamage01 ).c_str() );
}
break;
case FONT_HEAL :
{
KUIControlHealing* pDamageFont = dynamicCast<KUIControlHealing*>( m_pManager->CreateControl( arg ) );
pDamage = pDamageFont;
}
break;
case FONT_CRITICAL:
{
KUIControlDamageCritical* pDamageFont = dynamicCast<KUIControlDamageCritical*>( m_pManager->CreateControl( arg ) );
pDamage = pDamageFont;
//Azia FixSkill decommentaire
//if( !pAddDamageInfo->strAniName01.empty() )
//pDamageFont->AddCriticalText( pAddDamageInfo->strAniName01.c_str() );
// 2010.09.06 - prodongi
if( pAddDamageInfo->nDamage01 > 0 )
pDamageFont->AddExtraDamage( pAddDamageInfo->strAniName03.c_str(), pAddDamageInfo->strAniName04.c_str(), CStringUtil::StringFormat( "%d", pAddDamageInfo->nDamage01 ).c_str() );
}
break;
case FONT_ETC :
{
KUIControlDamageEtc* pDamageFont = dynamicCast<KUIControlDamageEtc*>( m_pManager->CreateControl( arg ) );
pDamage = pDamageFont;
if( !pAddDamageInfo->strAniName01.empty() )
pDamageFont->AddPerfectText( pAddDamageInfo->strAniName01.c_str() );
}
break;
case FONT_MAX_HEAL :
{
KUIControlHealingMaximize* pDamageFont = dynamicCast<KUIControlHealingMaximize*>( m_pManager->CreateControl( arg ) );
pDamage = pDamageFont;
if( !pAddDamageInfo->strAniName01.empty() )
pDamageFont->AddMaxHealText( pAddDamageInfo->strAniName01.c_str() );
}
break;
}
m_DamageList.push_back( pDamage );
#ifdef _KUI_INVALIDATION
// { [sonador]
this->AddPopupControl( pDamage );
// }
#endif
if( bMoveDefaultPos )
{
KPoint ptDamageCenter = GetDamageCenterPoint();
pDamage->MovePos
( ptDamageCenter.x - ((pDamage->GetRect().GetWidth()) / 2)
, ptDamageCenter.y );
}
return pDamage;
}
KRect SUICharacterWnd::_GetGuildIconRect()
{
KRect rect = m_pGuildNameControl->GetRect();
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "<size:10><#ffffff><SHADOW>%s</SHADOW>", m_sGuildName.c_str() ).c_str() );
int nWidth = rect.right-rect.left;
nWidth = std::max( 133, (int)dwNameWidth );
KRect rcName;
rcName.left = rect.left+(nWidth - dwNameWidth)/2 - 5 - 20; //5pixel 옆에 아이콘은 20짜리
rcName.right = rcName.left + 20;
rcName.top = m_rcRegion.top + NAME_OFFSET_Y + 2 - 5 - 20 + CHARWND_POS_Y;
rcName.bottom = rcName.top + NAME_HEIGHT;
CalcTitleHeight(rcName);
return rcName;
}
KRect SUICharacterWnd::_GetGuildNameRect()
{
KRect rcName;
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "<size:10><#ffffff><SHADOW>%s</SHADOW>", m_sGuildName.c_str() ).c_str() );
dwNameWidth = std::max( (int)dwNameWidth, 133 );
//가운데 정렬
int nWidth = 25;
rcName.left = m_rcRegion.left + nWidth ; // + (dwNameWidth + 1) / 2;
rcName.right = rcName.left + dwNameWidth;// m_pNameBackControl->GetRect().GetWidth(); //(dwNameWidth + 1); // / 2;
rcName.top = m_rcRegion.top + NAME_OFFSET_Y - 5 - 20 + CHARWND_POS_Y;
rcName.bottom = rcName.top + NAME_HEIGHT + (m_bMain ? 4 : 0 );
CalcTitleHeight(rcName);
return rcName;
}
KRect SUICharacterWnd::_GetIconRect()
{
KRect rcNameBack = _GetNameBackRect();
KRect rcName;
// DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( m_sName.c_str());
// 2009.03.09 #kappamind 캐릭터 이름 길이 구해 오는 것 수정.
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
rcName.left = GetVsIconPos();
rcName.right = m_rcRegion.left + VS_ICON_WIDTH;
rcName.top = m_rcRegion.top + NAME_OFFSET_Y + 2 - 5 -VS_ICON_ADJUST_Y + CHARWND_POS_Y;
rcName.bottom = rcName.top + NAME_HEIGHT -VS_ICON_ADJUST_Y;
return rcName;
}
KRect SUICharacterWnd::getQuestMobIconRect(char const* aniName)
{
KRect rcNameBack = _GetNameBackRect();
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
KSize offset(0, 0);
KResSprite* res = _getSpriteSet()->GetSpriteRes(aniName, 0);
if (res)
{
offset.cx = res->GetSizeX();
}
else
{
offset.cx = 13;
}
/// 여유분
offset.cx += 7;
offset.cy += 2;
KSize pos;
pos.cx = rcNameBack.left + (rcNameBack.GetWidth() >> 1);
pos.cx -= (dwNameWidth >> 1);
pos.cy = rcNameBack.top;
pos.cx -= offset.cx;
pos.cy -= offset.cy;
KRect r;
r.left = pos.cx;
r.top = pos.cy;
r.right = r.left + rcNameBack.GetWidth();
r.bottom = rcNameBack.bottom;
return r;
}
KRect SUICharacterWnd::_GetPVPIconRect()
{
KRect rcNameBack = _GetNameBackRect();
KRect rcName;
// 캐릭터 이름 길이에 맞춰 아이콘 출력 위치 변경, kappamind.
// DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( m_sName.c_str());
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
rcName.left = GetVsIconPos();
rcName.right = m_rcRegion.left + VS_ICON_WIDTH;
rcName.top = m_rcRegion.top + NAME_OFFSET_Y + 2 - 5 -VS_ICON_ADJUST_Y + CHARWND_POS_Y;
rcName.bottom = rcName.top + NAME_HEIGHT -VS_ICON_ADJUST_Y ;
return rcName;
}
KRect SUICharacterWnd::_GetNameBackRect()
{
KRect rcName;
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
rcName.left = m_rcRegion.left; // + (dwNameWidth + 1) / 2;
if( dwNameWidth > 180 )
rcName.right = m_rcRegion.left + dwNameWidth+1;// m_pNameBackControl->GetRect().GetWidth(); //(dwNameWidth + 1); // / 2;
else
rcName.right = m_rcRegion.left + 180;
rcName.top = m_rcRegion.top + NAME_OFFSET_Y - 5 + CHARWND_POS_Y;
rcName.bottom = rcName.top + NAME_HEIGHT + (m_bMain ? 4 : 0 );
return rcName;
}
KRect SUICharacterWnd::_GetBoothBackRect()
{
KRect rcBooth;
DWORD dwNameWidth = 160;
rcBooth.left = m_rcRegion.left + 30; // - (dwNameWidth + 1) / 2;
rcBooth.right = m_rcRegion.left + (dwNameWidth + 1); // / 2;
rcBooth.top = m_rcRegion.top + BOOTH_OFFSET_Y + CHARWND_POS_Y;
rcBooth.bottom = rcBooth.top + BOOTH_HEIGHT;
return rcBooth;
}
KRect SUICharacterWnd::_GetLocalNameBackRect()
{
KRect rcLCName;
DWORD dwNameWidth = 500;
rcLCName.left = m_rcRegion.left;
rcLCName.right = m_rcRegion.left + dwNameWidth;
rcLCName.top = m_rcRegion.top + CHARWND_POS_Y;
rcLCName.bottom = m_rcRegion.bottom + CHARWND_POS_Y;
return rcLCName;
}
void SUICharacterWnd::ChangeDisplayName( SIMSG_UI_CHANGE_DISPLAY_NAME* pMsg )
{
if( pMsg == NULL ) return;
if( pMsg->bRestory ) //복구
{
if( m_bNowMutate == false ) return;
m_bNowMutate = false;
m_sName = m_sBackUpName;
m_sBackUpName.clear();
m_sNameEffect = m_sBackUpNameEffect;
m_sBackUpNameEffect.clear();
if( m_pNameControl )
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON )
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_sPK_Color.c_str(), m_sName.c_str() ).c_str() );
else
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
}
if( m_pIconControl )
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON )
ShowPKIcon( true );
else
ShowPKIcon( false );
}
//1:1대련
if( m_pPVPIconControl )
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_COMPETING )
ShowPVPIcon( true );
else
ShowPVPIcon( false );
}
if( m_sGuildName.empty() == false )
{
if( m_pGuildNameControl )
m_pGuildNameControl->SetShow( true );
if( m_pGuildIconControl )
m_pGuildIconControl->SetShow( true );
}
}
else
{
m_bNowMutate = true;
if( m_pNameControl && pMsg->pChangeName )
{
if( m_sBackUpName.empty() )
m_sBackUpName = m_sName;
if( m_sBackUpNameEffect.empty() )
m_sBackUpNameEffect = m_sNameEffect;
m_sName = pMsg->pChangeName;
m_sNameEffect = c_szCreatureNameTag; // 크리쳐 색
m_pNameControl->SetCaption( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), pMsg->pChangeName ).c_str() );
}
if( m_pIconControl )
ShowPKIcon( false );
//1:1대련
if( m_pPVPIconControl )
ShowPVPIcon( false );
if( m_pGuildNameControl )
m_pGuildNameControl->SetShow( false );
if( m_pGuildIconControl )
m_pGuildIconControl->SetShow( false );
}
}
void SUICharacterWnd::createEmblemIcon(int objType)
{
if (TS_ENTER::GAME_PLAYER != objType)
return;
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = "";
arg.lpszClassName = "iconstatic";
arg.lpszID = "_emblem_icon";
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
KRect rect = _GetNameBackRect();
rect.top -= EMBLEM_OFFSET_Y;
rect.left -= EMBLEM_OFFSET_X;
arg.rcRect = rect;
m_pEmblemControl = dynamicCast<KUIControlIconStatic*>(m_pManager->CreateControl(arg));
m_pEmblemControl->SetShow(false);
}
/// 2011.08.05 - prodongi
void SUICharacterWnd::createQuestIcon(int objType)
{
if (TS_ENTER::GAME_MOB != objType && TS_ENTER::GAME_FIELD_PROP != objType && TS_ENTER::GAME_NPC != objType)
return ;
if (m_questIconControl)
RemoveChild(m_questIconControl);
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = "common_mark_titanium_quest_target";
arg.lpszClassName = "iconstatic";
arg.lpszID = "quest_mob_icon";
arg.rcRect = getQuestMobIconRect(arg.lpszAniName.c_str());
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_questIconControl = dynamicCast<KUIControlIconStatic*>( m_pManager->CreateControl(arg) );
m_questIconControl->SetShow(false);
}
void SUICharacterWnd::createTitleStatic(int objType)
{
if( TS_ENTER::GAME_PLAYER != objType )
return;
KUIWND_CREATE_ARG arg;
arg.lpszSprName = m_sSprName.c_str();
arg.lpszAniName = "";
arg.lpszClassName = "static";
arg.lpszID = "static_title_name";
KRect rect = _GetNameBackRect();
rect.top -= (TITLE_HEIGHT+1);
rect.bottom -= (TITLE_HEIGHT+1);
arg.rcRect = rect;//KRect(0,60,180,80); // 위치 설정 다시 해줘야함..
arg.pParent = this;
arg.dwFlag = KFLAG_GET_PASS_MESSAGE | KFLAG_NO_GET_FOCUS;
m_pTitleName = dynamicCast<KUIControlStatic*>( m_pManager->CreateControl(arg) );
m_pTitleName->SetShow(false);
}
void SUICharacterWnd::setTitleName(std::string &strName)
{
m_strTitleName = strName;
m_pTitleName->SetCaption( CStringUtil::StringFormat("%s%s", c_szTitleNameTag ,strName.c_str()).c_str());
NotifyTitleNameUsingState();
}
void SUICharacterWnd::setTitleName( int nID )
{
if( nID == 0 )
m_strTitleName = "";
else
m_strTitleName = S( m_TitleMgr.GetTitleStringID(nID) );
setTitleName(m_strTitleName);
}
void SUICharacterWnd::NotifyTitleNameUsingState()
{
bool bUsingTitle = IsTitleUsing();
if( (int)bUsingTitle == m_UpAndDownState ) // 같은 상태로 넘어올 경우에는 리턴
return;
else
m_UpAndDownState = (int)bUsingTitle;
SetMovingControl( IsTitleUsing() );
}
void SUICharacterWnd::SetMovingControl(bool isTitleUsing)
{
int deltaY = (isTitleUsing)? -NAME_HEIGHT : NAME_HEIGHT;
m_pTitleName->SetShow(isTitleUsing);
std::vector<stMovingCTL>::iterator it = m_vMoveControl.begin();
std::string str;
KRect rect;
for( ; it != m_vMoveControl.end() ; ++it )
{
str = it->str;
KUIWnd* wnd = GetChild( str.c_str() );
if(wnd)
{
rect = wnd->GetRect();
wnd->MovePos( rect.left, rect.top + deltaY + ( (isTitleUsing)? -(it->adjustSize) : it->adjustSize ) );
}
}
}
void SUICharacterWnd::CalcTitleHeight( KRect &rc )
{
if(IsTitleUsing())
{
rc.top -= TITLE_HEIGHT;
rc.bottom -= TITLE_HEIGHT;
}
}
int SUICharacterWnd::GetVsIconPos()
{
KRect rcNameBack = _GetNameBackRect();
DWORD dwNameWidth = KTextPhrase::GetOneLineStringSize( CStringUtil::StringFormat( "%s%s", m_sNameEffect.c_str(), m_sName.c_str() ).c_str() );
return rcNameBack.left + rcNameBack.GetWidth()/2 - dwNameWidth/2 - 30;//네임스트링 보다 -50
}
void SUICharacterWnd::ShowPVPIcon(bool bShow)
{
if(m_pPVPIconControl->IsShow() == bShow)
return;
SetChildAsTop("_PVP_icon");
// pk 아이콘이 켜져있는 경우에 show/hide 상태에 따라 pk아이콘을 이동시킨다.
int delta = (bShow)? -14 : 14;
if(m_pIconControl->IsShow()) // pk가 show경우
{
KRect rect = m_pIconControl->GetRect();
m_pPVPIconControl->MovePos( GetVsIconPos() + delta, rect.top);
}
m_pPVPIconControl->SetShow(bShow);
if( IsThisLocalPlayer() == false ) // 내가 아니라면 게이지바 와 이름색 변경
{
if(bShow)
SetEnemyGuage();
else
RemoveHpGuage();
}
}
void SUICharacterWnd::SetEnemyGuage()
{
if(m_pHPGauge == NULL)
SetHPGaugeBack("_hp_monster_gauge");
m_pHPGauge->SetShow(true);
RefreshHP(m_curHP,m_maxHP);
}
void SUICharacterWnd::setEnemyUnit(bool bEnemyUnit, unsigned char type)
{
bool bChange = m_IsEnemyUnit^bEnemyUnit;
m_IsEnemyUnit = bEnemyUnit;
SGame* pGame(NULL);
pGame = m_pGameManager->GetActiveGame();
if(pGame == NULL)
return;
////////////////////////// 게이지바 설정///////////////////////////////
if(m_IsEnemyUnit)
SetEnemyGuage();
else
{
if(bChange) // 적군에서 아군으로 변경된 경우는 무조건 리프레시..
{
SetHPGaugeBack("_hp_gauge");
RefreshHP(m_curHP,m_maxHP);
}
else
{
if( pGame && pGame->IsFriend(m_hOwner, type) )
{
if( m_pHPGauge == NULL )
{
SetHPGaugeBack("_hp_gauge");
RefreshHP(m_curHP,m_maxHP);
}
else
{
if(m_pHPGauge->IsShow() == false )
SetHPGaugeBack("_hp_gauge");
}
}
}
}
//////////////////////////// 이름 설정///////////////////////////
std::string str;
if( type == TS_ENTER::GAME_PLAYER )
{
if( g_pCurrentGameSystem->isInArena() ) // 아레나 안에서는 적 아니면 아군 의 식별 이외의 표식은 없다.
{
str = (bEnemyUnit)? c_szAttaMonNameTag : c_szCharNameTag;
}
else // 아레나 이외의 로컬에서는
{ // 1. 적 - 아군
str = (bEnemyUnit)? c_szAttaMonNameTag : c_szCharNameTag; // 2. PK( pk, bloody, demoniac )
//if( bEnemyUnit == false )
{
if( m_status & TS_ENTER::PlayerInfo::FLAG_PK_ON )
str = c_szCharPKOnNameTag;
else if( m_status & TS_ENTER::PlayerInfo::FLAG_DEMONIAC )
str = c_szCharPKDemonicTag;
else if( m_status & TS_ENTER::PlayerInfo::FLAG_BLOODY )
str = c_szCharPKBloodyTag;
}
}
}
else if( type == TS_ENTER::GAME_SUMMON )
str = (bEnemyUnit)? c_szAttaMonNameTag : c_szCreatureNameTag;
str += m_sName;
m_pNameControl->SetCaption(str.c_str());
}
void SUICharacterWnd::setCreatureState(unsigned int type)
{
bool isEnemy = false;
if(type & TS_ENTER::PlayerInfo::FLAG_COMPETING)
isEnemy = true;
setEnemyUnit( isEnemy, TS_ENTER::GAME_SUMMON );
}
void SUICharacterWnd::ReFreshWnd()
{
if( GetObjType() != TS_ENTER::GAME_PLAYER && GetObjType() != TS_ENTER::GAME_SUMMON )
return;
SGame* pGame(NULL);
pGame = m_pGameManager->GetActiveGame();
if(pGame == NULL)
return;
SGameAvatarEx* pAvatar(NULL);
pAvatar = (SGameAvatarEx*)( pGame->GetGameObject(m_hOwner) );
if( pAvatar )
{
if( pGame->IsAttack(pAvatar) )
setEnemyUnit( true, GetObjType() );
else
setEnemyUnit( false, GetObjType() );
}
}
void SUICharacterWnd::ReFreshCheck(DWORD dwTime)
{
if( m_dwBeforeRefrshTime == 0 )
m_dwBeforeRefrshTime = dwTime;
else
{
if( (dwTime - m_dwBeforeRefrshTime) > 1000 ) // 1초
{
m_dwBeforeRefrshTime = dwTime;
ReFreshWnd();
}
}
}
bool SUICharacterWnd::IsThisLocalPlayer()
{
SGameAvatarEx* localPlayer = g_pCurrentGameSystem->GetLocalPlayer();
if( localPlayer )
return localPlayer->GetArID() == m_hOwner;
return false;
}
void SUICharacterWnd::ShowPKIcon(bool bShow)
{
if(m_pIconControl->IsShow() == bShow)
return;
int delta = (bShow)? -14 : 0;
if(m_pPVPIconControl->IsShow()) // vs가 show일 경우
{
KRect rect = m_pIconControl->GetRect();
m_pPVPIconControl->MovePos( GetVsIconPos() + delta, rect.top);
}
m_pIconControl->SetShow(bShow);
}
void SUICharacterWnd::RefreshHP()
{
RefreshHP(m_curHP,m_maxHP);
};
/// 2011.08.15 - prodongi
void SUICharacterWnd::procQuestIcon()
{
if (!m_questIconControl)
return ;
SGameWorld* gameWorld = dynamicCast<SGameWorld*>(m_pGameManager->GetActiveGame());
if (!gameWorld)
return ;
bool show = false;
int objType = GetObjType();
SGameAvatarEx* obj = dynamicCast<SGameAvatarEx*>(gameWorld->GetGameObject(m_hOwner));
if (!obj)
return ;
int enc_id_value = obj->GetContentID().value();
if (TS_ENTER::GAME_MOB == objType)
{
SGameMob* mob = dynamicCast<SGameMob*>(obj);
if (!mob)
return ;
if (SQuestMgr::GetInstance().isQuestMarkMob(enc_id_value, true))
show = true;
}
else if (TS_ENTER::GAME_FIELD_PROP == objType)
{
SGameFieldQuestProp* prop = dynamicCast<SGameFieldQuestProp*>(obj);
if (!prop)
return ;
FieldPropResource* res = GetFieldPropResourceDB().GetFieldPropResource(prop->GetQuestPropDBID());
if (!res)
return ;
if (SQuestMgr::GetInstance().isQuestMarkDropItem(res->drop_item_id_00, true))
{
show = true;
}
else
{
if (SQuestMgr::GetInstance().isQuestMarkProp(prop->GetQuestPropDBID(), true))
show = true;
}
if (m_pNameControl)
m_pNameControl->SetShow(show);
}
else if (TS_ENTER::GAME_NPC == objType)
{
SGameNpc* npc = dynamicCast<SGameNpc*>(obj);
if (!npc)
return ;
if (SQuestMgr::GetInstance().isQuestMarkNpc(enc_id_value, false))
show = true;
}
m_questIconControl->SetShow(show);
}
bool SUICharacterWnd::IsTitleUsing()
{
if( GetGameOption().GetTitleNameShow() == 0 ) // 호칭 사용 옵션 체크
return false;
if( m_strTitleName.compare("") == false ) // 호칭 이름 체크
return false;
return true;
}