Nigga |
Wysłany: Wto 14:12, 18 Mar 2008 Temat postu: [FIX]Change Stats |
|
Sources HG, Game.CPP
Kod: |
void CGame::StateChangeHandler |
Kod: |
void CGame::StateChangeHandler(int iClientH, char * pData, DWORD dwMsgSize)
{
char * cp, cStateChange1, cStateChange2, cStateChange3;
char cStr, cVit, cDex, cInt, cMag, cChar;
int iOldStr, iOldVit, iOldDex, iOldInt, iOldMag, iOldChar;
if (m_pClientList[iClientH] == NULL) return;
if (m_pClientList[iClientH]->m_bIsInitComplete == FALSE) return;
if (m_pClientList[iClientH]->m_iGizonItemUpgradeLeft <= 0) return;
cStr = cVit = cDex = cInt = cMag = cChar = 0;
cp = (char *)(pData + DEF_INDEX2_MSGTYPE + 2);
cStateChange1 = *cp;
cp++;
cStateChange2 = *cp;
cp++;
cStateChange3 = *cp;
cp++;
iOldStr = m_pClientList[iClientH]->m_iStr;
iOldVit = m_pClientList[iClientH]->m_iVit;
iOldDex = m_pClientList[iClientH]->m_iDex;
iOldInt = m_pClientList[iClientH]->m_iInt;
iOldMag = m_pClientList[iClientH]->m_iMag;
iOldChar = m_pClientList[iClientH]->m_iCharisma;
if (!bChangeState(cStateChange1,&cStr,&cVit,&cDex,&cI nt,&cMag,&cChar)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if (!bChangeState(cStateChange2,&cStr,&cVit,&cDex,&cI nt,&cMag,&cChar)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if (!bChangeState(cStateChange3,&cStr,&cVit,&cDex,&cI nt,&cMag,&cChar)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if (m_pClientList[iClientH]->m_iGuildRank == 0) {
if (m_pClientList[iClientH]->m_iCharisma - cChar < 20) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
}
if (iOldStr + iOldVit + iOldDex + iOldInt + iOldMag + iOldChar != (179*3 + 70)) {
return;
}
if ((cStr < 0 || cVit < 0 || cDex < 0 || cInt < 0 || cMag < 0 || cChar < 0) ||
(cStr + cVit + cDex + cInt + cMag + cChar != 3)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iStr - cStr > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iStr - cStr < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iDex - cDex > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iDex - cDex < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iInt - cInt > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iInt - cInt < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iVit - cVit > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iVit - cVit < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iMag - cMag > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iMag - cMag < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if ((m_pClientList[iClientH]->m_iCharisma - cChar > DEF_CHARPOINTLIMIT)
|| (m_pClientList[iClientH]->m_iCharisma - cChar < 10)) {
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
return;
}
if (m_pClientList[iClientH]->m_iLU_Pool < 3) m_pClientList[iClientH]->m_iLU_Pool = 3;
m_pClientList[iClientH]->m_iGizonItemUpgradeLeft--;
m_pClientList[iClientH]->m_iStr -= cStr;
m_pClientList[iClientH]->m_iVit -= cVit;
m_pClientList[iClientH]->m_iDex -= cDex;
m_pClientList[iClientH]->m_iInt -= cInt;
m_pClientList[iClientH]->m_iMag -= cMag;
m_pClientList[iClientH]->m_iCharisma -= cChar;
if (cInt > 0) {
bCheckMagicInt(iClientH);
}
//Re-Calculate HP,MP,SP
if (m_pClientList[iClientH]->m_iHP > iGetMaxHP(iClientH)) m_pClientList[iClientH]->m_iHP = iGetMaxHP(iClientH);
if (m_pClientList[iClientH]->m_iMP > iGetMaxMP(iClientH)) m_pClientList[iClientH]->m_iMP = iGetMaxMP(iClientH);
if (m_pClientList[iClientH]->m_iSP > iGetMaxSP(iClientH)) m_pClientList[iClientH]->m_iSP = iGetMaxSP(iClientH);
SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_SUCCESS, NULL, NULL, NULL, NULL);
} |
Kod: |
BOOL CGame::bChangeState |
Kod: |
BOOL CGame::bChangeState(char cStateChange, char *cStr, char *cVit, char *cDex, char *cInt, char *cMag, char *cChar)
{
if (cStateChange == DEF_STR) {
*cStr += 1;
}
else if (cStateChange == DEF_VIT) {
*cVit += 1;
}
else if (cStateChange == DEF_DEX) {
*cDex += 1;
}
else if (cStateChange == DEF_INT) {
*cInt += 1;
}
else if (cStateChange == DEF_MAG) {
*cMag += 1;
}
else if (cStateChange == DEF_CHR) {
*cChar += 1;
}
else {
return 0;
}
return cStateChange;
} |
Kod: |
#define DEF_STR 0x01 //Correct
#define DEF_DEX 0x02 //Correct
#define DEF_INT 0x03 //Correct
#define DEF_VIT 0x04 //Correct
#define DEF_MAG 0x05 //Correct
#define DEF_CHR 0x06 //Correct |
Code By Smaller Find By Nigga.. |
|