HRESULT GLCharacter::UpdateSuit( BOOL bChangeHair, BOOL bChangeFace )
{
GASSERT(m_pd3dDevice);
EMCHARINDEX emIndex = CharClassToIndex(m_emClass);
DxSkinCharData* pSkinChar = DxSkinCharDataContainer::GetInstance().FindData ( GLCONST_CHAR::szCharSkin[emIndex] );
if ( !pSkinChar ) return E_FAIL;
const GLCONST_CHARCLASS &sCONST = GLCONST_CHAR::cCONSTCLASS[emIndex];
if ( bChangeFace )
{
// ¾ó±¼
if ( sCONST.dwHEADNUM > m_wFace )
{
std::string strHEAD_CPS = sCONST.strHEAD_CPS[m_wFace];
PDXCHARPART pCharPart = NULL;
pCharPart = m_pSkinChar->GetPiece(PIECE_HEAD); // ÇöÀç ÀåÂø ½ºÅ².
if ( pCharPart && strcmp(strHEAD_CPS.c_str(),pCharPart->m_szFileName) )
{
m_pSkinChar->SetPiece ( strHEAD_CPS.c_str(), m_pd3dDevice, 0x0, 0, TRUE );
}
}
}
// Çì¾î½ºÅ¸ÀÏ
if( bChangeHair )
{
if ( sCONST.dwHAIRNUM > m_wHair )
{
std::string strHAIR_CPS = sCONST.strHAIR_CPS[m_wHair];
PDXCHARPART pCharPart = NULL;
pCharPart = m_pSkinChar->GetPiece(PIECE_HAIR); // ÇöÀç ÀåÂø ½ºÅ².
if ( pCharPart && strcmp(strHAIR_CPS.c_str(),pCharPart->m_szFileName) )
{
m_pSkinChar->SetPiece ( strHAIR_CPS.c_str(), m_pd3dDevice, 0x0, 0, TRUE );
}
}
}
m_pSkinChar->SetHairColor( m_wHairColor );
// ÀåÂøÇÑ ¾ÆÀÌÅÛ ¾÷µ¥ÀÌÆ®
for ( int i=0; i<SLOT_NSIZE_S_2; i++ )
{
// ÇöÀç ÀåÂøÁßÀÎ ¹«±â°¡ ¾Æ´Ï¸é ³Ñ¾î°£´Ù.
if( !IsCurUseArm( EMSLOT(i) ) ) continue;
const SITEMCUSTOM &ItemCustom = m_PutOnItems[i];
// º¹Àå ¾ÆÀÌÅÛ
SNATIVEID nidITEM = ItemCustom.nidDISGUISE;
if ( nidITEM==SNATIVEID(false) ) nidITEM = ItemCustom.sNativeID;
if ( !m_bVehicle && i == SLOT_VEHICLE ) nidITEM = SNATIVEID(false);
else if ( m_bVehicle && i == SLOT_VEHICLE )
{
nidITEM = m_sVehicle.GetSkinID();
if ( nidITEM == SNATIVEID(false) )
{
m_sVehicle.m_sVehicleID = ItemCustom.sNativeID;
nidITEM = ItemCustom.sNativeID;
}
}
// À¯È¿ÇÏÁö ¾ÊÀ¸¸é
if ( nidITEM == SNATIVEID(false) )
{
// Note : ±âº» ½ºÅ²°ú Áö±Ý ÀåÂøµÈ ½ºÅ²ÀÌ Æ²¸± °æ¿ì.
// SLOT->PIECE.
PDXSKINPIECE pSkinPiece = NULL; // ±âº» ½ºÅ².
PDXCHARPART pCharPart = NULL; // ÇöÀç ÀåÂø ½ºÅ².
EMPIECECHAR emPiece = SLOT_2_PIECE(EMSLOT(i));
if ( emPiece!=PIECE_SIZE )
{
pSkinPiece = pSkinChar->GetPiece(emPiece); // ±âº» ½ºÅ².
pCharPart = m_pSkinChar->GetPiece(emPiece); // ÇöÀç ÀåÂø ½ºÅ².
}
if ( pSkinPiece )
{
if ( pCharPart && strcmp(pSkinPiece->m_szFileName,pCharPart->m_szFileName) )
m_pSkinChar->SetPiece ( pSkinPiece->m_szFileName, m_pd3dDevice, 0X0, 0, TRUE );
}
else
{
if ( pCharPart )
{
[COLOR=#FF0000]/////EXTRA FIX TO ERASE THE EFFECT WHEN YOU UNEQUIPED ITEM
if ( ( emPiece == PIECE_UPBODY || emPiece == PIECE_LOBODY || emPiece == PIECE_GLOVE || emPiece == PIECE_FOOT ) )
{
switch (emPiece)
{
case PIECE_UPBODY: m_pSkinChar->ResetPiece(PIECE_ELE01); break;
case PIECE_LOBODY: m_pSkinChar->ResetPiece(PIECE_ELE02); break;
case PIECE_GLOVE: m_pSkinChar->ResetPiece(PIECE_ELE03); break;
case PIECE_FOOT: m_pSkinChar->ResetPiece(PIECE_ELE04); break;
};
}
/////////////////////[/COLOR]
m_pSkinChar->ResetPiece(emPiece);
}
}
}
// À¯È¿Çϸé
else
{
SITEM* pItem = GLItemMan::GetInstance().GetItem ( nidITEM );
if ( pItem )
{
m_pSkinChar->SetPiece ( pItem->GetWearingFile(emIndex), m_pd3dDevice, NULL, ItemCustom.GETGRADE_EFFECT(), TRUE );
}
[COLOR=#FF0000]////////////THE EFFECT CODE SHOULD BE HERE
EMPIECECHAR emPiece = SLOT_2_PIECE(EMSLOT(i));
if ( ( emPiece == PIECE_UPBODY || emPiece == PIECE_LOBODY || emPiece == PIECE_GLOVE || emPiece == PIECE_FOOT ) )
{
switch (emPiece)
{
case PIECE_UPBODY: m_pSkinChar->ResetPiece(PIECE_ELE01); break;
case PIECE_LOBODY: m_pSkinChar->ResetPiece(PIECE_ELE02); break;
case PIECE_GLOVE: m_pSkinChar->ResetPiece(PIECE_ELE03); break;
case PIECE_FOOT: m_pSkinChar->ResetPiece(PIECE_ELE04); break;
};
if ( ItemCustom.GETGRADE_EFFECT() > 5 )
{
CString strEle, strSex, strPiece;
if( emSex == GLCC_MAN ) strSex = "m";
else strSex = "w";
switch (emPiece)
{
case PIECE_UPBODY: strPiece = "body"; break;
case PIECE_LOBODY: strPiece = "leg"; break;
case PIECE_GLOVE: strPiece = "hand"; break;
case PIECE_FOOT: strPiece = "foot"; break;
};
strEle.Format("%s_bs_%s_enchent+%d.cps", strSex, strPiece, ItemCustom.GETGRADE_EFFECT());
m_pSkinChar->SetPiece ( strEle, m_pd3dDevice, NULL, TRUE );
}
}
//////////////////////////////[/COLOR]
}
}
// Note : ½ºÅ³ ¹öÇÁ, »óÅÂÀÌ»ó È¿°ú »ý¼º.
FACTEFF::ReNewEffect ( STARGETID(CROW_PC,m_dwGaeaID,m_vPos), m_pSkinChar, m_sSKILLFACT, m_sSTATEBLOWS, m_matTrans, m_vDir );
if( GLCONST_CHAR::cCONSTCLASS[emIndex].strCLASS_EFFECT.size() != 0 )
{
DxEffcharDataMan::GetInstance().PutPassiveEffect ( m_pSkinChar, GLCONST_CHAR::cCONSTCLASS[emIndex].strCLASS_EFFECT.c_str(), &m_vDir );
}
if( m_dwTransfromSkill != SNATIVEID::ID_NULL )
{
PGLSKILL pSkill = GLSkillMan::GetInstance().GetData ( m_sSKILLFACT[m_dwTransfromSkill].sNATIVEID.wMainID, m_sSKILLFACT[m_dwTransfromSkill].sNATIVEID.wSubID );
if( pSkill )
{
for( BYTE i = 0; i < SKILL::EMTRANSFORM_NSIZE; i++ )
{
if( m_wSex == 1 )
{
m_pSkinChar->SetPiece ( pSkill->m_sSPECIAL_SKILL.strTransform_Man[i].c_str(), m_pd3dDevice, 0X0, 0, TRUE );
}else{
m_pSkinChar->SetPiece ( pSkill->m_sSPECIAL_SKILL.strTransform_Woman[i].c_str(), m_pd3dDevice, 0X0, 0, TRUE );
}
}
}
}
return S_OK;
}