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

1691 lines
50 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "stdafx.h"
#include "SGame.h"
#include "SGameLobbyDefine.h"
#include <internet/XInternet.h>
#include "KRenderObjectBone.h"
#include "KRenderObjectMesh.h"
#include "KSeqAvatarEx.h"
#include "KSeqModel.h"
#include <kfile/KFileManager.h>
#include <toolkit/XStringUtil.h>
#include "SNetMessage.h"
#include "SNetMessageBill.h"
#include "SCobManager.h"
#include "SItemDB.h"
#include "SDefaultTextureResourceDB.h"
#include "SStringDB.h"
#include "SkillBaseFile.h"
#include "SGameOption.h"
#include "SDebug_Util.h"
#include "KSeqAvatar.h"
//const char* c_szNoticeURL = "http://launcher.rappelz.com/client_notice?ip=";
//const char* c_szOldNoticeURL = "http://launcher.rappelz.com/client_old_notice?ip=";
// Fraun 7/12/2025 nullifying gala spyware
const char* c_szNoticeURL = "http://127.0.0.1/launcher/client_notice?ip=";
const char* c_szOldNoticeURL = "http://127.0.0.1/launcher/client_old_notice?ip=";
const DWORD c_dwNoticeMaxSize = 8192;
const char* c_szDefaultAniName = "default";
const char* c_szBGCommonAniName = "bg_common";
const char* c_szBGAsuraAniName = "bg_asura";
const char* c_szBGDevaAniName = "bg_deva";
const char* c_szSelectStartAniName = "select_start";
const char* c_szSelectLoopAniName = "select_loop";
const char* c_szSelectEndAniName = "select_end";
const char* c_szUnselectStartAniName = "unselect_start";
const char* c_szUnselectLoopAniName = "unselect_loop";
const char* c_szUnselectEndAniName = "unselect_end";
const char* c_szAvatarEffectStartAniName = "effect_start";
const char* c_szAvatarEffectLoopAniName = "effect_loop";
const char* c_szAvatarEffectLoop2AniName = "effect_loop2";
const char* c_szAvatarEffectEndAniName = "effect_end";
const char* c_szClanCardStartAniName = "card_start";
const char* c_szClanCardLoopAniName = "card_loop";
const char* c_szClanCardEndAniName = "card_end";
const KColor c_colorLobbyFog = KColor(255, 255, 255, 255);
const float c_fLobbyFogNear = 32.f;
const float c_fLobbyFogFar = 1024.f;
const float c_fAvatarRotateValue = (3.141592f / 3.f);
const float c_fAvatarRotateDeltaPerFrame = 0.06f;
USER_INFO g_UserInfo;
const char* pLOGIN_STATE[] =
{
"GAMELOGIN_UNINITIALIZED", // 최초 시작
"GAMELOGIN_PREPARE_LOGIN", // 로그인 준비
"GAMELOGIN_LOGIN", // 로그인 가능
"GAMELOGIN_LOGIN_OFF", // 로그인 시도 및 결과 대기
"GAMELOGIN_PREPARE_SERVERSELECT", // 책 넘기기
"GAMELOGIN_SERVERSELECT", // 서버 선택 대기
"GAMELOGIN_SERVERSELECT_ON", // 서버 선택 가능
"GAMELOGIN_GAMESERVER_LOGIN", // login to game server
"GAMELOGIN_PREPARE_CHARSELECT", // 캐릭터 선택 준비
"GAMELOGIN_CHARSELECT_WAIT_TIME", //
"GAMELOGIN_BACK_CHARSELECT_TO_GAME", //
"GAMELOGIN_CHARSELECT", // 캐릭터 선택 가능
//"GAMELOGIN_WAITING_CHAREFFECT_FINISH", //
"GAMELOGIN_CREATECHAR_RACE_SELECT", //
"GAMELOGIN_CREATECHAR_RACE_SELECT_BACK", //
"GAMELOGIN_CREATECHAR_RACE_MOVIE", //
"GAMELOGIN_CREATECHAR_CUSTOMIZING", //
"GAMELOGIN_CREATECHAR_SUCCESS", //
"GAMELOGIN_CREDITS", // 크레딧 화면으로 전환 // sonador 10.5.1 크레딧 화면 구현
"GAMELOGIN_CREDITS2", // 크레딧 화면으로 전환 // sonador 10.5.1 크레딧 화면 구현
"GAMELOGIN_CREDITS3", /// 2011.12.14 - prodongi
"GAMELOGIN_CREDITSEPIC6_PROLOGUE", // 크레딧 화면으로 전환 // sonador 10.5.1 크레딧 화면 구현
"GAMELOGIN_BACKTO_CHARSELECT", // 캐릭터 선택으로 돌아가기
"GAMELOGIN_BACKTO_LOGOUT", // 로그아웃 처리.
//"GAMELOGIN_CREATECHAR_SECOND", // 캐릭터 생성 2단계
//"GAMELOGIN_DBLCLICK_LOGIN",
"GAMELOGIN_DEVELOPERS_LOGIN", //개발자 로그인
};
extern K3DTexture* _getTexture(const char* texname, DWORD skin_color = 0);
int GetValidNum(int nNum, int nMaxNum)
{
if (nMaxNum < 1) return 0;
nNum %= nMaxNum;
return (nNum < 0) ? (nNum + nMaxNum) : nNum;
}
volatile bool SAvatarSelector::s_bStopThread = false;
static XCriticalSection s_SelectAvatarLoadingLock;
static std::list< SAvatarSelector* > s_lstThreadLoadingSelectAvatar;
SAvatarSelector::SAvatarSelector()
: m_nLevel(0)
, m_nJobLevel(0)
, m_nJobID(-1)
, m_nRace(GCLAN_DEVA)
, m_nSex(SEX_FEMALE)
, m_nHairIndex(0)
, m_nFaceIndex(0)
, m_nBodyIndex(0)
, m_nHandIndex(0)
, m_nFootIndex(0)
, m_fSecondRoll(0.0f)
, m_fScale(1.0f)
{
m_pAvatar = new KSeqAvatarEx;
m_pAvatar->Initialize();
for (int i(0); 5 > i; i++)
m_NudeCode[i] = 0;
for (int i(0); ItemBase::MAX_ITEM_WEAR > i; i++)
{
m_WearCode[i] = 0;
m_nItemLevel[i] = 0;
}
m_bUseProc = false;
m_bUseRot = false;
m_fTargetRoll = 1.f;
m_fPresentRoll = -1.f;
m_dwPrevTime = 0;
m_bIsPosBack = true;
m_bRotate = false;
m_bIsFront = false;
m_bSelectAvatar = false;
m_dwTime = 0;
m_bIsThreadPending = false;
m_bIsThreadLoading = false;
m_dwSkinColor = 0;
m_dwHairColor = 0;
m_nHairColorIndex = 0;
m_hideEquipInfo;
}
SAvatarSelector::~SAvatarSelector()
{
while (m_bIsThreadLoading)
{
Sleep(100);
}
removeFromLoadingList();
delete m_pAvatar;
}
K3DMatrix& SAvatarSelector::GetTransform()
{
return m_pAvatar->GetTransform();
}
void SAvatarSelector::SetTransform(const K3DMatrix& rPos)
{
m_pAvatar->SetTransform(rPos);
}
unsigned int __stdcall SAvatarSelector::avatar_loader(void* pArg)
{
while (!s_bStopThread)
{
SAvatarSelector* pAvatar = NULL;
{
s_SelectAvatarLoadingLock.Lock();
if (s_lstThreadLoadingSelectAvatar.empty())
{
s_SelectAvatarLoadingLock.UnLock();
#ifdef _DEBUG
Sleep(100);
#else
Sleep(50);
#endif
continue;
}
pAvatar = s_lstThreadLoadingSelectAvatar.front();
s_lstThreadLoadingSelectAvatar.pop_front();
pAvatar->StartThreadLoading();
s_SelectAvatarLoadingLock.UnLock();
}
pAvatar->doLoading();
pAvatar->EndThreadLoading();
}
s_bStopThread = false;
return 0;
}
void SAvatarSelector::BeginAvatarLoadingThread()
{
if (s_bStopThread == false)
{
unsigned dwThreadID;
HANDLE hThread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, SAvatarSelector::avatar_loader, NULL, 0, &dwThreadID));
CloseHandle(hThread);
}
}
void SAvatarSelector::EndAvatarLoadingThread()
{
_oprint("**THREAD INFO : SAvatarSelector::EndAvatarLoadingThread\n");
if (s_bStopThread == false)
{
s_bStopThread = true;
while (s_bStopThread) Sleep(1);
}
}
void SAvatarSelector::removeFromLoadingList()
{
THREAD_SYNCRONIZE(s_SelectAvatarLoadingLock);
if (!m_bIsThreadPending) return;
std::list< SAvatarSelector* >::iterator it;
for (it = s_lstThreadLoadingSelectAvatar.begin(); it != s_lstThreadLoadingSelectAvatar.end(); ++it)
{
if (*it == this)
{
s_lstThreadLoadingSelectAvatar.erase(it);
return;
}
}
}
void SAvatarSelector::addToLoadingList()
{
THREAD_SYNCRONIZE(s_SelectAvatarLoadingLock);
#ifdef _DEBUG
std::list< SAvatarSelector* >::iterator it;
for (it = s_lstThreadLoadingSelectAvatar.begin(); it != s_lstThreadLoadingSelectAvatar.end(); ++it)
{
if (*it == this)
{
assert(0);
return;
}
}
#endif
m_bIsThreadPending = true;
s_lstThreadLoadingSelectAvatar.push_back(this);
}
void SAvatarSelector::PendLoading()
{
if (m_bIsThreadPending) return;
addToLoadingList();
}
bool SAvatarSelector::IsPlaying()
{
return m_pAvatar->IsPlaying();
}
void SAvatarSelector::doLoading()
{
struct _FlagRemover
{
_FlagRemover(volatile bool* volatile f) : pFlag(f) {}
~_FlagRemover() { *pFlag = false; }
volatile bool* volatile pFlag;
};
//struct _TrueRemover
//{
// _TrueRemover( volatile bool* volatile f ) : pFlag( f ) {}
// ~_TrueRemover() { *pFlag = true; }
// volatile bool* volatile pFlag;
//};
RefreshAvatar();
// volatile _FlagRemover _remover0( &m_bIsThreadLoading );
volatile _FlagRemover _remover1(&m_bIsThreadPending);
}
bool SAvatarSelector::Init()
{
m_nLevel = 0;
m_nJobLevel = 0;
m_nJobID = 0;
m_nRace = GCLAN_DEVA;
m_nSex = SEX_FEMALE;
m_nHairIndex = 0;
m_nFaceIndex = 0;
m_nBodyIndex = 0;
m_nHandIndex = 0;
m_nFootIndex = 0;
for (int i(0); 5 > i; i++)
m_NudeCode[i] = 0;
for (int i(0); ItemBase::MAX_ITEM_WEAR > i; i++)
{
m_WearCode[i] = 0;
m_nItemLevel[i] = 0;
}
m_pAvatar->Initialize();
_CID(SETBONEBLEND);
KMsgGET_SETBONEBLEND msg;
msg.bUseBlend = true;
m_pAvatar->Perform(id_SETBONEBLEND, msg);
m_bUseProc = false;
m_bUseRot = false;
m_fTargetRoll = 1.f;
m_fPresentRoll = -1.f;
m_dwPrevTime = 0;
m_bIsPosBack = true;
m_bRotate = false;
m_bIsFront = false;
m_bRefresh = false;
return true;
}
void SAvatarSelector::Render(KViewportObject* viewport, DWORD flag/*=0*/)
{
if (m_bRefresh && m_bIsThreadPending == false && m_bIsThreadLoading == false)
{
m_pAvatar->Render(viewport, flag);
}
}
unsigned long SAvatarSelector::GetSkinColorized()
{
unsigned long color_value = m_dwSkinColor;
color_value &= 0x00FFFFFF; //알파 제거
return color_value;
}
void SAvatarSelector::RefreshSkinColorized()
{
SetSkinColorized(m_dwSkinColor, K3DTexture::COLORIZED_DEF, m_dwHairColor);
}
void SAvatarSelector::SetHairColorIndex(int nIndex)
{
m_nHairColorIndex = nIndex;
}
void SAvatarSelector::SetSkinColorized(const DWORD& color, const int& nMode, const DWORD& hairColor)
{
_CID(SET_COLORIZE);
_CID(SET_USE_TEXALPHA);
m_dwSkinColor = color; //서버엔 알파 없음
m_dwSkinColor |= 0xff000000;
SetHairColorRGB(hairColor);
m_dwHairColor = hairColor;
//m_dwHairColor |= 0xff000000; // Alpha is not available
if (m_pAvatar)
{
// Change avatar skin color
KMsgSET_COLORIZE msg;
msg.color[0] = 0;
msg.color[1] = m_dwSkinColor; // Use only the second one
msg.color[2] = 0;
msg.color[3] = 0;
switch (nMode)
{
case 0:
msg.nMode = K3DTexture::COLORIZED_DEF; break;
case 1:
msg.nMode = K3DTexture::COLORIZED_KEEP_ALPHA; break;
case 2:
msg.nMode = K3DTexture::COLORIZED_USEALPHA; break;
}
// Since the part applying Deco Mesh was missing in the code below (2010.05.18), I created a new function. prodongi
KSeqAvatar* pAvatarPart = m_pAvatar->getAvatarPart(ANIPART_BIPED);
if (pAvatarPart)
{
std::set<int> ignoreMeshList;
ignoreMeshList.insert(MPART_HAIR);
pAvatarPart->PerformWithIgnoreMesh(id_SET_COLORIZE, msg, &ignoreMeshList);
ignoreMeshList.clear();
}
// Re-fix avatar hair alpha bug (ALPHABLENDTWOPASS)
// Do not apply alpha-based blending to the face mesh
KMsgSET_USE_TEXALPHA use_texalpha_msg;
use_texalpha_msg.bIsUseTexAlpha = false;
m_pAvatar->Perform(ANIPART_BIPED, MPART_FACE, id_SET_USE_TEXALPHA, use_texalpha_msg);
m_pAvatar->Perform(ANIPART_BIPED, MPART_BODY, id_SET_USE_TEXALPHA, use_texalpha_msg);
_CID(SET_BLENDMODE);
KMsgSET_BLENDMODE set_blend_mode;
set_blend_mode.blendMode = K3DMaterial::MBM_ALPHABLENDTWOPASS;
// Change avatar hair color
if (m_nHairColorIndex == 0)
{
_CID(SET_COLORIZE);
KMsgSET_COLORIZE msg;
msg.color[0] = 0;
msg.color[1] = m_dwHairColor; // Use only the second one
msg.color[2] = 0;
msg.color[3] = 0;
msg.nMode = K3DTexture::COLORIZED_GRAY;
m_pAvatar->Perform(ANIPART_BIPED, MPART_HAIR, id_SET_COLORIZE, msg);
}
else
{
setMaintainHairColorNewToOld(GetDefaultItemDB().GetHairID(GetHairIndex()), GetHairColorIndex(), GetRace(), GetSex(), m_pAvatar);
}
}
}
void SAvatarSelector::ReSet()
{
m_bUseProc = false;
m_bUseRot = false;
m_fTargetRoll = 1.f;
m_fPresentRoll = -1.f;
m_dwPrevTime = 0;
m_bIsPosBack = true;
m_bRotate = false;
m_bIsFront = false;
m_nStep = PROC_00;
}
bool SAvatarSelector::Process(DWORD time)
{
m_dwTime = time;
float fTime = (time - m_dwPrevTime) / 800.f;
if (!m_bSelectAvatar)
{
if (m_bUseProc)
{
switch (m_nStep)
{
case PROC_00:
if ((time - m_dwPrevTime) >= 500)
{
Ani_Walk();
m_dwPrevTime = m_dwTime;
m_nStep = PROC_01;
}
break;
case PROC_01:
{
_oprint("FTIME = %f\n", fTime);
if (fTime <= 1.f)
{
float roll, prevroll;
roll = fmod(m_fTargetRoll, 3.1415926f * 2); // x/y
prevroll = fmod(m_fPresentRoll, 3.1415926f * 2);
const float unitval = 3.1415926f / 12 * (time - m_dwPrevTime) / 66.f;
if (fabs(roll - prevroll) > fabs(roll - prevroll - 3.1415926f * 2))
prevroll += 3.1415926f * 2;
else if (fabs(roll - prevroll) > fabs(roll - prevroll + 3.1415926f * 2))
prevroll -= 3.1415926f * 2;
float minval = min(fabs(roll - prevroll), min(fabs(roll - prevroll + 3.1415926f * 2), fabs(roll - prevroll - 3.1415926f * 2)));
if ((roll > prevroll) && (minval > unitval))
m_fPresentRoll += unitval;
else if (roll > prevroll)
m_fPresentRoll = m_fTargetRoll;
if ((roll < prevroll) && (minval > unitval))
m_fPresentRoll -= unitval;
else if (roll < prevroll)
m_fPresentRoll = m_fTargetRoll;
K3DVector cur_pos;
K3DVectorLerp(cur_pos, m_vCurPos, m_vTarPos, fTime);
if (m_bUseRot)
{
K3DMatrix zRollMat;
K3DMatrixIdentity(zRollMat);
K3DMatrixRotationZ(zRollMat, m_fPresentRoll + 3.1415926f / 2);
// m_vView = K3DVector( 0.0f, 1.0f, 0.0f );
// K3DVectorTransform( m_vView, m_vView, zRollMat );
zRollMat._41 = cur_pos.x;
zRollMat._42 = cur_pos.y;
zRollMat._43 = cur_pos.z;
SetTransform(zRollMat);
if (m_fPresentRoll == m_fTargetRoll)
m_bUseRot = false;
}
else
{
//회전 유지
K3DMatrix mat = GetTransform();
mat._41 = cur_pos.x;
mat._42 = cur_pos.y;
mat._43 = cur_pos.z;
SetTransform(mat);
}
}
else
{
m_nStep = PROC_02;
m_bUseProc = false;
if (IsPosBack())
Ani_Default();
else
Ani_Idle();
if (m_bRotate)
{ //시간 갱신
m_dwPrevTime = m_dwTime;
}
}
}
break;
}
}
else
{
if (m_bRotate)
{ //180' 돈다
float roll, prevroll;
roll = fmod(m_fSecondRoll, 3.1415926f * 2); // x/y
prevroll = fmod(m_fPresentRoll, 3.1415926f * 2);
const float unitval = 3.1415926f / 12 * (time - m_dwPrevTime) / 66.f;
if (fabs(roll - prevroll) > fabs(roll - prevroll - 3.1415926f * 2))
prevroll += 3.1415926f * 2;
else if (fabs(roll - prevroll) > fabs(roll - prevroll + 3.1415926f * 2))
prevroll -= 3.1415926f * 2;
float minval = min(fabs(roll - prevroll), min(fabs(roll - prevroll + 3.1415926f * 2), fabs(roll - prevroll - 3.1415926f * 2)));
if ((roll > prevroll) && (minval > unitval))
m_fPresentRoll += unitval;
else if (roll > prevroll)
m_fPresentRoll = m_fSecondRoll;
if ((roll < prevroll) && (minval > unitval))
m_fPresentRoll -= unitval;
else if (roll < prevroll)
m_fPresentRoll = m_fSecondRoll;
K3DMatrix zRollMat;
K3DMatrixIdentity(zRollMat);
K3DMatrixRotationZ(zRollMat, m_fPresentRoll + 3.1415926f / 2);
zRollMat._41 = GetTransform()._41;
zRollMat._42 = GetTransform()._42;
zRollMat._43 = GetTransform()._43;
SetTransform(zRollMat);
if (m_fPresentRoll == m_fSecondRoll)
{
m_bRotate = false;
if (m_bIsPosBack == false)
m_bIsFront = true;
}
}
else
{
if (stricmp(m_pAvatar->GetCurrentAnimationName(), m_AniKey_Idle.c_str()) == 0 && !m_pAvatar->IsPlaying())
{
Ani_Default();
}
//Idle 모션 시작
//기본 동작 되돌아 오기
}
}
}
return m_pAvatar->Process(time);
}
void SAvatarSelector::AvatarRotate(float fValue, bool bAdd, bool bInit)
{
if (bInit) m_fSecondRoll = 0.0f;
K3DMatrix ResultMat;
K3DMatrixIdentity(ResultMat);
K3DMatrix zRollMat;
K3DMatrixIdentity(zRollMat);
if (bAdd) m_fSecondRoll += fValue;
else m_fSecondRoll -= fValue;
K3DMatrixRotationZ(zRollMat, m_fSecondRoll + 3.1415926f / 2);
K3DMatrix ScaleMat;
K3DMatrixIdentity(ScaleMat);
ScaleMat._11 = m_fScale; ScaleMat._22 = m_fScale; ScaleMat._33 = m_fScale;
K3DMatrixMultiply(ResultMat, ScaleMat, zRollMat);
K3DVector vPos = GetTransform().GetPosVector();
ResultMat.SetPosVector(vPos);
SetTransform(ResultMat);
}
void SAvatarSelector::SetHairIndex(int nHairIndex)
{
m_nHairIndex = GetValidNum(nHairIndex, GetDefaultItemDB().GetHairCount());
}
void SAvatarSelector::SetFaceIndex(int nFaceIndex)
{
m_nFaceIndex = GetValidNum(nFaceIndex, GetDefaultItemDB().GetFaceCount());
}
void SAvatarSelector::SetBodyIndex(int nBodyIndex)
{
m_nBodyIndex = GetValidNum(nBodyIndex, GetDefaultItemDB().GetBodyCount());
}
void SAvatarSelector::SetHandIndex(int nHandIndex)
{
m_nHandIndex = GetValidNum(nHandIndex, GetDefaultItemDB().GetHandCount());
}
void SAvatarSelector::SetFootIndex(int nFootIndex)
{
m_nFootIndex = GetValidNum(nFootIndex, GetDefaultItemDB().GetFootCount());
}
void SAvatarSelector::SetDecoIndex(int nDecoIndex)
{
m_nDecoIndex = GetValidNum(nDecoIndex, GetDefaultTextureResourceDB().GetTextureResourceCount());
}
bool SAvatarSelector::IsCollision(const K3DVertex& rVertex1, const K3DVertex& rVertex2) const
{
return m_pAvatar->GetBoundCube()->CheckCollision(rVertex1, rVertex2);
}
void SAvatarSelector::RefreshAvatar(bool bAniRefresh /*= true*/)
{
std::string strCobFileName = SStringDB::GetCobFileName(m_nRace, m_nSex);
strCobFileName += ".cob";
std::vector<COBSET* >* coblist = COBManager::GetManager()->Load(strCobFileName.c_str());
if (!coblist) return;
std::vector<COBSET* >::iterator it = coblist->begin();
m_pAvatar->ClearMesh();
if (bAniRefresh)
{
m_pAvatar->ClearAnimation();
for (; coblist->end() != it; it++)
{
COBSET* pSet = (*it);
for (size_t n(0); n < pSet->m_AniList.size(); ++n)
{
if (strstr(pSet->m_AniList[n].c_str(), "_default01") ||
strstr(pSet->m_AniList[n].c_str(), "_default02") ||
strstr(pSet->m_AniList[n].c_str(), "_idle01") ||
strstr(pSet->m_AniList[n].c_str(), "_emote") ||
strstr(pSet->m_AniList[n].c_str(), "_walk"))
m_pAvatar->AddAnimation(pSet->nAniPart, pSet->m_AniList[n].c_str());
}
}
_CID(SETBONEBLEND);
KMsgGET_SETBONEBLEND msg;
msg.bUseBlend = true;
m_pAvatar->Perform(id_SETBONEBLEND, msg);
}
// Handle face separately
std::string str = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_FACE]);
int nGroup = GetDefaultItemDB().GetDecoFaceGroupID(m_NudeCode[MODEL_INFO::NUDE_FACE]);
std::string strDeco = GetDefaultTextureResourceDB().GetTextureName(nGroup, GetDecoIndex(), GetRace(), GetSex());
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_FACE, str.c_str(), strDeco);
// Hair handled separately
str = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_HAIR]);
//m_pAvatar->AddMesh( ANIPART_HAIR, MPART_HAIR, str.c_str() );
nGroup = GetDefaultItemDB().GetDecoHairGroupID(m_NudeCode[MODEL_INFO::NUDE_HAIR]);
strDeco = GetDefaultTextureResourceDB().GetTextureName(nGroup, m_nHairColorIndex, GetRace(), GetSex());
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_HAIR, str.c_str(), strDeco);
m_AniKey_Def = "una_default01";
m_AniKey_Act = "una_default02";
m_AniKey_Walk = "una_walk";
m_AniKey_Idle = "una_idle01";
for (int i(0); ItemBase::WEAR_FACE >= i; i++) // Basic equipment includes everything up to WEAR_FACE
{
std::string strItemName;
std::string strAdditionalTexture;
std::string strAdditionalDecoTexture; /// 2011.06.28 mantis 13327 - prodongi
// const char * pFileName = NULL;
int nItemClass = 0;
if (m_WearCode[i] == 0)
{
if (i == ItemBase::WEAR_BOOTS) { strItemName = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_FOOT]); }
else if (i == ItemBase::WEAR_GLOVE) { strItemName = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_HAND]); }
else if (i == ItemBase::WEAR_ARMOR) { strItemName = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_BODY]); }
// else if( i == ItemBase::WEAR_HELM ) { strItemName = GetDefaultItemDB().GetFileName( m_nRace, m_nSex, m_NudeCode[MODEL_INFO::NUDE_HAIR] ); }
// else
// continue;
}
else if (m_WearCode[i] > 0 && m_WearCode[i] < 10000) //기본 Mesh
{
strItemName = GetDefaultItemDB().GetFileName(m_nRace, m_nSex, m_WearCode[i]);
nItemClass = 0;
}
else // Item
{
// TODO: Weapon EnhanceLevel needed for equipping; Temporarily set to Level 1; Update after server message change is completed
int nGroup = GetItemDB().GetGroup(m_WearCode[i]);
if (nGroup != ItemBase::GROUP_BULLET) // If not ammunition
{
strItemName = GetItemDB().GetFileName(m_nRace, m_nSex, m_WearCode[i], m_nItemLevel[i]);
strItemName += ".nx3";
nItemClass = GetItemDB().GetClassID(m_WearCode[i]);
strAdditionalTexture = GetItemDB().GetAdditionalTexture(m_WearCode[i]);
}
}
switch (nItemClass)
{
case ItemBase::CLASS_ETCWEAPON:
case ItemBase::CLASS_ONEHAND_SWORD:
case ItemBase::CLASS_SHIELD: // Attempt to equip one-handed sword while shield is equipped
case ItemBase::CLASS_ONEHAND_AXE:
{
m_AniKey_Def = "swo_default01";
m_AniKey_Act = "swo_default02";
m_AniKey_Walk = "swo_walk";
m_AniKey_Idle = "swo_idle01";
break;
}
case ItemBase::CLASS_DAGGER:
{
m_AniKey_Def = "dgo_default01";
m_AniKey_Act = "dgo_default02";
m_AniKey_Walk = "dgo_walk";
m_AniKey_Idle = "dgo_idle01";
break;
}
case ItemBase::CLASS_TWOHAND_SWORD:
m_AniKey_Def = "swa_default01";
m_AniKey_Act = "swa_default02";
m_AniKey_Walk = "swa_walk";
m_AniKey_Idle = "swa_idle01";
break;
case ItemBase::CLASS_TWOHAND_SPEAR:
{
m_AniKey_Def = "spa_default01";
m_AniKey_Act = "spa_default02";
m_AniKey_Walk = "spa_walk";
m_AniKey_Idle = "spa_idle01";
break;
}
case ItemBase::CLASS_TWOHAND_AXE:
{
if (m_nRace == GCLAN_GAIA && m_nSex == SEX_FEMALE)
{
m_AniKey_Def = "axa_default01";
m_AniKey_Act = "swa_default02";
m_AniKey_Walk = "axa_walk";
m_AniKey_Idle = "axa_idle01";
}
else
{
m_AniKey_Def = "swa_default01";
m_AniKey_Act = "swa_default02";
m_AniKey_Walk = "swa_walk";
m_AniKey_Idle = "swa_idle01";
}
break;
}
case ItemBase::CLASS_ONEHAND_MACE:
{
m_AniKey_Def = "swo_default01";
m_AniKey_Act = "swo_default02";
m_AniKey_Walk = "swo_walk";
m_AniKey_Idle = "swo_idle01";
break;
}
case ItemBase::CLASS_TWOHAND_MACE: // ANICLS_SWA; 107; Two-handed mace (resource to be added later)
{
m_AniKey_Def = "swa_default01";
m_AniKey_Act = "swa_default02";
m_AniKey_Walk = "swa_walk";
m_AniKey_Idle = "swa_idle01";
break;
}
case ItemBase::CLASS_LIGHT_BOW:
case ItemBase::CLASS_HEAVY_BOW:
{
m_AniKey_Def = "bwa_default01";
m_AniKey_Act = "bwa_default02";
m_AniKey_Walk = "bwa_walk";
m_AniKey_Idle = "bwa_idle01";
break;
}
case ItemBase::CLASS_CROSSBOW:
{
m_AniKey_Def = "cba_default01";
m_AniKey_Act = "cba_default02";
m_AniKey_Walk = "cba_walk";
m_AniKey_Idle = "cba_idle01";
break;
}
//case ItemBase::CLASS_DOUBLE_CROSSBOW: // AziaMafia Double crossbow
//{
// m_AniKey_Def = "cbt_default01";
// m_AniKey_Act = "cbt_default02";
// m_AniKey_Walk = "cbt_default01";
// m_AniKey_Idle = "cbt_default01";
// break;
//}
case ItemBase::CLASS_ONEHAND_STAFF: // ANICLS_SFO; 110; One-handed staff (resource to be added later)
{
m_AniKey_Def = "swo_default01";
m_AniKey_Act = "swo_default02";
m_AniKey_Walk = "swo_walk";
m_AniKey_Idle = "swo_idle01";
break;
}
case ItemBase::CLASS_TWOHAND_STAFF: // ANICLS_SFA; 111; Two-handed staff (resource to be added later)
{
m_AniKey_Def = "spa_default01";
m_AniKey_Act = "spa_default02";
m_AniKey_Walk = "spa_walk";
m_AniKey_Idle = "spa_idle01";
break;
}
}
switch (i)
{
case ItemBase::WEAR_LEFTHAND:
{
switch (nItemClass)
{
case ItemBase::CLASS_ONEHAND_SWORD:
case ItemBase::CLASS_ONEHAND_AXE:
{
m_AniKey_Def = "swt_default01";
m_AniKey_Act = "swt_default02";
m_AniKey_Walk = "swt_walk";
m_AniKey_Idle = "swt_idle01";
//break;
}
case ItemBase::CLASS_DAGGER:
{
m_AniKey_Def = "swt_default01";
m_AniKey_Act = "swt_default02";
m_AniKey_Walk = "swt_walk";
m_AniKey_Idle = "swt_idle01";
//break;
}
case ItemBase::CLASS_CROSSBOW:
{
m_AniKey_Def = "cbt_default01";
m_AniKey_Act = "cbt_default02";
m_AniKey_Walk = "cbt_walk";
m_AniKey_Idle = "cbt_idle01";
//break;
}
//case ItemBase::CLASS_DOUBLE_CROSSBOW: // AziaMafia Double crossbow
//{
// m_AniKey_Def = "cbt_default01";
// m_AniKey_Act = "cbt_default02";
// m_AniKey_Walk = "cbt_default01";
// m_AniKey_Idle = "cbt_default01";
// break;
//}
}
break;
}
case ItemBase::WEAR_RIGHTHAND:
{
if (nItemClass == 0)
{
m_AniKey_Def = "una_default01";
m_AniKey_Act = "una_default02";
m_AniKey_Walk = "una_walk";
m_AniKey_Idle = "una_idle01";
}
break;
}
}
int nLeftItemClass = GetItemDB().GetClassID(m_WearCode[ItemBase::WEAR_LEFTHAND]);
if (nLeftItemClass == ItemBase::CLASS_ONEHAND_SWORD || nLeftItemClass == ItemBase::CLASS_DAGGER || nLeftItemClass == ItemBase::CLASS_ONEHAND_AXE)
{
m_AniKey_Def = "swt_default01";
m_AniKey_Act = "swt_default02";
m_AniKey_Walk = "swt_walk";
m_AniKey_Idle = "swt_idle01";
}
else if (nLeftItemClass == ItemBase::CLASS_CROSSBOW) // From ZONE source; dual crossbows
{
m_AniKey_Def = "cbt_default01";
m_AniKey_Act = "cbt_default02";
m_AniKey_Walk = "cbt_walk";
m_AniKey_Idle = "cbt_idle01";
}
bool bAddMesh = false;
bool bWithDecoItem = false;
bool bAttachDecoItem = false;
std::string strDecoFileName;
ItemBase::ItemWearType nDecoWearType = ItemBase::WEAR_NONE;
switch (i)
{
case ItemBase::WEAR_WEAPON: nDecoWearType = ItemBase::WEAR_DECO_WEAPON; break;
case ItemBase::WEAR_SHIELD: nDecoWearType = ItemBase::WEAR_DECO_SHIELD; break;
case ItemBase::WEAR_ARMOR: nDecoWearType = ItemBase::WEAR_DECO_ARMOR; break;
case ItemBase::WEAR_HELM: nDecoWearType = ItemBase::WEAR_DECO_HELM; break;
case ItemBase::WEAR_GLOVE: nDecoWearType = ItemBase::WEAR_DECO_GLOVE; break;
case ItemBase::WEAR_BOOTS: nDecoWearType = ItemBase::WEAR_DECO_BOOTS; break;
case ItemBase::WEAR_MANTLE: nDecoWearType = ItemBase::WEAR_DECO_MANTLE; break;
}
if (nDecoWearType != ItemBase::WEAR_NONE)
{
if (m_WearCode[nDecoWearType] != 0)
{
//if( GetGameOption().GetAvatarDeco() == 1 ) // 2010.10.11. 게임플레이옵션에서 "꾸미기보이기" 제거.
//{
strDecoFileName = GetItemDB().GetFileName(m_nRace, m_nSex, m_WearCode[nDecoWearType], m_nItemLevel[nDecoWearType]);
strDecoFileName += ".nx3";
bAttachDecoItem = GetItemDB().GetDecoModelChange(m_WearCode[nDecoWearType]);
/// 2011.06.28 mantis 13327 - prodongi
strAdditionalDecoTexture = GetItemDB().GetAdditionalTexture(m_WearCode[nDecoWearType]);
bWithDecoItem = true;
//y}
}
}
int nAniIndex = 0;
switch (i)
{
case ItemBase::WEAR_LEFTHAND:
{
if (nItemClass == ItemBase::CLASS_SHIELD)
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_SHIELD)) // 꾸미기방패.
{
if (bAttachDecoItem) bAddMesh = true;
m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L_DECO, strDecoFileName.c_str());
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L, strItemName.c_str(), strAdditionalTexture); //방패
}
m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, ""); //왼손에 장착 된거 사라지게
}
else if (nItemClass == ItemBase::CLASS_ONEHAND_SWORD || nItemClass == ItemBase::CLASS_DAGGER || nItemClass == ItemBase::CLASS_ONEHAND_AXE)
{ //이도류
std::string strFile = strItemName;
if (strFile.length() > 5) strFile.replace(strFile.size() - 4, 1, "_L.");
std::string strDecoFile = strDecoFileName;
if (strDecoFile.length() > 5) strDecoFile.replace(strDecoFile.size() - 4, 1, "_L.");
m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L, ""); //방패 사라지게
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_SHIELD)) // 꾸미기방패.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
//m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strDecoFile.c_str(), strAdditionalDecoTexture);
// From ZONE source; dual crossbows
if (nItemClass == ItemBase::CLASS_CROSSBOW)
{
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
//m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, strFile.c_str(), strAdditionalTexture); //왼손에 장착 된거 사라지게
// From ZONE source; dual crossbows
if (nItemClass == ItemBase::CLASS_CROSSBOW)
{
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strItemName.c_str(), strAdditionalTexture);
}
else
{
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strFile.c_str(), strAdditionalTexture);
}
}
}
else
{
//if (m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_LIGHT_BOW &&
// m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_HEAVY_BOW
// // AziaMafia Double Crossbow
// // && m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_CROSSBOW
// )
// From ZONE source; dual crossbows
if (m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_LIGHT_BOW &&
<<<<<<< HEAD
m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_HEAVY_BOW &&
m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_CROSSBOW
) //Double Crossbow
=======
m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_HEAVY_BOW)// &&
//m_WearCode[ItemBase::WEAR_WEAPON] != ItemBase::CLASS_CROSSBOW)// From ZONE source; dual crossbows
>>>>>>> a34328224e914a577b99c79ec6e8ffbcea554a05
{
{
int nGroup = GetItemDB().GetGroup(m_WearCode[i]);
if (nGroup != ItemBase::GROUP_BULLET) //탄환이 아니면
{
//삭제 하기 위함.
m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L, ""); //방패
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_SHIELD)) // 꾸미기방패.
{
if (bAttachDecoItem) bAddMesh = true;
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture); //그냥 왼손
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, strItemName.c_str(), strAdditionalTexture); //그냥 왼손
}
}
}
}
}
break; // Item Link 왼손전용 (방패라던가)
}
case ItemBase::WEAR_RIGHTHAND:
{
if (nItemClass == ItemBase::CLASS_LIGHT_BOW || nItemClass == ItemBase::CLASS_HEAVY_BOW)
{
m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L, ""); //방패 사라지게 한다.
m_pAvatar->AddMesh(ANIPART_WEAPON_RIGHT, MPART_R_WEAPON, ""); //오른손 사라지게 한다.
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_WEAPON)) // 꾸미기무기.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_LEFT, MDECOPART_L_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, strItemName.c_str(), strAdditionalTexture); //왼손에 활 장착
}
}
else if (nItemClass == ItemBase::CLASS_CROSSBOW)
{
// From ZONE source; dual crossbows
//m_pAvatar->AddAttachItem(ANIPART_BIPED, ATTACH_HAND_ARM2L, ""); //방패 사라지게 한다.
//m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, ""); //왼손 사라지게 한다.
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_WEAPON)) // 꾸미기무기.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_RIGHT, MDECOPART_R_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
m_pAvatar->AddMesh(ANIPART_WEAPON_RIGHT, MPART_R_WEAPON, strItemName.c_str(), strAdditionalTexture); //오른손에 활 장착
}
}
else
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_WEAPON)) // 꾸미기무기.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_WEAPON_RIGHT, MDECOPART_R_WEAPON, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
m_pAvatar->AddMesh(ANIPART_WEAPON_RIGHT, MPART_R_WEAPON, strItemName.c_str(), strAdditionalTexture);
}
}
}
break;
//Skin 변경
case ItemBase::WEAR_ARMOR:
{
std::string strTemp = strItemName;
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_ARMOR)) // 꾸미기의상.
{
if (bAttachDecoItem) bAddMesh = true;
// { sonador 1.8.1 액세서리 확장 표현 슬롯 추가
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_BODY, strDecoFileName.c_str(), strAdditionalDecoTexture); /// 2011.06.28 mantis 13327 - prodongi
strTemp = strDecoFileName.c_str();
XStringUtil::Replace(strTemp, "body", "shortskirt");
m_pAvatar->AddMesh(ANIPART_SHORTSKIRT, MDECOPART_S_SKIRT, strTemp.c_str()); // 짧은 치마
strTemp = strDecoFileName.c_str();
XStringUtil::Replace(strTemp, "body", "middleskirt");
m_pAvatar->AddMesh(ANIPART_MIDSKIRT, MDECOPART_M_SKIRT, strTemp.c_str()); // 중 치마
strTemp = strDecoFileName.c_str();
XStringUtil::Replace(strTemp, "body", "long");
m_pAvatar->AddMesh(ANIPART_LONGSKIRT, MDECOPART_L_SKIRT, strTemp.c_str()); // 긴 치마
strTemp = strDecoFileName.c_str();
// }
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
//몸통과 일체형인데, 어떤 것이 올지 모르기 때문에, 모두 찾는다. 몸통과 치마류는 1:1 대응임.
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_BODY, strItemName.c_str(), strAdditionalTexture); // 몸
XStringUtil::Replace(strTemp, "body", "shortskirt");
m_pAvatar->AddMesh(ANIPART_SHORTSKIRT, MPART_S_SKIRT, strTemp.c_str(), strAdditionalTexture); // 짧은 치마
strTemp = strItemName;
XStringUtil::Replace(strTemp, "body", "fabric");
m_pAvatar->AddMesh(ANIPART_FABRIC, MPART_FABRIC, strTemp.c_str(), strAdditionalTexture); // 앞가리개
strTemp = strItemName;
XStringUtil::Replace(strTemp, "body", "middleskirt");
m_pAvatar->AddMesh(ANIPART_MIDSKIRT, MPART_M_SKIRT, strTemp.c_str(), strAdditionalTexture); // 중 치마
strTemp = strItemName;
XStringUtil::Replace(strTemp, "body", "long");
m_pAvatar->AddMesh(ANIPART_LONGSKIRT, MPART_L_SKIRT, strTemp.c_str(), strAdditionalTexture); // 긴 치마
}
}
break;
case ItemBase::WEAR_HELM: // 머리 MPART_FACE =
{
// 2010.05.20 - prodongi
//if (!isHideEquipInfo(ItemBase::HIDE_EQUIP_HELM))
// gmpbigsun(20131029, #26286) : 로비랑 인게임에서 투구보임관련 로직 같게 수정
if (!isHideEquipInfo(ItemBase::HIDE_EQUIP_HELM) || isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_HELM))
{
const ItemBaseEx_info* pItemInfo = NULL;
bool bHideHair = false;
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_HELM)) // 꾸미기투구.
{
if (bAttachDecoItem) bAddMesh = true;
else
{
bHideHair = true;
pItemInfo = GetItemDB().GetItemData(m_WearCode[nDecoWearType]);
}
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_HELM, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
{
//헬멧이 제대로 들어가면
bHideHair = m_pAvatar->AddMesh(ANIPART_BIPED, MPART_HELM, strItemName.c_str(), strAdditionalTexture);
pItemInfo = GetItemDB().GetItemData(m_WearCode[i]);
}
if (pItemInfo)
{
int nFlag = getHelmItemModelType(GetRace(), GetSex(), pItemInfo);
// sonador #2.1.22
if (bHideHair)
{
if ((nFlag & ItemBaseEx_info::HAIR_FLAG) == ItemBaseEx_info::HAIR_FLAG) // 헤어를 숨김, floyd 2008. 12. 17 플래그 비교를 명확히!
//m_pAvatar->AddMesh( ANIPART_HAIR, MPART_HAIR, "hide_hair" );
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_HAIR, "hide_hair");
if ((nFlag & ItemBaseEx_info::FACE_FLAG) == ItemBaseEx_info::FACE_FLAG) // 페이스 숨김, floyd 2008. 12. 17 플래그 비교를 명확히!
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_FACE, "hide_face");
// 2010.08.16 - prodongi
if (nFlag & ItemBaseEx_info::EARRING_FLAG) // 귀걸이 숨김
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EAR, "hide_earring");
}
}
}
}
break;
case ItemBase::WEAR_GLOVE: // 손
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_GLOVE)) // 꾸미기장갑.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_HAND, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_HAND, strItemName.c_str(), strAdditionalTexture);
}
break;
case ItemBase::WEAR_BOOTS: // 발
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_BOOTS)) // 꾸미기부츠.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_FOOT, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_FOOT, strItemName.c_str(), strAdditionalTexture);
}
break;
case ItemBase::WEAR_MANTLE:
{
if (GetGameOption().IsShowMantle()) //망토 보이기 옵션에 따른 리소스 추가
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_CLOAK)) // 꾸미기망토.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_MANTLE, MDECOPART_MANTLE, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh)
m_pAvatar->AddMesh(ANIPART_MANTLE, MPART_MANTLE, strItemName.c_str(), strAdditionalTexture);
}
}
break; // 망토
case ItemBase::WEAR_EAR: //귀
if (GameRule::GetCurrentLocalBitSet() != GameRule::LOCAL_BITSET::ME) // 귀걸이 감추기. 무슬림 국가에서는 다 막아야 할 듯. 일단 중동만
{
// 2010.08.16 - prodongi
// 투구를 착용 했을 경우에 투구의 "투구 모델 적용 타입"에 따라서 귀걸이 적용/비적용을 결정한다
bool renderEarring = true;
KSeqAvatar* seqAvatar = m_pAvatar->getAvatarPart(ANIPART_BIPED);
if (seqAvatar->isRenderMesh(MPART_HELM))
{
ItemBaseEx_info const* pItemInfo = GetItemDB().GetItemData(m_WearCode[ItemBase::WEAR_HELM]);
if (pItemInfo)
{
int flag = getHelmItemModelType(GetRace(), GetSex(), pItemInfo);
if (ItemBaseEx_info::EARRING_FLAG & flag)
{
renderEarring = false;
}
}
}
if (renderEarring)
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EAR, strItemName.c_str(), strAdditionalTexture);
else
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EAR, "hide_earring");
//m_pAvatar->AddMesh( ANIPART_BIPED , MPART_ACCE_EAR , strItemName.c_str(), strAdditionalTexture );
}
break;
case ItemBase::WEAR_ARMULET: // Necklace
m_pAvatar->AddMesh(ANIPART_NECKLACE, MPART_ACCE_NECK, strItemName.c_str(), strAdditionalTexture);
break;
case ItemBase::WEAR_FACE:
{
if (!isHideEquipInfo(ItemBase::HIDE_EQUIP_HELM))
//if( GetGameOption().IsShowHelm() ) // Add resources based on helmet visibility option
{
const ItemBaseEx_info* pItemInfo = GetItemDB().GetItemData(m_WearCode[i]);
if (pItemInfo)
{
int nFlag = getHelmItemModelType(GetRace(), GetSex(), pItemInfo);
if ((nFlag & ItemBaseEx_info::HAIR_FLAG) == ItemBaseEx_info::HAIR_FLAG) //투구가 있을 경우, 투구로 대체, floyd 2008. 12. 17 플래그 비교를 명확히!
{
if (m_pAvatar->IsExistMesh(ANIPART_BIPED, MPART_HELM) == 0 &&
m_pAvatar->IsExistDecoMesh(ANIPART_BIPED, MDECOPART_HELM) == 0)
{ //투구가 없으므로, 가면 추가
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EYE, strItemName.c_str(), strAdditionalTexture);
}
}
else
{
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EYE, strItemName.c_str(), strAdditionalTexture);
}
}
}
else
{ //투구 안 보일 경우에는 무조건 표시
m_pAvatar->AddMesh(ANIPART_BIPED, MPART_ACCE_EYE, strItemName.c_str(), strAdditionalTexture);
}
}
break; //눈
// case ItemBase::WEAR_MOUTH : m_pAvatar->AddMesh( ANIPART_BIPED , MPART_ACCE_LIP , strItemName.c_str(), strAdditionalTexture ); break; //입 MPART_ACCESS
//예외
// case ItemBase::WEAR_EAR_EYE : m_pAvatar->AddMesh( ANIPART_BIPED, MPART_ACCE_EAR , strItemName.c_str(), strAdditionalTexture ); break; // 귀+눈
// case ItemBase::WEAR_EAR_MOUTH : m_pAvatar->AddMesh( ANIPART_BIPED, MPART_ACCE_EAR , strItemName.c_str(), strAdditionalTexture ); break; // 귀+입
// case ItemBase::WEAR_EYE_MOUTH : m_pAvatar->AddMesh( ANIPART_BIPED, MPART_ACCE_EYE , strItemName.c_str(), strAdditionalTexture ); break; // 눈+입
// case ItemBase::WEAR_EYE_EAR_MOUTH : m_pAvatar->AddMesh( ANIPART_BIPED, MPART_ACCE_EYE , strItemName.c_str(), strAdditionalTexture ); break; // 눈+귀+입
// case ItemBase::WEAR_TWOFINGER_RING : m_pAvatar->AddMesh( ); break; // 반지 두칸 소모
//보이는거 아님
case ItemBase::WEAR_BELT: break; //
case ItemBase::WEAR_RING: break; //
case (ItemBase::WEAR_RING + 1): break; //
//Link 예외//= 108,// 활//= 109,// 석궁
case ItemBase::WEAR_TWOHAND: m_pAvatar->AddMesh(ANIPART_WEAPON_LEFT, MPART_L_WEAPON, strItemName.c_str(), strAdditionalTexture); //그냥 왼손
break;
//새로 추가됨
case ItemBase::WEAR_BACKPACK: //어깨
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::HIDE_EQUIP_SHOULDER)) // 꾸미기어깨.
{
if (bAttachDecoItem) bAddMesh = true;
/// 2011.06.28 mantis 13327 - prodongi
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_SHOULDER2, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
else
{
bAddMesh = true;
}
if (bAddMesh) m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_SHOULDER2, strItemName.c_str(), strAdditionalTexture);
break;
}
case ItemBase::WEAR_DECO_SHOULDER: //어깨
{
if (bWithDecoItem && isHideEquipInfo(ItemBase::DECO_HIDE_EQUIP_SHOULDER)) // 꾸미기어깨.
{
m_pAvatar->AddDecoMesh(ANIPART_BIPED, MDECOPART_SHOULDER, strDecoFileName.c_str(), strAdditionalDecoTexture);
}
break;
}
}
}
PlayAnimation(m_AniKey_Def.c_str());
m_bRefresh = true;
}
void SAvatarSelector::Ani_Default()
{
if (m_AniKey_Def.length())
PlayAnimation(m_AniKey_Def.c_str());
}
void SAvatarSelector::Ani_Attack(int nPlayType /*= KSeqForm::SEQTYPE_LOOP*/)
{
if (m_AniKey_Act.length())
PlayAnimation(m_AniKey_Act.c_str(), nPlayType);
}
void SAvatarSelector::Ani_Walk()
{
if (m_AniKey_Walk.length())
PlayAnimation(m_AniKey_Walk.c_str());
}
void SAvatarSelector::Ani_Idle()
{
if (GetRace() == GCLAN_DEVA)
{
if (GetSex() == SEX_MALE)
m_AniKey_Idle = "emote_apologize";
else if (GetSex() == SEX_FEMALE)
m_AniKey_Idle = "emote_apologize";
}
else if (GetRace() == GCLAN_ASURA)
{
if (GetSex() == SEX_MALE)
m_AniKey_Idle = "bwa_idle01";
else if (GetSex() == SEX_FEMALE)
m_AniKey_Idle = "bwa_idle01";
}
else if (GetRace() == GCLAN_GAIA)
{
if (GetSex() == SEX_MALE)
m_AniKey_Idle = "emote_bow";
else if (GetSex() == SEX_FEMALE)
m_AniKey_Idle = "axa_idle01";
}
PlayAnimation(m_AniKey_Idle.c_str(), SEQTYPE_NORMAL);
}
bool SAvatarSelector::IsDefaultAni()
{
if (stricmp(m_pAvatar->GetCurrentAnimationName(), m_AniKey_Def.c_str()) == 0 ||
stricmp(m_pAvatar->GetCurrentAnimationName(), m_AniKey_Idle.c_str()) == 0)
return true;
return false;
}
void SAvatarSelector::SetRotate(bool bRotate, const K3DVector& dpos, const K3DVector& tpos, bool bTime, bool bFlag)
{
m_bRotate = bRotate;
if (m_bRotate)
{
m_fSecondRoll = atan2(tpos.y - dpos.y, tpos.x - dpos.x);
if (bTime)
m_dwPrevTime = m_dwTime;
}
if (bFlag)
{
m_nStep = PROC_01;
Ani_Walk();
}
else
{
if (!IsPosBack())
m_nStep = PROC_00;
else
m_nStep = PROC_01;
}
}
void SAvatarSelector::SetMoveInfo(const K3DVector& tpos)
{
m_vTarPos = tpos;
m_vCurPos = GetTransform().GetPosVector();
m_fTargetRoll = atan2(tpos.y - m_vCurPos.y, tpos.x - m_vCurPos.x);
m_bUseRot = true;
m_dwPrevTime = m_dwTime;
m_bUseProc = true;
}
void SAvatarSelector::PlayAnimation(const char* pAniKey, int nPlayType /*= KSeqForm::SEQTYPE_LOOP*/)
{
if (!m_pAvatar) return;
m_pAvatar->PlayAnimation(ANIPART_BIPED, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_HAIR, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_NECKLACE, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_SHORTSKIRT, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_MIDSKIRT, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_LONGSKIRT, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_FABRIC, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_WEAPON_LEFT, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_WEAPON_RIGHT, m_dwTime, pAniKey, nPlayType);
m_pAvatar->PlayAnimation(ANIPART_MANTLE, m_dwTime, pAniKey, nPlayType);
m_pAvatar->SetDeform(ANIPART_BIPED);
m_pAvatar->SetAttachBone();
}
void* SAvatarSelector::AvatarPerform(int nAniIndex, int nMeshIndex, KID id, KArg& msg)
{
if (m_pAvatar)
return m_pAvatar->Perform(nAniIndex, nMeshIndex, id, msg);
return NULL;
}
LOBBY_AVATAR::LOBBY_AVATAR()
: pAvatar(NULL), pEffect(NULL), pEffect2(NULL), EffectState(EFFECTSTATE_NONE), EffectState2(EFFECTSTATE_NONE) {
}
LOBBY_AVATAR::~LOBBY_AVATAR()
{
SAFE_DELETE(pAvatar);
SAFE_DELETE(pEffect);
SAFE_DELETE(pEffect2);
}
void LOBBY_AVATAR::PlayEffect(int nIndex, DWORD dwTime, LOBBYAVATAR_EFFECTSTATE state)
{
if (nIndex == 0)
{
EffectState = state;
switch (EffectState)
{
case EFFECTSTATE_SELECT_START: pEffect->PlayAnimation(dwTime, c_szSelectStartAniName); break;
case EFFECTSTATE_SELECT_LOOP: pEffect->PlayAnimation(dwTime, c_szSelectLoopAniName, KSeqForm::SEQTYPE_LOOP); break;
case EFFECTSTATE_SELECT_END: pEffect->PlayAnimation(dwTime, c_szSelectEndAniName); break;
case EFFECTSTATE_UNSELECT_START: pEffect->PlayAnimation(dwTime, c_szUnselectStartAniName); break;
case EFFECTSTATE_UNSELECT_LOOP: pEffect->PlayAnimation(dwTime, c_szUnselectLoopAniName, KSeqForm::SEQTYPE_LOOP); break;
case EFFECTSTATE_UNSELECT_END: pEffect->PlayAnimation(dwTime, c_szUnselectEndAniName); break;
}
}
else
{
EffectState2 = state;
switch (EffectState2)
{
case EFFECTSTATE_SELECT_START: pEffect2->PlayAnimation(dwTime, c_szSelectStartAniName); break;
case EFFECTSTATE_SELECT_LOOP: pEffect2->PlayAnimation(dwTime, c_szSelectLoopAniName, KSeqForm::SEQTYPE_LOOP); break;
case EFFECTSTATE_SELECT_END: pEffect2->PlayAnimation(dwTime, c_szSelectEndAniName); break;
case EFFECTSTATE_UNSELECT_START: pEffect2->PlayAnimation(dwTime, c_szUnselectStartAniName); break;
case EFFECTSTATE_UNSELECT_LOOP: pEffect2->PlayAnimation(dwTime, c_szUnselectLoopAniName, KSeqForm::SEQTYPE_LOOP); break;
case EFFECTSTATE_UNSELECT_END: pEffect2->PlayAnimation(dwTime, c_szUnselectEndAniName); break;
}
}
}
bool CLobbyNoticeReceiver::onProcess(int nThreadNum)
{
int nGetSize = XInternet::GetFile(m_strURL.c_str(), m_pBuffer, m_dwBufSize);
if ((-1) != nGetSize)
{
m_pBuffer[nGetSize] = '\0';
m_strNotice = m_pBuffer;
}
m_bFinished = true;
return true;
}
void CreateNewAvatar(SGame* pGame, const char* szName, SAvatarSelector* pNewAvatar)
{
TS_CS_CREATE_CHARACTER msgCreateChar;
// memset( &msgCreateChar, 0, sizeof(TS_CS_CREATE_CHARACTER) );
msgCreateChar.info.sex = pNewAvatar->GetSex();
assert(msgCreateChar.info.sex && "Gender (sex) cannot be 0!");
msgCreateChar.info.race = pNewAvatar->GetRace();
msgCreateChar.info.level = 1;
msgCreateChar.info.job = 0;
msgCreateChar.info.permission = 0;
msgCreateChar.info.is_banned = false;
msgCreateChar.info.skin_color = pNewAvatar->GetSkinColorized();
msgCreateChar.info.model_id[0] = GetDefaultItemDB().GetHairID(pNewAvatar->GetHairIndex());
msgCreateChar.info.model_id[1] = GetDefaultItemDB().GetFaceID(pNewAvatar->GetFaceIndex());
msgCreateChar.info.model_id[2] = GetDefaultItemDB().GetInnerID(0); //속옷
msgCreateChar.info.model_id[3] = GetDefaultItemDB().GetHandID(pNewAvatar->GetHandIndex());
msgCreateChar.info.model_id[4] = GetDefaultItemDB().GetFootID(pNewAvatar->GetFootIndex());
msgCreateChar.info.texture_id = pNewAvatar->GetDecoIndex();
msgCreateChar.info.hair_color_index = pNewAvatar->GetHairColorIndex();
msgCreateChar.info.hair_color_rgb = pNewAvatar->GetHairColorRGB();
msgCreateChar.info.wear_info[ItemBase::WEAR_ARMOR] = GetDefaultItemDB().GetBodyID(pNewAvatar->GetBodyIndex()); //기본 의상
msgCreateChar.info.name[18] = '\0';
::strncpy(msgCreateChar.info.name, szName, 18);
pGame->PendMessage(&msgCreateChar);
}
void LoginAccount(SGame* pGame, const char* szAccount, __int64& one_time_key)
{
TS_CS_ACCOUNT_WITH_AUTH msgAccount_with_auth;
msgAccount_with_auth.account[GameRule::MAX_ACCOUNT_LEN] = '\0'; // #2.1.12
msgAccount_with_auth.one_time_key = one_time_key;
::strncpy(msgAccount_with_auth.account, szAccount, GameRule::MAX_ACCOUNT_LEN);
pGame->PendMessage(&msgAccount_with_auth);
}
void DeleteAvatar(SGame* pGame, const char* szName, const char* szSecurityNo)
{
//m_bFreezeSelect = true;
TS_CS_DELETE_CHARACTER msgDeleteChar;
msgDeleteChar.name[18] = '\0';
::strncpy(msgDeleteChar.name, szName, 18);
::strncpy(msgDeleteChar.security_no, szSecurityNo, 18);
pGame->PendMessage(&msgDeleteChar);
}
void CharacterLogin(SGame* pGame, const char* szName, int nRace)
{
TS_LOGIN msgLogin;
msgLogin.race = 0; //필요 없는 것임. 초기 개발 모드에서 사용.
msgLogin.szName[18] = '\0';
::strncpy(msgLogin.szName, szName, 18);
pGame->PendMessage(&msgLogin);
}