Display Real Damage Instead Of Critical!

All Helbreath Server Source Discussion here.
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

its actually +127, where 7 bits comprise the 0-127 and the last bit is the +/- and makes it negative
if you hit over 255 under this style it will restart at 0 (or failed.)
-><-
YouKnow
noob
Posts: 17
Joined: Thu Nov 23, 2006 5:06 pm

Post by YouKnow »

I tried to remove that "Critical" message but when i tested it i got problem :S
When i hit "Critical!" there read "%dPts!"
How i can fix that?
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

YouKnow wrote: I tried to remove that "Critical" message but when i tested it i got problem :S
When i hit "Critical!" there read "%dPts!"
How i can fix that?
thats because you dont remove the message >.<
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Crossfade wrote:
YouKnow wrote: I tried to remove that "Critical" message but when i tested it i got problem :S
When i hit "Critical!" there read "%dPts!"
How i can fix that?
thats because you dont remove the message >.<
Lol @ Crossfade
Crossfade
Loyal fan
Posts: 354
Joined: Sun Mar 20, 2005 5:55 pm

Post by Crossfade »

ADDKiD wrote:
Crossfade wrote:
YouKnow wrote: I tried to remove that "Critical" message but when i tested it i got problem :S
When i hit "Critical!" there read "%dPts!"
How i can fix that?
thats because you dont remove the message >.<
Lol @ Crossfade
lol at you, you dont just remove it
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Lol, w/e
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

I posted a fix for this (which is the easier 1 aryes talks of) ages ago. Go searching.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
YouKnow
noob
Posts: 17
Joined: Thu Nov 23, 2006 5:06 pm

Post by YouKnow »

Dax , i tried to find your post , but didnt find it :(
Can you post it here?
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

YouKnow wrote: Dax , i tried to find your post , but didnt find it :(
Can you post it here?
This code was by far not my best so I don't use it any more. Also if you are a coder(a real 1) then i suggest increasing the variable's size on both the client and server to remove the display limits of maximum damage.

Known Issues: Damage over 255 wont be displayed accurately.

Reason(Skip if your an idiot or don't intend on doing this feature propperly): If people remember how GM-Kill appears to display a random damage (1~Critical!) while always killing things. This is because the variable the client uses to display damage is only 1 byte (as aryes pointed out.) When the client receives the massive damage number it causes the small storage variable to "roll-over" several times and landing on a seemingly random position. Well the fact is the displayed damage variable often roll's over. It's how stech tracked "Critical!" damage. If the variable was negative (it has passed it's maximum positive value and has now entered into it's maximum negative value) then the client will display Critical! If the value is positive then it's true value is displayed. All this code does is alter the small variable to no longer display as a negative (aka "Critical").

Code:
Client Source -> Game.cpp -> CGame::MotionEventHandler
Paste this over the existing 3 cases.

Code: Select all

case DEF_OBJECTDYING:
 _RemoveChatMsgListByObjectID(wObjectID - 30000);

 for (i = 1; i < DEF_MAXCHATMSGS; i++) 
 if (m_pChatMsgList[i] == NULL) {
  ZeroMemory(cTxt, sizeof(cTxt));

  int iDmg = sV1;
  if(iDmg >= 0) wsprintf(cTxt, "-%d Points! Dead", iDmg);
  else {
   iDmg -= 128;
   wsprintf(cTxt, "%d Points! Dead", iDmg);
  }
  
  int iFontType;
  if ((sV1 >= 0) && (sV1 < 12))  iFontType = 21;
  else if ((sV1 >= 12) && (sV1 < 40)) iFontType = 22;
  else if ((sV1 >= 40) || (sV1 < 0)) iFontType = 23;

  m_pChatMsgList[i] = new class CMsg(iFontType, cTxt, m_dwCurTime);
  m_pChatMsgList[i]->m_iObjectID = wObjectID - 30000;
  
  if (m_pMapData->bSetChatMsgOwner(wObjectID - 30000, -10, -10, i) == FALSE) {
   delete m_pChatMsgList[i];
   m_pChatMsgList[i] = NULL;
  }
  return;
 }
 break;

case DEF_OBJECTDAMAGEMOVE:
case DEF_OBJECTDAMAGE: 
 // Ç÷¹À̾ ij½ºÆÃ Áß¿¡ ¸Â¾Ò´Ù¸é Ãë¼Ò´Ù. 
 if (memcmp(cName, m_cPlayerName, 10) == 0) {
  m_bIsGetPointingMode = FALSE;
  m_iPointCommandType  = -1;  // v2.15 NULL -> -1
  // v1.41 Ä¿¼­ ¸ð¾ç º¯°æ 
  m_stMCursor.sCursorFrame = 0;
  
  // »ç¿ëÁßÀ̾ú´ø ½ºÅ³À» Á¦°Å 
  ClearSkillUsingStatus();
 }
 
 // Ÿ°Ý ¹ÞÀº ¸Þ½ÃÁö¸¦ 
 _RemoveChatMsgListByObjectID(wObjectID - 30000);
 
 for (i = 1; i < DEF_MAXCHATMSGS; i++) 
 if (m_pChatMsgList[i] == NULL) {
  ZeroMemory(cTxt, sizeof(cTxt));
  
  if (sV1 != 0) {
//    if (sV1 > 0)
//     wsprintf(cTxt, "-%dPts", sV1); //pts
//    else strcpy(cTxt, "Critical!");
   int iDmg = sV1;
   if (iDmg >= 0) wsprintf(cTxt, "-%d Points!", iDmg);
   else {
    iDmg -= 128;
    wsprintf(cTxt, "%d Points!", iDmg);
   }

   int iFontType;
   if ((sV1 >= 0) && (sV1 < 12))  iFontType = 21;
   else if ((sV1 >= 12) && (sV1 < 40)) iFontType = 22;
   else if ((sV1 >= 40) || (sV1 < 0)) iFontType = 23;

   m_pChatMsgList[i] = new class CMsg(iFontType, cTxt, m_dwCurTime);
  }
  else {
   strcpy(cTxt, " * Failed! *");
   m_pChatMsgList[i] = new class CMsg(22, cTxt, m_dwCurTime);
   PlaySound('C', 17, 0);
  }
  m_pChatMsgList[i]->m_iObjectID = wObjectID - 30000;

  if (m_pMapData->bSetChatMsgOwner(wObjectID - 30000, -10, -10, i) == FALSE) {
   delete m_pChatMsgList[i];
   m_pChatMsgList[i] = NULL;
  }
  return;
 }
 break;


EDIT: This also displays "Dead" next to any damage which killed the target. And how this code actualy works is nothing like what all you idiots were saying so i feel sorry for whoever tried coding it lol.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Good Submission, Dax.....
YouKnow
noob
Posts: 17
Joined: Thu Nov 23, 2006 5:06 pm

Post by YouKnow »

Now my client is bugged :S Cant move and its bugged with logout hack... Did you make something wrong of is there bug?
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

YouKnow wrote: Now my client is bugged :S Cant move and its bugged with logout hack... Did you make something wrong of is there bug?
Did i make somthing wrong? I might see humor in that if it didnt register as an insult first.

I've done my job.. Now does any1 wanna teach noobs how to copy+paste?
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
YouKnow
noob
Posts: 17
Joined: Thu Nov 23, 2006 5:06 pm

Post by YouKnow »

omg sorry! its typo.. i mean did I make something wrong :S

bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

kae.. I haven't looked at this code in near a year but I did code this into my XO little failure of a thing xD

If I forget a part, excuse me x.x been so long :P


CLIENT
CommandProcessor
Search for

Code: Select all

    if (m_sDamageMoveAmount > 0)
    	wsprintf(cTxt, "-%dPts", m_sDamageMoveAmount); //pts
    else strcpy(cTxt, "Critical!");
replace with:

Code: Select all

wsprintf(cTxt, "-%luPts", m_sDamageMoveAmount); //pts

MotionEventHandler
\/ has 2 instances. Replace both.

Code: Select all

  	if (sV1 > 0)
    wsprintf(cTxt, "-%luPts!", sV1); //pts
  	else strcpy(cTxt, "Critical!");
replace with:

Code: Select all

    wsprintf(cTxt, "-%luPts!", sV1); //pts

Code: Select all

  case DEF_OBJECTMAGIC:
  case DEF_OBJECTDAMAGEMOVE:
  case DEF_OBJECTDAMAGE:
  	cDir = *cp;
  	cp++;

  	lp = (unsigned long *)cp;
  	sV1 = *lp; // ¹ÞÀº DamageÀÇ Å©±â, ȤÀº ¸¶¹ý ¹øÈ£ 
  	cp += 8;

  	sV2 = (short)*cp; // °ø°Ý¹ÞÀº ¹«±â À妽º, ȤÀº ¸¶¹ý ½ÃÀüÀÚ ¼öÁØ  
  	cp++;
    	break;

  case DEF_OBJECTDYING:
  	cDir = *cp;
  	cp++;

  	lp = (unsigned long *)cp;
  	sV1 = *lp; // ¹ÞÀº DamageÀÇ Å©±â, ȤÀº ¸¶¹ý ¹øÈ£ 
  	cp += 8;

  	sV2 = (short)*cp; // °ø°Ý¹ÞÀº ¹«±â À妽º 
  	cp++;

  	sp  = (short *)cp;	// Á×Àº ÁÂÇ¥ 
  	sX = *sp;
  	cp += 2;
  
  	sp  = (short *)cp;
  	sY = *sp;
  	cp += 2;
  	break;



Server
SendEventToNearClient_TypeA
find cp_s and replace this section --Client Part--

Code: Select all

  wp  = (WORD *)cp_s;
  *wp = sOwnerH + 30000;  	// ObjectID	(+30000)
  cp_s += 2;
    
  *cp_s = m_pClientList[sOwnerH]->m_cDir;
  cp_s++;
  // ¾Æ·¡ºÎºÐÀº OBJECTDAMAGEÀÏ °æ¿ì¿¡¸¸ Àü¼ÛµÈ´Ù. ¸ÔÀº DamegeÀÇ Å©±â¿Í °ø°Ý¹ÞÀº Á¾·ù  
  lp = (long *)cp_s;
  *lp = (unsigned long)sV1;
  cp_s += 8;
  *cp_s = (unsigned char)sV2;
  cp_s++;
--NPC Part--

Code: Select all

  // ºÎºÐ µ¥ÀÌÅÍ Çü½Ä ÀÛ¼º 
  wp  = (WORD *)cp_s;
  *wp = sOwnerH + 40000;  	// ObjectID	(+40000)
  cp_s += 2;
  
  *cp_s = m_pNpcList[sOwnerH]->m_cDir;
  cp_s++;
  // ¾Æ·¡ºÎºÐÀº OBJECTDAMAGEÀÏ °æ¿ì¿¡¸¸ Àü¼ÛµÈ´Ù. ¸ÔÀº DamegeÀÇ Å©±â¿Í °ø°Ý¹ÞÀº ŸÀÔ
  lp = (long *)cp_s;
  *lp = (unsigned long)sV1;
  cp_s += 8;
  *cp_s = (unsigned char)sV2;
  cp_s++;
That's all. Will display up to around -4300000000 give or take a few 10mill.

Don't forget to offset the packets by +4 in the server in that function or you'll have unexpected results of other things :P

Screenshots:
Image
Image


maxxing out the damage:
Image
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
Dax
&lt;3 bd long time
Posts: 785
Joined: Mon Apr 18, 2005 3:19 pm

Post by Dax »

bone-you wrote: kae.. I haven't looked at this code in near a year but I did code this into my XO little failure of a thing xD
You peice of shit.. You stole my uncoded code! Lol good job.
Reppin' 127.0.0.1!!!<br><br><img src='http://img502.imageshack.us/img502/1348/sig4daxbn2.jpg' border='0' alt='user posted image' /><br><br>I contend that we are both atheists. I just believe in one fewer god than you do. <br>When you understand why you dismiss all the other possible gods, you will <br>understand why I dismiss yours.<br>~ <b>Stephen Roberts</b>
Post Reply