nhjm_jx
21-05-15, 09:37 AM
trong file maplist.ini gồm như sau
8=Î÷±±ÄÏÇø\ÇØÁê\ÇØʼ»ÊÁêµØÏ ÂÒ»²ã
8_name=L¨ng TÇn Thñy Hoµng
8_MapPos=226,245
8_MapType=Cave
8_NpcSeriesAuto=1
8_NpcSeriesMetal=20
8_NpcSeriesWood=0
8_NpcSeriesWater=0
8_NpcSeriesFire=0
8_NpcSeriesEarth=80
8_NpcAutoLevelFlag=1
8_NpcAutoLevelMax=35
8_NpcAutoLevelMin=35
8_AutoGoldenNpc=2000
8_GoldenType=13
8_GoldenDropRate=
8_NormalDropRate=\settings\droprate\npcdroprate30. ini
cái 8_GoldenDropRate=
và 8_NormalDropRate=\settings\droprate\npcdroprate30. ini
là đường dẫn tới file droprate, như vậy thì k cần phải làm droprate từng con quái nữa
các bạn tìm tới hàm
void KNpcTemplate::InitNpcLevelData(
trong core/scr/KNpcTemplate.cpp thêm khúc code sau vào cuối
char szDropFile[200];
KIniFile g_NpcDroprate;
g_NpcDroprate.Load("\\settings\\maplist.ini");
char szKeyName[32];
char szSubWorld[32];
char szKeyName2[32];
int nWorldID;
KIniFile IniFile;
IniFile.Load("\\maps\\worldset.ini");
sprintf((char*)szSubWorld, "World%03d", nSubWorld);
IniFile.GetInteger("World", szSubWorld, 1000, &nWorldID);
sprintf(szKeyName, "%d_NormalDropRate", nWorldID); // droprate quai thuong
sprintf(szKeyName2, "%d_GoldenDropRate", nWorldID); // droprate quai xanh or vang
g_NpcDroprate.GetString("List", szKeyName, "", szDropFile, sizeof(szDropFile));
strlwr(szDropFile);
strcpy(m_szDropRateFile, szDropFile);
KItemDropRateNode DropNode;
strcpy(DropNode.m_szFileName, szDropFile);
if (g_ItemDropRateBinTree.Find(DropNode))
{
m_pItemDropRate = DropNode.m_pItemDropRate;
}
else
{
KItemDropRateNode newDropNode;
strcpy(newDropNode.m_szFileName,szDropFile);
newDropNode.m_pItemDropRate = g_GenItemDropRate(szDropFile);
g_ItemDropRateBinTree.Insert(newDropNode);
m_pItemDropRate = newDropNode.m_pItemDropRate;
}
char szDropGoldFile[200];
g_NpcDroprate.GetString("List", szKeyName2, "", szDropGoldFile, sizeof(szDropGoldFile));
strlwr(szDropGoldFile);
strcpy(m_szGoldDropRateFile, szDropGoldFile);
KItemDropRateNode GoldDropNode;
strcpy(GoldDropNode.m_szFileName, szDropGoldFile);
if (g_ItemDropRateBinTree.Find(GoldDropNode))
{
m_pGoldItemDropRate = GoldDropNode.m_pItemDropRate;
}
else
{
KItemDropRateNode newGoldDropNode;
strcpy(newGoldDropNode.m_szFileName,szDropGoldFile );
newGoldDropNode.m_pItemDropRate = g_GenItemDropRate(szDropGoldFile);
g_ItemDropRateBinTree.Insert(newGoldDropNode);
m_pGoldItemDropRate = newGoldDropNode.m_pItemDropRate;
}
8=Î÷±±ÄÏÇø\ÇØÁê\ÇØʼ»ÊÁêµØÏ ÂÒ»²ã
8_name=L¨ng TÇn Thñy Hoµng
8_MapPos=226,245
8_MapType=Cave
8_NpcSeriesAuto=1
8_NpcSeriesMetal=20
8_NpcSeriesWood=0
8_NpcSeriesWater=0
8_NpcSeriesFire=0
8_NpcSeriesEarth=80
8_NpcAutoLevelFlag=1
8_NpcAutoLevelMax=35
8_NpcAutoLevelMin=35
8_AutoGoldenNpc=2000
8_GoldenType=13
8_GoldenDropRate=
8_NormalDropRate=\settings\droprate\npcdroprate30. ini
cái 8_GoldenDropRate=
và 8_NormalDropRate=\settings\droprate\npcdroprate30. ini
là đường dẫn tới file droprate, như vậy thì k cần phải làm droprate từng con quái nữa
các bạn tìm tới hàm
void KNpcTemplate::InitNpcLevelData(
trong core/scr/KNpcTemplate.cpp thêm khúc code sau vào cuối
char szDropFile[200];
KIniFile g_NpcDroprate;
g_NpcDroprate.Load("\\settings\\maplist.ini");
char szKeyName[32];
char szSubWorld[32];
char szKeyName2[32];
int nWorldID;
KIniFile IniFile;
IniFile.Load("\\maps\\worldset.ini");
sprintf((char*)szSubWorld, "World%03d", nSubWorld);
IniFile.GetInteger("World", szSubWorld, 1000, &nWorldID);
sprintf(szKeyName, "%d_NormalDropRate", nWorldID); // droprate quai thuong
sprintf(szKeyName2, "%d_GoldenDropRate", nWorldID); // droprate quai xanh or vang
g_NpcDroprate.GetString("List", szKeyName, "", szDropFile, sizeof(szDropFile));
strlwr(szDropFile);
strcpy(m_szDropRateFile, szDropFile);
KItemDropRateNode DropNode;
strcpy(DropNode.m_szFileName, szDropFile);
if (g_ItemDropRateBinTree.Find(DropNode))
{
m_pItemDropRate = DropNode.m_pItemDropRate;
}
else
{
KItemDropRateNode newDropNode;
strcpy(newDropNode.m_szFileName,szDropFile);
newDropNode.m_pItemDropRate = g_GenItemDropRate(szDropFile);
g_ItemDropRateBinTree.Insert(newDropNode);
m_pItemDropRate = newDropNode.m_pItemDropRate;
}
char szDropGoldFile[200];
g_NpcDroprate.GetString("List", szKeyName2, "", szDropGoldFile, sizeof(szDropGoldFile));
strlwr(szDropGoldFile);
strcpy(m_szGoldDropRateFile, szDropGoldFile);
KItemDropRateNode GoldDropNode;
strcpy(GoldDropNode.m_szFileName, szDropGoldFile);
if (g_ItemDropRateBinTree.Find(GoldDropNode))
{
m_pGoldItemDropRate = GoldDropNode.m_pItemDropRate;
}
else
{
KItemDropRateNode newGoldDropNode;
strcpy(newGoldDropNode.m_szFileName,szDropGoldFile );
newGoldDropNode.m_pItemDropRate = g_GenItemDropRate(szDropGoldFile);
g_ItemDropRateBinTree.Insert(newGoldDropNode);
m_pGoldItemDropRate = newGoldDropNode.m_pItemDropRate;
}