Join Helbreath
Would you like to react to this message? Create an account in a few clicks or log in to continue.


An essential info site for anyone learning the game. Great community and often very insightful posts.
 
HomeUseful information for Helbreath beginnersPlay, discover, and broadcast your Helbreath moments for free.Statistics overviewSearchMemberlistRulesRegisterLog in
 

 [CODE] MP,HP,SP, EN COLORES

Go down 
AuthorMessage
Krhiz

avatar

Posts : 18

[CODE] MP,HP,SP, EN COLORES Empty
PostSubject: [CODE] MP,HP,SP, EN COLORES   [CODE] MP,HP,SP, EN COLORES 9991011/8/2014, 3:34 am

Bueno este code funciona para ver cuando el HP, MP y SP aumenta o disminuye, en colores, es decir, la HP en rojo, el MP en azul, y la SP en verde.

Lo primero que debes hacer es ir a los Sources del Client y buscar en Game.cpp el siguiente método:

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

A continuación, dentro de ese método buscca lo siguiente:

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

Por debajo de eso agrega:

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

Luego, busca el siguiente método:

Code:
void CGame::ShowEventList(DWORD dwTime)[size=13][/size]

Dentro de ese método, busque el siguiente:

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

Debajo agregar:

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

En ese mismo método volver a buscar:

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

Debajo de eso agregar:

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

Ahora lo que hacemos es reemplazar los métodos siguientes:

Code:
void CGame::NotifyMsg_MP(char * pData)[size=13][/size]
{DWORD * dwp;[size=13][/size]
int iPrevMP;[size=13][/size]
char cTxt[120];[size=13][/size]
iPrevMP = m_iMP;[size=13][/size]
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);[size=13][/size]
m_iMP = (int)*dwp;[size=13][/size]
if (abs(m_iMP - iPrevMP) < 10) return;[size=13][/size]
if (m_iMP > iPrevMP)[size=13][/size]
{ wsprintf(cTxt, NOTIFYMSG_MP_UP, m_iMP - iPrevMP);[size=13][/size]
TestList(cTxt, 11);[size=13][/size]
PlaySound('E', 21, 0);[size=13][/size]
}else[size=13][/size]
{ wsprintf(cTxt, NOTIFYMSG_MP_DOWN, iPrevMP - m_iMP);[size=13][/size]
TestList(cTxt, 11);[size=13][/size]
}[size=13][/size]
}[size=13][/size]
[size=13][/size]
[size=13][/size]
[size=13][/size]
void CGame::NotifyMsg_SP(char * pData)[size=13][/size]
{DWORD * dwp;[size=13][/size]
int iPrevSP;[size=13][/size]
iPrevSP = m_iSP;[size=13][/size]
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);[size=13][/size]
m_iSP = (int)*dwp;[size=13][/size]
if (abs(m_iSP - iPrevSP) < 10) return;[size=13][/size]
if (m_iSP > iPrevSP)[size=13][/size]
{ wsprintf(G_cTxt, NOTIFYMSG_SP_UP, m_iSP - iPrevSP);[size=13][/size]
TestList(G_cTxt, 13);[size=13][/size]
PlaySound('E', 21, 0);[size=13][/size]
}else[size=13][/size]
{ wsprintf(G_cTxt, NOTIFYMSG_SP_DOWN, iPrevSP - m_iSP);[size=13][/size]
TestList(G_cTxt, 13);[size=13][/size]
}[size=13][/size]
}[size=13][/size]
[size=13][/size]
[size=13][/size]
[size=13][/size]
void CGame::NotifyMsg_HP(char * pData)[size=13][/size]
{[size=13][/size]
DWORD * dwp;[size=13][/size]
int iPrevHP;[size=13][/size]
char cTxt[120];[size=13][/size]
int iPrevMP;[size=13][/size]
[size=13][/size]
iPrevHP = m_iHP;[size=13][/size]
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 2);[size=13][/size]
m_iHP = (int)*dwp;[size=13][/size]
[size=13][/size]
iPrevMP = m_iMP;[size=13][/size]
dwp = (DWORD *)(pData + DEF_INDEX2_MSGTYPE + 6);[size=13][/size]
m_iMP = (int)*dwp;[size=13][/size]
[size=13][/size]
if (m_iHP > iPrevHP)[size=13][/size]
{ if ((m_iHP - iPrevHP) < 10) return;[size=13][/size]
wsprintf(cTxt, NOTIFYMSG_HP_UP, m_iHP - iPrevHP); // danette[size=13][/size]
TestList(cTxt, 12);[size=13][/size]
PlaySound('E', 21, 0);[size=13][/size]
}else[size=13][/size]
{ if ( (m_cLogOutCount > 0) && (m_bForceDisconn==FALSE) )[size=13][/size]
{ m_cLogOutCount = -1;[size=13][/size]
TestList(NOTIFYMSG_HP2, 10);[size=13][/size]
}[size=13][/size]
m_dwDamagedTime = timeGetTime();[size=13][/size]
if (m_iHP < 20) AddEventList(NOTIFYMSG_HP3, 10);[size=13][/size]
if ((iPrevHP - m_iHP) < 10) return;[size=13][/size]
wsprintf(cTxt, NOTIFYMSG_HP_DOWN, iPrevHP - m_iHP); // danette[size=13][/size]
TestList(cTxt, 12);[size=13][/size]
}[size=13][/size]
}[size=13][/size]


Luego debemos reemplazar este case:

Code:
case DEF_OBJECTMOVE_CONFIRM:[size=13][/size]
sp = (short *)cp;[size=13][/size]
sX = *sp;[size=13][/size]
cp += 2;[size=13][/size]
sp = (short *)cp;[size=13][/size]
sY = *sp;[size=13][/size]
cp += 2;[size=13][/size]
cDir = *cp;[size=13][/size]
cp++;[size=13][/size]
m_iSP = m_iSP - *cp;[size=13][/size]
cp++;[size=13][/size]
if( m_iSP < 0 ) m_iSP = 0;[size=13][/size]
// v1.3[size=13][/size]
//m_iOccupyStatus = (int)*cp;[size=13][/size]
cp++;[size=13][/size]
// v1.4[size=13][/size]
iPreHP = m_iHP;[size=13][/size]
ip = (int *)cp;[size=13][/size]
m_iHP = *ip;[size=13][/size]
cp += 4;[size=13][/size]
[size=13][/size]
if (m_iHP != iPreHP)[size=13][/size]
{ if (m_iHP < iPreHP)[size=13][/size]
{ wsprintf(G_cTxt, NOTIFYMSG_HP_DOWN, iPreHP - m_iHP);[size=13][/size]
TestList(G_cTxt, 12);[size=13][/size]
m_dwDamagedTime = timeGetTime();[size=13][/size]
if ((m_cLogOutCount>0) && (m_bForceDisconn==FALSE))[size=13][/size]
{ m_cLogOutCount = -1;[size=13][/size]
TestList(MOTION_RESPONSE_HANDLER2, 10);[size=13][/size]
}[size=13][/size]
}else[size=13][/size]
{ wsprintf(G_cTxt, NOTIFYMSG_HP_UP, m_iHP - iPreHP);[size=13][/size]
TestList(G_cTxt, 12);[size=13][/size]
} }[size=13][/size]
m_pMapData->ShiftMapData(cDir);[size=13][/size]
_ReadMapData(sX, sY, cp);[size=13][/size]
m_bIsRedrawPDBGS = TRUE;[size=13][/size]
m_cCommandCount--;[size=13][/size]
break;

Agregar el siguiente método:

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

Y finalmente declaramos en Game.h:

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

Por BLAZER Y Fakku. Espero que disfruten el código Smile


[CODE] MP,HP,SP, EN COLORES 2mpymxj
Back to top Go down
 
[CODE] MP,HP,SP, EN COLORES
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Join Helbreath :: Open Source / Development Corner :: C++-
Jump to: