runkissbig
08-11-12, 11:32 AM
Damage thì đã nhảy sẵn trong source, giờ ta chỉ làm để nó hiển thị lên thôi. ^^
trong KNpc.h ta them setblood va bo clearblood nhu sau
// void ClearBlood();
// Khai báo thêm các biên sau
#ifndef _SERVER
int m_ResDir;
KNpcRes m_DataRes; // NpcµÄ¿Í»§¶Ë×ÊÔ´£¨Í¼Ïó¡¢ÉùÒ� �£©
// ÓÃÓÚÆÕͨս¶·npcðѪ´¦Àí
int m_nBloodNo[15][2];// Them bien nay vao
int m_nBloodAlpha;
//int m_nBloodTime;// Bo bien nay di
char m_szBloodNo[32];
KRUImage m_ImageSeries;
#endif
Tiep tim den
m_nPKFlag = 0;
sua lai doan nay nhu sau
#ifndef _SERVER
m_SyncSignal = 0;
m_sClientNpcID.m_dwRegionID = 0;
m_sClientNpcID.m_nNo = -1;
m_ResDir = 0;
m_nPKFlag = 0;
m_nSleepFlag = 0;
memset(&m_sSyncPos, 0, sizeof(m_sSyncPos));
for(int i=0;i<15;i++)
{
m_nBloodNo[i][0] = 0;
m_nBloodNo[i][1] = 0;
}
m_nBloodAlpha = 0;
//m_nBloodTime = 0;
m_szBloodNo[0] = 0;
m_nTongFlag = 0;
#endif
vao KNpc.cpp sua lai nhu sau
/*#ifndef _SERVER
void KNpc::ClearBlood()
{
m_nBloodNo = 0;
m_nBloodAlpha = 0;
// m_nBloodTime = 0;
m_szBloodNo[0] = 0;
}
#endif*/
#ifndef _SERVER
void KNpc::SetBlood(int nNo)
{
if (nNo <= 0)
return;
/*m_nBloodNo = nNo;
m_nBloodAlpha = 0;
m_nBloodTime = defMAX_SHOW_BLOOD_TIME;
sprintf(m_szBloodNo, "%d", nNo);*/
BOOL flag = FALSE;
int i = 0;
for (i; i< 15; i ++)
{
if (m_nBloodNo[i][0] == 0)
{
flag = TRUE;
break;
}
}
if (flag == TRUE)
{
m_nBloodNo[i][0] = nNo;
m_nBloodNo[i][1] = defMAX_SHOW_BLOOD_TIME;
}
else
{
int nMin = m_nBloodNo[0][1];//Thoi gian nho nhat
int n_mMin=0;//Vi Tri nho nhat
for (int j =0; j< 15; j ++)
{
if (m_nBloodNo[j][1] < nMin)
{
nMin = m_nBloodNo[j][1];
n_mMin = j;
}
}
m_nBloodNo[j][0] = nNo;
m_nBloodNo[j][1] = defMAX_SHOW_BLOOD_TIME;
}
}
#endif
#ifndef _SERVER
int KNpc::PaintBlood(int nHeightOffset)
{
BOOL _flag = FALSE;
for (int j = 0; j< 15; j++)
{
if (m_nBloodNo[j][0] > 0)
{
_flag = TRUE;
break;
}
}
if (_flag == FALSE )
{
return nHeightOffset;
}
int nFontSize = 16;
DWORD dwColor = SHOW_BLOOD_COLOR | (m_nBloodAlpha << 24);
int nMpsX, nMpsY;
GetMpsPos(&nMpsX, &nMpsY);
int nHeightOff = nHeightOffset;
for (int i = 0; i < 15; i++)
{
if (m_nBloodNo[i][0] > 0)
{
nHeightOff = nHeightOffset + (defMAX_SHOW_BLOOD_TIME - m_nBloodNo[i][1]) * defSHOW_BLOOD_MOVE_SPEED;
sprintf(m_szBloodNo, "%d", m_nBloodNo[i][0]);
g_pRepresent->OutputText(nFontSize, m_szBloodNo, KRF_ZERO_END, nMpsX - nFontSize * g_StrLen(m_szBloodNo) / 4, nMpsY, dwColor, 0, nHeightOff);
m_nBloodNo[i][1] = m_nBloodNo[i][1] - 1;
if (m_nBloodNo[i][1] <=0)
{
m_nBloodNo[i][0] = 0;
m_nBloodNo[i][1] = 0;
m_nBloodAlpha = 0;
m_szBloodNo[0] = 0;
}
}
}
m_nBloodAlpha++;
if (m_nBloodAlpha > 31)
m_nBloodAlpha = 31;
return nHeightOff;
}
#endif
tai ham
int KNpcSet::Add(int nNpcSettingIdxInfo, int nSubWorld, int nRegion, int nMa
bo clear blood
// Npc[i].ClearBlood();
PS:
De dieu chinh toc do cung nhu thoi gian len máu ta làm nhu sau
#define defMAX_SHOW_BLOOD_TIME 400//Thoi gian
#define defSHOW_BLOOD_MOVE_SPEED 0.1//Toc do
trong KNpc.h ta them setblood va bo clearblood nhu sau
// void ClearBlood();
// Khai báo thêm các biên sau
#ifndef _SERVER
int m_ResDir;
KNpcRes m_DataRes; // NpcµÄ¿Í»§¶Ë×ÊÔ´£¨Í¼Ïó¡¢ÉùÒ� �£©
// ÓÃÓÚÆÕͨս¶·npcðѪ´¦Àí
int m_nBloodNo[15][2];// Them bien nay vao
int m_nBloodAlpha;
//int m_nBloodTime;// Bo bien nay di
char m_szBloodNo[32];
KRUImage m_ImageSeries;
#endif
Tiep tim den
m_nPKFlag = 0;
sua lai doan nay nhu sau
#ifndef _SERVER
m_SyncSignal = 0;
m_sClientNpcID.m_dwRegionID = 0;
m_sClientNpcID.m_nNo = -1;
m_ResDir = 0;
m_nPKFlag = 0;
m_nSleepFlag = 0;
memset(&m_sSyncPos, 0, sizeof(m_sSyncPos));
for(int i=0;i<15;i++)
{
m_nBloodNo[i][0] = 0;
m_nBloodNo[i][1] = 0;
}
m_nBloodAlpha = 0;
//m_nBloodTime = 0;
m_szBloodNo[0] = 0;
m_nTongFlag = 0;
#endif
vao KNpc.cpp sua lai nhu sau
/*#ifndef _SERVER
void KNpc::ClearBlood()
{
m_nBloodNo = 0;
m_nBloodAlpha = 0;
// m_nBloodTime = 0;
m_szBloodNo[0] = 0;
}
#endif*/
#ifndef _SERVER
void KNpc::SetBlood(int nNo)
{
if (nNo <= 0)
return;
/*m_nBloodNo = nNo;
m_nBloodAlpha = 0;
m_nBloodTime = defMAX_SHOW_BLOOD_TIME;
sprintf(m_szBloodNo, "%d", nNo);*/
BOOL flag = FALSE;
int i = 0;
for (i; i< 15; i ++)
{
if (m_nBloodNo[i][0] == 0)
{
flag = TRUE;
break;
}
}
if (flag == TRUE)
{
m_nBloodNo[i][0] = nNo;
m_nBloodNo[i][1] = defMAX_SHOW_BLOOD_TIME;
}
else
{
int nMin = m_nBloodNo[0][1];//Thoi gian nho nhat
int n_mMin=0;//Vi Tri nho nhat
for (int j =0; j< 15; j ++)
{
if (m_nBloodNo[j][1] < nMin)
{
nMin = m_nBloodNo[j][1];
n_mMin = j;
}
}
m_nBloodNo[j][0] = nNo;
m_nBloodNo[j][1] = defMAX_SHOW_BLOOD_TIME;
}
}
#endif
#ifndef _SERVER
int KNpc::PaintBlood(int nHeightOffset)
{
BOOL _flag = FALSE;
for (int j = 0; j< 15; j++)
{
if (m_nBloodNo[j][0] > 0)
{
_flag = TRUE;
break;
}
}
if (_flag == FALSE )
{
return nHeightOffset;
}
int nFontSize = 16;
DWORD dwColor = SHOW_BLOOD_COLOR | (m_nBloodAlpha << 24);
int nMpsX, nMpsY;
GetMpsPos(&nMpsX, &nMpsY);
int nHeightOff = nHeightOffset;
for (int i = 0; i < 15; i++)
{
if (m_nBloodNo[i][0] > 0)
{
nHeightOff = nHeightOffset + (defMAX_SHOW_BLOOD_TIME - m_nBloodNo[i][1]) * defSHOW_BLOOD_MOVE_SPEED;
sprintf(m_szBloodNo, "%d", m_nBloodNo[i][0]);
g_pRepresent->OutputText(nFontSize, m_szBloodNo, KRF_ZERO_END, nMpsX - nFontSize * g_StrLen(m_szBloodNo) / 4, nMpsY, dwColor, 0, nHeightOff);
m_nBloodNo[i][1] = m_nBloodNo[i][1] - 1;
if (m_nBloodNo[i][1] <=0)
{
m_nBloodNo[i][0] = 0;
m_nBloodNo[i][1] = 0;
m_nBloodAlpha = 0;
m_szBloodNo[0] = 0;
}
}
}
m_nBloodAlpha++;
if (m_nBloodAlpha > 31)
m_nBloodAlpha = 31;
return nHeightOff;
}
#endif
tai ham
int KNpcSet::Add(int nNpcSettingIdxInfo, int nSubWorld, int nRegion, int nMa
bo clear blood
// Npc[i].ClearBlood();
PS:
De dieu chinh toc do cung nhu thoi gian len máu ta làm nhu sau
#define defMAX_SHOW_BLOOD_TIME 400//Thoi gian
#define defSHOW_BLOOD_MOVE_SPEED 0.1//Toc do