[FIX] Negative Level Up Points (Setting stats)

#1
This bug appears when putting more than 200 points. With this fix, you are able to put more than 10k points.

HGServer Side

CGame::LevelUpSettingsHandler

Find

Code: Select all

char * cp, cStr, cVit, cDex, cInt, cMag, cChar;
int iTotalSetting = 0;

Replace with

Code: Select all

char * cp;
// sleeq - fix for negative level up points
short * sp;
short cStr, cVit, cDex, cInt, cMag, cChar;
int iTotalSetting = 0;

Find

Code: Select all

cStr = *cp;
cp++;

cVit = *cp;
cp++;

cDex = *cp;
cp++;

cInt = *cp;
cp++;

cMag = *cp;
cp++;

cChar = *cp;
cp++;

Replace with

Code: Select all

sp  = (short *)cp;
cStr  = *sp;
cp += 2;

sp  = (short *)cp;
cVit  = *sp;
cp += 2;

sp  = (short *)cp;
cDex  = *sp;
cp += 2;

sp  = (short *)cp;
cInt  = *sp;
cp += 2;

sp  = (short *)cp;
cMag  = *sp;
cp += 2;

sp  = (short *)cp;
cChar  = *sp;
cp += 2;


Client Side

Game.h
Find

Code: Select all

char m_cLU_Str, m_cLU_Vit, m_cLU_Dex, m_cLU_Int, m_cLU_Mag, m_cLU_Char;


Replace with

Code: Select all

short m_cLU_Str, m_cLU_Vit, m_cLU_Dex, m_cLU_Int, m_cLU_Mag, m_cLU_Char; // sleeq - fix for negative level up points


Game.cpp
Find

Code: Select all

case MSGID_LEVELUPSETTINGS:
		// CLEROTH
		//if ((m_cLU_Str + m_cLU_Vit + m_cLU_Dex + m_cLU_Int + m_cLU_Mag + m_cLU_Char) > 3) return FALSE;

		dwp = (DWORD *)(cMsg + DEF_INDEX4_MSGID);
		*dwp = dwMsgID;
		wp  = (WORD *)(cMsg + DEF_INDEX2_MSGTYPE);
		*wp = NULL;

		cp = (char *)(cMsg + DEF_INDEX2_MSGTYPE + 2);

		*cp = m_cLU_Str;
		cp++;

		*cp = m_cLU_Vit;
		cp++;

		*cp = m_cLU_Dex;
		cp++;

		*cp = m_cLU_Int;
		cp++;

		*cp = m_cLU_Mag;
		cp++;

		*cp = m_cLU_Char;
		cp++;

		iRet = m_pGSock->iSendMsg(cMsg, 12);
		break;


Replace with

Code: Select all

case MSGID_LEVELUPSETTINGS:
		// sleeq - fix for negative level up points
		dwp = (DWORD *)(cMsg + DEF_INDEX4_MSGID);
		*dwp = dwMsgID;
		wp  = (WORD *)(cMsg + DEF_INDEX2_MSGTYPE);
		*wp = NULL;

		cp = (char *)(cMsg + DEF_INDEX2_MSGTYPE + 2);

		sp = (short *)cp;
		*sp = (short)m_cLU_Str;
		cp += 2;
		
		sp = (short *)cp;
		*sp = (short)m_cLU_Vit;
		cp += 2;
		
		sp = (short *)cp;
		*sp = (short)m_cLU_Dex;
		cp += 2;
		
		sp = (short *)cp;
		*sp = (short)m_cLU_Int;
		cp += 2;
		
		sp = (short *)cp;
		*sp = (short)m_cLU_Mag;
		cp += 2;
		
		sp = (short *)cp;
		*sp = (short)m_cLU_Char;
		cp += 2;

		iRet = m_pGSock->iSendMsg(cMsg, 6 + 12);
		break;
Last edited by Boreas on Thu Jul 12, 2018 1:16 pm, edited 1 time in total.
https://www.youtube.com/channel/UCre_Jw ... -k6CHUsWAw
More videos: http://fb.com/helbreath/videos/
My github: https://github.com/sleeqeels/Helbreath-800x600

Who is online

Users browsing this forum: No registered users and 1 guest

cron