AVA2 unlock P4: sash (mt_sash windows/slot/tooltips, sash module, CHR_EQUIPPART_SASH, item_scale)

Client side of metin2-server FEATURE-AVA2-UNLOCK P4: HEADER_CG_SASH 211 /
HEADER_GC_SASH 215, a fifth awPart WORD in the character packets (old
servers break), the sash part attached by scale per job/sex, the combine
and absorb windows in script mt_sash, and quest tools/server/sash on 20016.
The ava2items pack keeps the four grade-4 sashes plus their effects,
acce window images and item_scale.txt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-16 13:45:02 +09:00
co-authored by Claude Opus 5.5
parent 0d2a9ebe36
commit 4d7306792e
37 changed files with 1568 additions and 18 deletions
+1
View File
@@ -243,6 +243,7 @@ class CActorInstance : public IActorInstance, public IFlyTargetableObject
bool SetRace(DWORD eRace);
void SetHair(DWORD eHair);
void AttachSash(CItemData * pItemData, float fSpecular = 0.0f); // PORT: AVA2 sash
void SetVirtualID(DWORD dwVID);
void SetShape(DWORD eShape, float fSpecular=0.0f);
+41
View File
@@ -624,3 +624,44 @@ void CActorInstance::__ClearAttachingEffect()
}
m_AttachingEffectList.clear();
}
// PORT: AVA2 ActorInstanceAttach.cpp AttachSash (ENABLE_SASH_SYSTEM). The sash is a model part on
// "Bip01 Spine2" that plays its own first motion (the cloth sway).
void CActorInstance::AttachSash(CItemData * pItemData, float fSpecular)
{
if (!pItemData)
{
RegisterModelThing(CRaceData::PART_SASH, NULL);
SetModelInstance(CRaceData::PART_SASH, CRaceData::PART_SASH, 0);
RefreshActorInstance();
return;
}
RegisterModelThing(CRaceData::PART_SASH, pItemData->GetModelThing());
SetModelInstance(CRaceData::PART_SASH, CRaceData::PART_SASH, 0);
AttachModelInstance(CRaceData::PART_MAIN, "Bip01 Spine2", CRaceData::PART_SASH);
if (fSpecular > 0.0f)
{
SMaterialData kMaterialData;
kMaterialData.pImage = NULL;
kMaterialData.isSpecularEnable = TRUE;
kMaterialData.fSpecularPower = fSpecular;
kMaterialData.bSphereMapIndex = 1;
SetMaterialData(CRaceData::PART_SASH, NULL, kMaterialData);
}
if (CRaceData::PART_SASH >= m_LODControllerVector.size())
return;
if (CGrannyLODController* pLODController = m_LODControllerVector[CRaceData::PART_SASH])
{
if (CGrannyModelInstance* pSashModelInstance = pLODController->GetModelInstance())
{
CGraphicThing* pItemGraphicThing = pItemData->GetModelThing();
if (pItemGraphicThing && pItemGraphicThing->GetMotionCount() > 0)
if (CGrannyMotion* pItemMotion = pItemGraphicThing->GetMotionPointer(0))
pSashModelInstance->SetMotionPointer(pItemMotion);
}
}
}
+38
View File
@@ -215,6 +215,43 @@ void CItemData::SetItemTableData(TItemTable * pItemTable)
memcpy(&m_ItemTable, pItemTable, sizeof(TItemTable));
}
// PORT: AVA2 ItemData.cpp SetItemScale/GetItemScale. The position columns are dropped: AVA2 feeds
// them to SetScalePosition, which its deform never reads. JOB_WOLFMAN rows are skipped (no wolfman).
void CItemData::SetItemScale(const std::string & strJob, const std::string & strSex, const std::string & strScaleX, const std::string & strScaleY, const std::string & strScaleZ)
{
DWORD dwPos;
if (strJob == "JOB_WARRIOR")
dwPos = NRaceData::JOB_WARRIOR;
else if (strJob == "JOB_ASSASSIN")
dwPos = NRaceData::JOB_ASSASSIN;
else if (strJob == "JOB_SURA")
dwPos = NRaceData::JOB_SURA;
else if (strJob == "JOB_SHAMAN")
dwPos = NRaceData::JOB_SHAMAN;
else
return;
dwPos += 1;
if (strSex == "F")
dwPos += 5;
m_aScaleInfo[dwPos].bSet = true;
m_aScaleInfo[dwPos].fScaleX = float(atof(strScaleX.c_str()) / 100.0f);
m_aScaleInfo[dwPos].fScaleY = float(atof(strScaleY.c_str()) / 100.0f);
m_aScaleInfo[dwPos].fScaleZ = float(atof(strScaleZ.c_str()) / 100.0f);
}
bool CItemData::GetItemScale(DWORD dwPos, float & fScaleX, float & fScaleY, float & fScaleZ)
{
if (dwPos >= sizeof(m_aScaleInfo) / sizeof(m_aScaleInfo[0]) || !m_aScaleInfo[dwPos].bSet)
return false;
fScaleX = m_aScaleInfo[dwPos].fScaleX;
fScaleY = m_aScaleInfo[dwPos].fScaleY;
fScaleZ = m_aScaleInfo[dwPos].fScaleZ;
return true;
}
const CItemData::TItemTable* CItemData::GetTable() const
{
return &m_ItemTable;
@@ -452,6 +489,7 @@ void CItemData::Clear()
m_pLODModelThingVector.clear();
memset(&m_ItemTable, 0, sizeof(m_ItemTable));
memset(m_aScaleInfo, 0, sizeof(m_aScaleInfo));
}
CItemData::CItemData()
+10
View File
@@ -102,6 +102,7 @@ class CItemData
{
COSTUME_BODY, //0 갑옷(main look)
COSTUME_HAIR, //1 헤어(탈착가능)
COSTUME_SASH = 3, // PORT: AVA2 sash (2 is AVA2 COSTUME_MOUNT)
COSTUME_NUM_TYPES,
};
@@ -495,6 +496,9 @@ class CItemData
//BOOL LoadItemData(const char * c_szFileName);
void SetDefaultItemData(const char * c_szIconFileName, const char * c_szModelFileName = NULL);
void SetItemTableData(TItemTable * pItemTable);
// PORT: AVA2 item_scale.txt (sash part scale per job/sex). Slot = job + 1, + 5 when female.
void SetItemScale(const std::string & strJob, const std::string & strSex, const std::string & strScaleX, const std::string & strScaleY, const std::string & strScaleZ);
bool GetItemScale(DWORD dwPos, float & fScaleX, float & fScaleY, float & fScaleZ);
protected:
void __LoadFiles();
@@ -518,6 +522,12 @@ class CItemData
NRaceData::TAttachingDataVector m_AttachingDataVector;
DWORD m_dwVnum;
TItemTable m_ItemTable;
struct SScaleInfo
{
bool bSet;
float fScaleX, fScaleY, fScaleZ;
};
SScaleInfo m_aScaleInfo[11];
public:
static void DestroySystem();
+36
View File
@@ -402,3 +402,39 @@ CItemManager::~CItemManager()
{
Destroy();
}
// PORT: AVA2 ItemManager.cpp LoadItemScale (ENABLE_SASH_SYSTEM). Each row covers vnum .. vnum + 4;
// unlike AVA2 (MakeItemData) only vnums already in the item table are touched.
bool CItemManager::LoadItemScale(const char * c_szFileName)
{
const VOID* pvData;
CMappedFile kFile;
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
return false;
CMemoryTextFileLoader kTextFileLoader;
kTextFileLoader.Bind(kFile.Size(), pvData);
CTokenVector kTokenVector;
for (DWORD i = 0; i < kTextFileLoader.GetLineCount(); ++i)
{
if (!kTextFileLoader.SplitLineByTab(i, &kTokenVector))
continue;
if (kTokenVector.size() < ITEMSCALE_NUM)
{
TraceError("LoadItemScale: invalid line %d (%s).", i, c_szFileName);
continue;
}
for (int j = 0; j < 5; ++j)
{
TItemMap::iterator f = m_ItemMap.find(atoi(kTokenVector[ITEMSCALE_VNUM].c_str()) + j);
if (m_ItemMap.end() == f)
continue;
f->second->SetItemScale(kTokenVector[ITEMSCALE_JOB], kTokenVector[ITEMSCALE_SEX], kTokenVector[ITEMSCALE_SCALE_X], kTokenVector[ITEMSCALE_SCALE_Y], kTokenVector[ITEMSCALE_SCALE_Z]);
}
}
return true;
}
+15
View File
@@ -13,6 +13,20 @@ class CItemManager : public CSingleton<CItemManager>
ITEMDESC_COL_SUMM,
ITEMDESC_COL_NUM,
};
// PORT: AVA2 item_scale.txt columns
enum EItemScaleColumn
{
ITEMSCALE_VNUM,
ITEMSCALE_JOB,
ITEMSCALE_SEX,
ITEMSCALE_SCALE_X,
ITEMSCALE_SCALE_Y,
ITEMSCALE_SCALE_Z,
ITEMSCALE_POSITION_X,
ITEMSCALE_POSITION_Y,
ITEMSCALE_POSITION_Z,
ITEMSCALE_NUM,
};
public:
typedef std::map<DWORD, CItemData*> TItemMap;
@@ -31,6 +45,7 @@ class CItemManager : public CSingleton<CItemManager>
/////
bool LoadItemDesc(const char* c_szFileName);
bool LoadItemScale(const char* c_szFileName); // PORT: AVA2 sash
bool LoadItemList(const char* c_szFileName);
bool LoadItemTable(const char* c_szFileName);
CItemData * MakeItemData(DWORD dwIndex);
+1
View File
@@ -23,6 +23,7 @@ class CRaceData
PART_HEAD,
PART_WEAPON_LEFT,
PART_HAIR,
PART_SASH, // PORT: AVA2 sash ("Bip01 Spine2", item vnum - 85000)
PART_MAX_NUM,
};