Helbreath & Mas
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.

[CODE] MP,HP,SP, EN COLORES

Ir abajo

[CODE] MP,HP,SP, EN COLORES  Empty [CODE] MP,HP,SP, EN COLORES

Mensaje por MrKrhiz Lun Oct 17, 2011 10:50 pm

Bueno este code sirve para ver cuando aumenta o disminuye tu hp, mp y sp, en colores, es decir la hp en rojo, la mp en azul, y la sp en verde...

Lo primero que debemos hacer es ir a los sources de nuestro cliente y buscar en Game.cpp el siguiente método:

void CGame::DrawDialogBox_Chat(short msX, short msY, short msZ, char cLB)


Luego dentro de ese método buscar lo siguiente:

case 10: PutString2(sX + 25, sY + 127 - i*13, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg, 180, 255, 180); break;



Debajo de eso agregar lo siguiente:

case 11: PutString2(sX + 25, sY + 127 - i*13, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg, 25, 25, 112); break; // MP
case 12: PutString2(sX + 25, sY + 127 - i*13, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg, 255, 0, 0); break; // HP
case 13: PutString2(sX + 25, sY + 127 - i*13, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg, 0, 100, 0); break; // SP



Luego buscar el siguiente método:

void CGame::ShowEventList(DWORD dwTime)


Dentro de este método buscar lo siguiente:

case 10:
PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(180,255,180), FALSE, 1, TRUE);
break;


Debajo agregar:

case 11:
PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(25,25,112), FALSE, 1, TRUE); // MP
break;
case 12:
PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(255,0,0), FALSE, 1, TRUE); // HP
break;
case 13:
PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(0,100,0), FALSE, 1, TRUE); // SP
break;



En ese mismo método volver a buscar:

case 10:
PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(180,255,180), FALSE, 1, TRUE);
break;


Debajo de eso agregar:

case 11:
PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(25,25,112), FALSE, 1, TRUE); // MP
break;
case 12:
PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(255,0,0), FALSE, 1, TRUE); // HP
break;
case 13:
PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(0,100,0), FALSE, 1, TRUE); // SP
break;


Ahora lo que debemos hacer es reemplazar los siguientes métodos:

void CGame::NotifyMsg_MP(char * pData)
{DWORD * dwp;
int iPrevMP;
char cTxt[120];
iPrevMP = m_iMP;
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);
m_iMP = (int)*dwp;
if (abs(m_iMP - iPrevMP) < 10) return;
if (m_iMP > iPrevMP)
{ wsprintf(cTxt, NOTIFYMSG_MP_UP, m_iMP - iPrevMP);
TestList(cTxt, 11);
PlaySound('E', 21, 0);
}else
{ wsprintf(cTxt, NOTIFYMSG_MP_DOWN, iPrevMP - m_iMP);
TestList(cTxt, 11);
}
}



void CGame::NotifyMsg_SP(char * pData)
{DWORD * dwp;
int iPrevSP;
iPrevSP = m_iSP;
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);
m_iSP = (int)*dwp;
if (abs(m_iSP - iPrevSP) < 10) return;
if (m_iSP > iPrevSP)
{ wsprintf(G_cTxt, NOTIFYMSG_SP_UP, m_iSP - iPrevSP);
TestList(G_cTxt, 13);
PlaySound('E', 21, 0);
}else
{ wsprintf(G_cTxt, NOTIFYMSG_SP_DOWN, iPrevSP - m_iSP);
TestList(G_cTxt, 13);
}
}



void CGame::NotifyMsg_HP(char * pData)
{
DWORD * dwp;
int iPrevHP;
char cTxt[120];
int iPrevMP;

iPrevHP = m_iHP;
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);
m_iHP = (int)*dwp;

iPrevMP = m_iMP;
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 6);
m_iMP = (int)*dwp;

if (m_iHP > iPrevHP)
{ if ((m_iHP - iPrevHP) < 10) return;
wsprintf(cTxt, NOTIFYMSG_HP_UP, m_iHP - iPrevHP); // danette
TestList(cTxt, 12);
PlaySound('E', 21, 0);
}else
{ if ( (m_cLogOutCount > 0) && (m_bForceDisconn==FALSE) )
{ m_cLogOutCount = -1;
TestList(NOTIFYMSG_HP2, 10);
}
m_dwDamagedTime = timeGetTime();
if (m_iHP < 20) AddEventList(NOTIFYMSG_HP3, 10);
if ((iPrevHP - m_iHP) < 10) return;
wsprintf(cTxt, NOTIFYMSG_HP_DOWN, iPrevHP - m_iHP); // danette
TestList(cTxt, 12);
}
}



Luego debemos reemplazar este case:

case DEF_OBJECTMOVE_CONFIRM:
sp = (short *)cp;
sX = *sp;
cp += 2;
sp = (short *)cp;
sY = *sp;
cp += 2;
cDir = *cp;
cp++;
m_iSP = m_iSP - *cp;
cp++;
if( m_iSP < 0 ) m_iSP = 0;
// v1.3
//m_iOccupyStatus = (int)*cp;
cp++;
// v1.4
iPreHP = m_iHP;
ip = (int *)cp;
m_iHP = *ip;
cp += 4;

if (m_iHP != iPreHP)
{ if (m_iHP < iPreHP)
{ wsprintf(G_cTxt, NOTIFYMSG_HP_DOWN, iPreHP - m_iHP);
TestList(G_cTxt, 12);
m_dwDamagedTime = timeGetTime();
if ((m_cLogOutCount>0) && (m_bForceDisconn==FALSE))
{ m_cLogOutCount = -1;
TestList(MOTION_RESPONSE_HANDLER2, 10);
}
}else
{ wsprintf(G_cTxt, NOTIFYMSG_HP_UP, m_iHP - iPreHP);
TestList(G_cTxt, 12);
} }
m_pMapData->ShiftMapData(cDir);
_ReadMapData(sX, sY, cp);
m_bIsRedrawPDBGS = TRUE;
m_cCommandCount--;
break;


Luego agregamos el siguiente método:

void CGame::TestList(char * pTxt, char cColor, BOOL bDupAllow)
{int i;
if ((bDupAllow == FALSE) && (strcmp(m_stEventHistory[5].cTxt, pTxt) == 0)) return;
if (cColor == 11, 12, 13)
{ for (i = 1; i < 6; i++)
{ strcpy(m_stEventHistory2[i-1].cTxt, m_stEventHistory2[i].cTxt);
m_stEventHistory2[i-1].cColor = m_stEventHistory2[i].cColor;
m_stEventHistory2[i-1].dwTime = m_stEventHistory2[i].dwTime;
}
ZeroMemory(m_stEventHistory2[5].cTxt, sizeof(m_stEventHistory2[5].cTxt));
strcpy(m_stEventHistory2[5].cTxt, pTxt);
m_stEventHistory2[5].cColor = cColor;
m_stEventHistory2[5].dwTime = m_dwCurTime;
}else
{ for (i = 1; i < 6; i++)
{ strcpy(m_stEventHistory[i-1].cTxt, m_stEventHistory[i].cTxt);
m_stEventHistory[i-1].cColor = m_stEventHistory[i].cColor;
m_stEventHistory[i-1].dwTime = m_stEventHistory[i].dwTime;
}
ZeroMemory(m_stEventHistory[5].cTxt, sizeof(m_stEventHistory[5].cTxt));
strcpy(m_stEventHistory[5].cTxt, pTxt);
m_stEventHistory[5].cColor = cColor;
m_stEventHistory[5].dwTime = m_dwCurTime;
}
}


Luego declaramos en Game.h:

void TestList(char * pTxt, char cColor = 0, BOOL bDupAllow = TRUE);




By BLAZER & Faicu
MrKrhiz
MrKrhiz
Hellbreath HellOfAngel
Hellbreath HellOfAngel

Mensajes : 29
Reputacion : 1
Fecha de inscripción : 17/10/2011

https://helbreathymas.activo.mx

Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.