Page 1 of 1

Monster bug (help: packets?)

PostPosted: Mon May 12, 2008 6:46 pm
by Blah4
Well sometimes it happens to me, when I use a skill on a monster, the moster remains with 0 hp and follows me everywhere, hitting 0 damage, I can't hit it back and eventually I might even die (out of nothing).
Now I've been searching a bit for what could cause this, and then i came across this:

osrose ver 80:
  1. void CMonster::SpawnMonster( CPlayer* player, CMonster* thismon )
  2. {
  3.     BEGINPACKET( pak, 0x792 );
  4.     ADDWORD    ( pak, clientid );
  5.     ADDFLOAT   ( pak, Position->current.x*100 );
  6.     ADDFLOAT   ( pak, Position->current.y*100 );
  7.     ADDFLOAT   ( pak, Position->destiny.x*100 );
  8.     ADDFLOAT   ( pak, Position->destiny.y*100 );   
  9.     if(IsDead( ))
  10.     {
  11.        ADDWORD    ( pak, 0x0003 );
  12.        ADDWORD    ( pak, 0x0000 );          
  13.     }
  14.     else if(IsOnBattle( ))
  15.     {
  16.        ADDWORD    ( pak, 0x0002 );
  17.        ADDWORD    ( pak, Battle->target );        
  18.     }   
  19.     else if(IsMoving( ))
  20.     {
  21.        ADDWORD    ( pak, 0x0001 );
  22.        ADDWORD    ( pak, 0x0000 );        
  23.     }
  24.     else
  25.     {
  26.         ADDWORD    ( pak, 0x0000 );        
  27.         ADDWORD    ( pak, 0x0000 );
  28.     }   
  29.     ADDBYTE    ( pak, 0x00 );   
  30.     ADDDWORD   ( pak, Stats->HP );


ospRose:
  1. void CMonster::SpawnMonster( CPlayer* player, CMonster* thismon )
  2. {
  3.     BEGINPACKET( pak, 0x792 );
  4.     ADDWORD    ( pak, clientid );
  5.     ADDFLOAT   ( pak, Position->current.x*100 );
  6.     ADDFLOAT   ( pak, Position->current.y*100 );
  7.     ADDFLOAT   ( pak, Position->destiny.x*100 );
  8.     ADDFLOAT   ( pak, Position->destiny.y*100 );   
  9.     /*
  10.     if(IsDead( ))
  11.     {
  12.        ADDWORD    ( pak, 0x0003 );
  13.        ADDWORD    ( pak, 0x0000 );          
  14.     }
  15.     else if(IsOnBattle( ))
  16.     {
  17.        ADDWORD    ( pak, 0x0002 );
  18.        ADDWORD    ( pak, Battle->target );        
  19.     }   
  20.     else if(IsMoving( ))
  21.     {
  22.        ADDWORD    ( pak, 0x0001 );
  23.        ADDWORD    ( pak, 0x0000 );        
  24.     }
  25.     else
  26.     {
  27.         ADDWORD    ( pak, 0x0000 );        
  28.         ADDWORD    ( pak, 0x0000 );
  29.     }   
  30.     */
  31.     ADDBYTE    ( pak, 0x00 );
  32.     ADDDWORD   ( pak, 0x00000000 );
  33.        
  34.     ADDDWORD   ( pak, Stats->HP );


I'm no expert with packets, even worse, I don't know much about them, so I ask, could replacing the osprose part by the v80 part be a fix to this, or maybe a diff bug?

Re: Monster bug (help: packets?)

PostPosted: Mon May 12, 2008 7:22 pm
by PurpleYouko
That is a little mysterious but I don't think it is directly related to our issues.
I would start by looking through battle.cpp to see if there is any difference in the damage packets sent for normal combat or skills.
Haven't had the chance to yet. Busy working on recoding the drops and making a decent droplist

Re: Monster bug (help: packets?)

PostPosted: Mon May 12, 2008 7:29 pm
by pepu
New droplist will be like narose pre evo, or u will do a new droplist?

Re: Monster bug (help: packets?)

PostPosted: Mon May 12, 2008 7:43 pm
by Blah4
pepu wrote:New droplist will be like narose pre evo, or u will do a new droplist?

Guess it can't hurt to remake a drop list, as long as it is close to the pre evo one.

Back to topic: mainly checked battle.cpp already, going to doublecheck it now.

Edit:
Hmm small diff here...
rev80:
  1.    BEGINPACKET( pak, 0x799 );
  2.     ADDWORD    ( pak, clientid );
  3.     ADDWORD    ( pak, Battle->atktarget );
  4.     ADDDWORD   ( pak, hitpower );
  5.     if(Enemy->IsDead())
  6.     {
  7.         CDrop* thisdrop = NULL;
  8.         ADDDWORD   ( pak, critical?28:16 );
  9.         if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
  10.         {
  11.             thisdrop = Enemy->GetDrop( );
  12.             if(thisdrop!=NULL)
  13.             {
  14.                 ADDFLOAT   ( pak, thisdrop->pos.x*100 );
  15.                 ADDFLOAT   ( pak, thisdrop->pos.y*100 );
  16.                 if(thisdrop->type==1)
  17.                 {
  18.                     ADDDWORD( pak, 0xccccccdf );
  19.                     ADDDWORD( pak, thisdrop->amount );
  20.                 }
  21.                 else
  22.                 {
  23.                     ADDDWORD   ( pak, GServer->BuildItemHead( thisdrop->item ) );
  24.                     ADDDWORD   ( pak, GServer->BuildItemData( thisdrop->item ) );
  25.                 }
  26.                 ADDWORD    ( pak, thisdrop->clientid );
  27.                 ADDWORD    ( pak, thisdrop->owner );
  28.                 CMap* map = GServer->MapList.Index[thisdrop->posMap];
  29.                 map->AddDrop( thisdrop );
  30.             }
  31.         }
  32.         GServer->SendToVisible( &pak, Enemy, thisdrop );
  33.         OnEnemyDie( Enemy );
  34.     }
  35.     else
  36.     {
  37.         ADDDWORD   ( pak, (hitpower>0?(critical?12:0):0) );
  38.         GServer->SendToVisible( &pak, Enemy );
  39.     }
  40.     ReduceABC( );
  41.     Battle->lastAtkTime = clock( );
  42. }


ospRose:
  1.    BEGINPACKET( pak, 0x799 );
  2.     ADDWORD    ( pak, clientid );
  3.     ADDWORD    ( pak, Battle->atktarget );
  4.    
  5.     if(Enemy->IsDead())
  6.     {
  7.         CDrop* thisdrop = NULL;
  8.         ADDWORD ( pak, (hitpower |   (    critical?0xb000:0x8000   )    ));
  9.         if(!Enemy->IsSummon( ) && !Enemy->IsPlayer( ))
  10.         {
  11.             thisdrop = Enemy->GetDrop( );
  12.             if(thisdrop!=NULL)
  13.             {
  14.                 ADDFLOAT   ( pak, thisdrop->pos.x*100 );
  15.                 ADDFLOAT   ( pak, thisdrop->pos.y*100 );
  16.                 if(thisdrop->type==1)
  17.                 {
  18.                     ADDWORD( pak, 0xccdf );
  19.                     ADDDWORD( pak, thisdrop->amount );
  20.                 }
  21.                 else
  22.                 {
  23.                     ADDWORD   ( pak, GServer->BuildItemHead( thisdrop->item ) );
  24.                     ADDDWORD   ( pak, GServer->BuildItemData( thisdrop->item ) );
  25.                 }
  26.                 ADDWORD    ( pak, thisdrop->clientid );
  27.                 ADDWORD    ( pak, thisdrop->owner );
  28.                 CMap* map = GServer->MapList.Index[thisdrop->posMap];
  29.                 map->AddDrop( thisdrop );
  30.             }
  31.         }
  32.         GServer->SendToVisible( &pak, Enemy, thisdrop );
  33.         OnEnemyDie( Enemy );
  34.     }
  35.     else
  36.     {
  37.         ADDWORD   ( pak, (hitpower|(hitpower>0?(critical?0x4000:0):0)));
  38.         GServer->SendToVisible( &pak, Enemy );
  39.     }
  40.     ReduceABC( );
  41.     Battle->lastAtkTime = clock( );
  42. }


Diffs:
line 4
line 8
line 18
line 23
line 37


also there is a huge difference in battle.cpp from
  1.    Enemy->Stats->HP -= skillpower;