[help] About Stats Change

All Helbreath Server Source Discussion here.
Post Reply
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

this is the code i have...

Code: Select all

void CGame::StateChangeHandler(int iClientH, char * pData, DWORD dwMsgSize)
{
 char * cp, cStateChange1, cStateChange2, cStateChange3;
 char cStr, cVit, cDex, cInt, cMag, cChar;
 char cStateTxt[512];
 int iOldStr, iOldVit, iOldDex, iOldInt, iOldMag, iOldChar;
 int iTotalSetting = 0;
	
	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;
	
	
	wsprintf(G_cTxt, "(*) Char(%s) Str(%d) Vit(%d) Dex(%d) Int(%d) Mag(%d) Chr(%d) ", m_pClientList[iClientH]->m_cCharName, m_pClientList[iClientH]->m_iStr, m_pClientList[iClientH]->m_iVit, m_pClientList[iClientH]->m_iDex, m_pClientList[iClientH]->m_iInt, m_pClientList[iClientH]->m_iMag, m_pClientList[iClientH]->m_iCharisma);
	PutLogList(G_cTxt);	
	
	if(!bChangeState(cStateChange1,&cStr,&cVit,&cDex,&cInt,&cMag,&cChar))
	{
  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
  return;
	}
	if(!bChangeState(cStateChange2,&cStr,&cVit,&cDex,&cInt,&cMag,&cChar))
	{
  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_FAILED, NULL, NULL, NULL, NULL);
  return;
	}
	if(!bChangeState(cStateChange3,&cStr,&cVit,&cDex,&cInt,&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 != ((m_iPlayerMaxLevel-1)*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_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);
        }

	ZeroMemory(cStateTxt,sizeof(cStateTxt));

	wsprintf(cStateTxt, "STR(%d->%d)VIT(%d->%d)DEX(%d->%d)INT(%d->%d)MAG(%d->%d)CHARISMA(%d->%d)",
  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);

	SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_STATECHANGE_SUCCESS, NULL, NULL, NULL, NULL);
}
it doesnt work... on game it says "Your Stat has ben changed" but when you see your stats os the same...

<a href='http://imageshack.us' target='_blank'>Image</a>
<a href='http://imageshack.us' target='_blank'>Image</a>
<a href='http://imageshack.us' target='_blank'>Image</a>
<a href='http://imageshack.us' target='_blank'>Image</a>
<a href='http://imageshack.us' target='_blank'>Image</a>

any Help!? thanks...
OWNED!<br><img src='http://img50.imageshack.us/img50/1386/p ... 3vsqn2.gif' border='0' alt='user posted image' /><br><br><img src="http://hbtop50.com/button.php?u=hbuonline" alt="Helbreath Top 50 - Keepin' it real." border="0" /><br><a href='http://www.hbuonline.net' target='_blank'>Helbreath United</a>
€M4NU€L
Outpost bitch
Posts: 517
Joined: Sat Nov 19, 2005 9:07 pm
Location: I watch gay porn
Contact:

Post by €M4NU€L »

What's the problem :o is the problem is that when you want to change that's what happens i don't understand pictures :lol: maybe i can help you if you want... :)
<span style='color:blue'>Helbreath Thermal</span> <span style='color:green'>BETA</span> <span style='color:red'>Soon</span>:<br><br>www.youporngay.com<br><br><img src='http://img264.imageshack.us/img264/1041 ... piopk7.jpg' border='0' alt='user posted image' /><br><img src='http://img257.imageshack.us/img257/3762 ... eakxj1.jpg' border='0' alt='user posted image' /><br><img src='http://arthur.crepin.free.fr/images/use ... mpsons.png' border='0' alt='user posted image' /><br><img src='http://img329.imageshack.us/img329/5797/pesgamerrr3.gif' border='0' alt='user posted image' /><br><br><u><b>BLACK GAY LIST:</b></u><br><br><span style='color:red'>€M4NU€L</span>:<br>I look like a girl and he's always complaining someone.
locobans
Outpost Junkie
Posts: 2264
Joined: Tue Jul 13, 2004 3:51 am
Location: Behind You
Contact:

Post by locobans »

€M4NU€L wrote: What's the problem :o is the problem is that when you want to change that's what happens i don't understand pictures :lol: maybe i can help you if you want... :)
WTF! are you blind? he explained there what's wrong...jesus...

No useless post's. :angry:
QUOTE (ADDKiD @ Dec 1 2006, 4:01 PM) <br>You guys make me laugh alot, half the shit I say, is bullshit...<br><br><img src='http://img485.imageshack.us/img485/492/banssig1ng.gif' border='0' alt='user posted image' /><br><br><b>I see no changes at all, wake up in the morning and ask myself...<br>Is life worth living? Should I blast myself?</b><br><br><b><a href='http://2paclegacy.com' target='_blank'>2PacLegacy.com</a></b>
€M4NU€L
Outpost bitch
Posts: 517
Joined: Sat Nov 19, 2005 9:07 pm
Location: I watch gay porn
Contact:

Post by €M4NU€L »

locobans wrote:
€M4NU€L wrote: What's the problem  :o is the problem is that when you want to change that's what happens i don't understand pictures  :lol: maybe i can help you if you want... :)
WTF! are you blind? he explained there what's wrong...jesus...

No useless post's. :angry:
OMFG Didn't u read what i post i don't understand ss ... toy siego nigga
<span style='color:blue'>Helbreath Thermal</span> <span style='color:green'>BETA</span> <span style='color:red'>Soon</span>:<br><br>www.youporngay.com<br><br><img src='http://img264.imageshack.us/img264/1041 ... piopk7.jpg' border='0' alt='user posted image' /><br><img src='http://img257.imageshack.us/img257/3762 ... eakxj1.jpg' border='0' alt='user posted image' /><br><img src='http://arthur.crepin.free.fr/images/use ... mpsons.png' border='0' alt='user posted image' /><br><img src='http://img329.imageshack.us/img329/5797/pesgamerrr3.gif' border='0' alt='user posted image' /><br><br><u><b>BLACK GAY LIST:</b></u><br><br><span style='color:red'>€M4NU€L</span>:<br>I look like a girl and he's always complaining someone.
lionsoft
just visiting
Posts: 3
Joined: Tue Jun 08, 2004 11:05 pm

Post by lionsoft »

bug fix in game.h

#define DEF_STR 0x01
#define DEF_VIT 0x02
#define DEF_DEX 0x03
#define DEF_INT 0x04
#define DEF_MAG 0x05
#define DEF_CHR 0x06
diuuude
Outpost bitch
Posts: 592
Joined: Wed Dec 28, 2005 11:57 pm

Post by diuuude »

Don't worry, there is no bug... even in game.h as lionsoft said.


When you use the majestic points to change your stats, it is really changed by server, the only place where you can see the message "your stats has been changed" is when this command is sent to the client :

Code: Select all

DEF_NOTIFY_STATECHANGE_SUCCESS

Here is the problem (in SendNotifyMsg) :

Code: Select all

case DEF_NOTIFY_STATECHANGE_SUCCESS:
  {
  	int i;

  	for (i = 0; i < DEF_MAXMAGICTYPE; i++) {
    *cp = m_pClientList[iToH]->m_cMagicMastery[i];
    cp++;
  	}

  	for (i = 0; i < DEF_MAXSKILLTYPE; i++) {
    *cp = m_pClientList[iToH]->m_cSkillMastery[i];
    cp++;
  	}

  	iRet = m_pClientList[iToH]->m_pXSock->iSendMsg(cData, 6 + DEF_MAXMAGICTYPE + DEF_MAXSKILLTYPE);
  }
  break;
As you can see, the server checks your skills and magics (in StateChangeHandler), regarding to your new stats and then it send ONLY your new skill / magic mastery to the client, and doesn't send the new stats...

You have to edit this part (to send the correct msg) or just wait after changing stats for few seconds for the game to show "level up" and then you have 3 stats points availible.
<a href='http://www.technohell.net' target='_blank'><b><span style='color:red'>>>> Helbreath Ressources Website Here <<<</span></b></a><br>C++ Sources, Tools, Server Files, Help on Forum, C++ Snippets, Toplist... Updated often, come visit us !
Post Reply