Skip to content

Commit

Permalink
Armor Display fix
Browse files Browse the repository at this point in the history
Original contribution/credits is from OpenKO
  • Loading branch information
UTengine committed Jul 15, 2024
1 parent 1d152cc commit 2180b9d
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 33 deletions.
5 changes: 3 additions & 2 deletions src/game/GameBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ D3DCOLOR CGameBase::GetIDColorByLevelDifference(int iLevelDiff) {
std::string * pszResrcFN, // Resource FileName
std::string * pszIconFN, // Icon FileName
e_PartPosition & ePartPosition, // Part 일경우 Index
e_PlugPosition & ePlugPosition) // Plug 일경우 Index
e_PlugPosition & ePlugPosition, // Plug 일경우 Index
e_Race eRace)
{
ePartPosition = PART_POS_UNKNOWN;
ePlugPosition = PLUG_POS_UNKNOWN;
Expand Down Expand Up @@ -643,7 +644,7 @@ D3DCOLOR CGameBase::GetIDColorByLevelDifference(int iLevelDiff) {
if (pszResrcFN) {
if (pItem->dwIDResrc) {
*pszResrcFN = std::format("Item\\{:d}_{:04d}_{:02d}_{:d}{}", (pItem->dwIDResrc / 10000000),
(pItem->dwIDResrc / 1000) % 10000, (pItem->dwIDResrc / 10) % 100,
((pItem->dwIDResrc / 1000) % 10000) + eRace, (pItem->dwIDResrc / 10) % 100,
pItem->dwIDResrc % 10, szExt);
} else {
// 아이콘만 있는 플러그나 파트 일수도 있다...
Expand Down
3 changes: 2 additions & 1 deletion src/game/GameBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class CGameBase : public CN3Base {
std::string * szResrcFN, // Resource FileName
std::string * szIconFN, // Icon FileName
e_PartPosition & ePartPosition, // Part 일경우 Index
e_PlugPosition & ePlugPosition); // Plug 일경우 Index
e_PlugPosition & ePlugPosition, // Plug 일경우 Index
e_Race eRace = RACE_UNKNOWN);

class CPlayerBase * CharacterGetByID(int iID, bool bFromAlive);
bool IsValidCharacter(CPlayerBase * pCharacter);
Expand Down
20 changes: 10 additions & 10 deletions src/game/GameProcCharacterSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,19 +505,19 @@ void CGameProcCharacterSelect::AddChr(e_ChrPos eCP, __CharacterSelectInfo * pInf
m_pChrs[iPosIndex]->PlugSet(1, szPlug1FN);

// 상체..
this->AddChrPart(m_pChrs[iPosIndex], pLooks, PART_POS_UPPER, pInfo->dwItemUpper, pInfo->iItemUpperDurability);
this->AddChrPart(iPosIndex, pLooks, PART_POS_UPPER, pInfo->dwItemUpper, pInfo->iItemUpperDurability);
// 하체
__TABLE_ITEM_BASIC * pItemUpper = this->s_pTbl_Items_Basic->Find(pInfo->dwItemUpper);
if (pItemUpper && pItemUpper->byIsRobeType) {
m_pChrs[iPosIndex]->PartSet(PART_POS_LOWER, ""); // 하체일 경우 상체에 로브를 입었으면 ..
} else {
this->AddChrPart(m_pChrs[iPosIndex], pLooks, PART_POS_LOWER, pInfo->dwItemLower,
this->AddChrPart(iPosIndex, pLooks, PART_POS_LOWER, pInfo->dwItemLower,
pInfo->iItemLowerDurability); //아님 입히고...
}
//
this->AddChrPart(m_pChrs[iPosIndex], pLooks, PART_POS_HANDS, pInfo->dwItemGloves, pInfo->iItemGlovesDurability);
this->AddChrPart(iPosIndex, pLooks, PART_POS_HANDS, pInfo->dwItemGloves, pInfo->iItemGlovesDurability);
// 다리
this->AddChrPart(m_pChrs[iPosIndex], pLooks, PART_POS_FEET, pInfo->dwItemShoes, pInfo->iItemShoesDurability);
this->AddChrPart(iPosIndex, pLooks, PART_POS_FEET, pInfo->dwItemShoes, pInfo->iItemShoesDurability);

char szBuff[256] = "";
std::string szResrcFN;
Expand All @@ -534,7 +534,7 @@ void CGameProcCharacterSelect::AddChr(e_ChrPos eCP, __CharacterSelectInfo * pInf
__TABLE_ITEM_BASIC * pItemHelmet = this->s_pTbl_Items_Basic->Find(pInfo->dwItemHelmet);
if (pItemHelmet && pItemHelmet->dwIDResrc) // 헬멧아이템의 리소스(그림이 있는거면..)
{
this->AddChrPart(m_pChrs[iPosIndex], pLooks, PART_POS_HAIR_HELMET, pInfo->dwItemHelmet,
this->AddChrPart(iPosIndex, pLooks, PART_POS_HAIR_HELMET, pInfo->dwItemHelmet,
pInfo->iItemHelmetDurability);
} else if (!pLooks->szPartFNs[PART_POS_HAIR_HELMET].empty()) // 아이템이 없으면 기본 머리..
{
Expand Down Expand Up @@ -602,9 +602,9 @@ void CGameProcCharacterSelect::AddChr(e_ChrPos eCP, __CharacterSelectInfo * pInf
}
}

void CGameProcCharacterSelect::AddChrPart(CN3Chr * pChr, const __TABLE_PLAYER_LOOKS * pLooks, e_PartPosition ePartPos,
void CGameProcCharacterSelect::AddChrPart(int iPosIndex, const __TABLE_PLAYER_LOOKS * pLooks, e_PartPosition ePartPos,
DWORD dwItemID, int iItemDurability) {
if (NULL == pChr || NULL == pLooks) {
if (NULL == m_pChrs[iPosIndex] || NULL == pLooks) {
__ASSERT(0, "Invalid Chr Part");
return;
}
Expand All @@ -620,11 +620,11 @@ void CGameProcCharacterSelect::AddChrPart(CN3Chr * pChr, const __TABLE_PLAYER_LO
e_PartPosition ePartPosTmp = PART_POS_UNKNOWN;
e_PlugPosition ePlugPosTmp = PLUG_POS_UNKNOWN;

CGameProcedure::MakeResrcFileNameForUPC(pItem, &szResrcFN, NULL, ePartPosTmp, ePlugPosTmp);
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szResrcFN, NULL, ePartPosTmp, ePlugPosTmp, m_InfoChrs[iPosIndex].eRace);
if (szResrcFN.empty()) {
pPart = pChr->PartSet(ePartPos, pLooks->szPartFNs[ePartPos]); // 기본 파트
pPart = m_pChrs[iPosIndex]->PartSet(ePartPos, pLooks->szPartFNs[ePartPos]); // 기본 파트
} else {
pPart = pChr->PartSet(ePartPos, szResrcFN);
pPart = m_pChrs[iPosIndex]->PartSet(ePartPos, szResrcFN);
}
if (pPart && pItem && pItem->siMaxDurability > 0) {
int iPercentage = iItemDurability * 100 / pItem->siMaxDurability;
Expand Down
2 changes: 1 addition & 1 deletion src/game/GameProcCharacterSelect.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class CGameProcCharacterSelect : public CGameProcedure {
void RotateRight();

void AddChr(e_ChrPos eCP, __CharacterSelectInfo * pInfo);
void AddChrPart(CN3Chr * pChr, const __TABLE_PLAYER_LOOKS * pItemBasic, e_PartPosition ePartPos, DWORD dwItemID,
void AddChrPart(int iPosIndex, const __TABLE_PLAYER_LOOKS * pItemBasic, e_PartPosition ePartPos, DWORD dwItemID,
int iItemDurability);

void DoJobLeft();
Expand Down
14 changes: 9 additions & 5 deletions src/game/GameProcMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ bool CGameProcMain::MsgRecv_MyInfo_All(DataPack * pDataPack, int & iOffset) {
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, &szResrcFN, &szIconFN, ePart,
ePlug); // 아이템에 따른 파일 이름을 만들어서
ePlug, s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
CLogWriter::Write("MyInfo - slot - Unknown Item");
}
Expand Down Expand Up @@ -2843,7 +2843,8 @@ bool CGameProcMain::MsgRecv_NPCIn(DataPack * pDataPack, int & iOffset) {
e_PartPosition ePart;
e_PlugPosition ePlug;
std::string szItemFN;
CGameProcedure::MakeResrcFileNameForUPC(pItem0, &szItemFN, NULL, ePart, ePlug);
CGameProcedure::MakeResrcFileNameForUPC(pItem0, &szItemFN, NULL, ePart, ePlug,
s_pPlayer->m_InfoBase.eRace);
pNPC->PlugSet(PLUG_POS_RIGHTHAND, szItemFN, pItem0, pItemExt0);
} else {
__ASSERT(0, "Invalid Item ID And Extension");
Expand All @@ -2860,7 +2861,8 @@ bool CGameProcMain::MsgRecv_NPCIn(DataPack * pDataPack, int & iOffset) {
e_PartPosition ePart;
e_PlugPosition ePlug;
std::string szItemFN;
CGameProcedure::MakeResrcFileNameForUPC(pItem1, &szItemFN, NULL, ePart, ePlug);
CGameProcedure::MakeResrcFileNameForUPC(pItem1, &szItemFN, NULL, ePart, ePlug,
s_pPlayer->m_InfoBase.eRace);
pNPC->PlugSet(PLUG_POS_LEFTHAND, szItemFN, pItem1, pItemExt1);
} else {
N3_WARN("Invalid Item ID And Extension");
Expand Down Expand Up @@ -3347,7 +3349,8 @@ bool CGameProcMain::MsgRecv_UserLookChange(DataPack * pDataPack, int & iOffset)
if (dwItemID) // 아이템이 있는 경우
{
std::string szItemFN;
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szItemFN, NULL, ePartPos2, ePlugPos2);
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szItemFN, NULL, ePartPos2, ePlugPos2,
s_pPlayer->m_InfoBase.eRace);
pUPC->PartSet(ePartPos, szItemFN, pItem, pItemExt); // 아이템 붙이기..
pUPC->DurabilitySet(eSlot, iDurability);
} else {
Expand All @@ -3370,7 +3373,8 @@ bool CGameProcMain::MsgRecv_UserLookChange(DataPack * pDataPack, int & iOffset)
} else if (ePlugPos != PLUG_POS_UNKNOWN) {
if (dwItemID) {
std::string szItemFN;
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szItemFN, NULL, ePartPos2, ePlugPos2);
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szItemFN, NULL, ePartPos2, ePlugPos2,
s_pPlayer->m_InfoBase.eRace);
pUPC->PlugSet(ePlugPos, szItemFN, pItem, pItemExt);
pUPC->DurabilitySet(eSlot, iDurability);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/game/PlayerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ CN3CPart * CPlayerBase::PartSet(e_PartPosition ePos, const std::string & szFN, _
e_PlugPosition ePlugPos2 = PLUG_POS_UNKNOWN;

CGameProcedure::MakeResrcFileNameForUPC(m_pItemPartBasics[PART_POS_LOWER], &szFN2, NULL, ePartPos2,
ePlugPos2);
ePlugPos2, m_InfoBase.eRace);
this->PartSet(PART_POS_LOWER, szFN2, m_pItemPartBasics[PART_POS_LOWER],
m_pItemPartExts[PART_POS_LOWER]); // 하체에 전의 옷을 입힌다..
} else // 하체에 입고 있었던 아이템이 없다면..
Expand Down
2 changes: 1 addition & 1 deletion src/game/PlayerMySelf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ CN3CPart * CPlayerMySelf::PartSet(e_PartPosition ePos, const std::string & szFN,
e_PartPosition ePartPos2 = PART_POS_UNKNOWN;
e_PlugPosition ePlugPos2 = PLUG_POS_UNKNOWN;
CGameProcedure::MakeResrcFileNameForUPC(m_pItemPartBasics[PART_POS_LOWER], &szFN2, NULL, ePartPos2,
ePlugPos2);
ePlugPos2, m_InfoBase.eRace);

m_ChrInv.PartSet(PART_POS_LOWER, szFN2); // 하체에 전의 옷을 입힌다..
m_Chr.PartSet(PART_POS_LOWER, szFN2);
Expand Down
4 changes: 2 additions & 2 deletions src/game/PlayerOther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ bool CPlayerOther::Init(e_Race eRace, int iFace, int iHair, DWORD * pdwItemIDs,
continue;
}

e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, &szFN, NULL, ePart,
ePlug); // 리소스 파일 이름을 만들고..
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, &szFN, NULL, ePart, ePlug,
m_InfoBase.eRace); // 리소스 파일 이름을 만들고..

if (0 == i) {
ePart = PART_POS_UPPER;
Expand Down
20 changes: 10 additions & 10 deletions src/game/UIInventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ int CUIInventory::GetArmDestinationIndex(__IconItemSkill * spItem) {
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
return false;
}
Expand Down Expand Up @@ -1845,7 +1845,7 @@ bool CUIInventory::IsValidPosFromInvToArm(int iOrder) {
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
return false;
}
Expand Down Expand Up @@ -2121,7 +2121,7 @@ bool CUIInventory::IsValidPosFromArmToArm(int iOrder) {
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
return false;
}
Expand Down Expand Up @@ -2177,7 +2177,7 @@ bool CUIInventory::IsValidPosFromArmToArmInverse(int iOrder) {
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
return false;
}
Expand Down Expand Up @@ -2228,7 +2228,7 @@ void CUIInventory::ItemAdd(__TABLE_ITEM_BASIC * pItem, __TABLE_ITEM_EXT * pItemE
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szFN, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, &szFN, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서

if (ITEM_TYPE_PLUG == eType) {
if (ITEM_SLOT_HAND_LEFT == eSlot) {
Expand Down Expand Up @@ -2258,7 +2258,7 @@ void CUIInventory::ItemDelete(__TABLE_ITEM_BASIC * pItem, __TABLE_ITEM_EXT * pIt
e_PartPosition ePart;
e_PlugPosition ePlug;
e_ItemType eType =
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug); // 아이템에 따른 파일 이름을 만들어서
CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, NULL, ePart, ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서

if (pLooks) {
if (ITEM_TYPE_PLUG == eType) {
Expand Down Expand Up @@ -2366,7 +2366,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI
e_PlugPosition ePlug;
std::string szIconFN;
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart,
ePlug); // 아이템에 따른 파일 이름을 만들어서
ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
CLogWriter::Write("MyInfo - slot - Unknown Item");
}
Expand Down Expand Up @@ -2420,7 +2420,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI
e_PlugPosition ePlug;
std::string szIconFN;
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart,
ePlug); // 아이템에 따른 파일 이름을 만들어서
ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
CLogWriter::Write("MyInfo - slot - Unknown Item");
}
Expand Down Expand Up @@ -2475,7 +2475,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI
e_PlugPosition ePlug;
std::string szIconFN;
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart,
ePlug); // 아이템에 따른 파일 이름을 만들어서
ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
CLogWriter::Write("MyInfo - slot - Unknown Item");
}
Expand Down Expand Up @@ -2529,7 +2529,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI
e_PlugPosition ePlug;
std::string szIconFN;
e_ItemType eType = CGameProcedure::MakeResrcFileNameForUPC(pItem, NULL, &szIconFN, ePart,
ePlug); // 아이템에 따른 파일 이름을 만들어서
ePlug, CGameBase::s_pPlayer->m_InfoBase.eRace); // 아이템에 따른 파일 이름을 만들어서
if (ITEM_TYPE_UNKNOWN == eType) {
CLogWriter::Write("MyInfo - slot - Unknown Item");
}
Expand Down

0 comments on commit 2180b9d

Please sign in to comment.