NPC repair

Welcome in the osRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Re: NPC repair

Postby PurpleYouko on Fri Sep 12, 2008 9:01 pm

Well we could just replace this
  1.  
  2. // Repair npc
  3. bool CWorldServer::pakRepairItem( CPlayer* thisclient, CPacket* P )
  4. {
  5.     BYTE action = GETBYTE((*P),0);
  6.     switch(action)
  7.     {
  8.         case 0x61: //Ronk
  9.         case 0x3d:
  10.         case 0x39:
  11.         case 0x1c:
  12.         case 0x08:
  13.         case 0x74:
  14.         case 0x89:
  15.         case 0x12: // Raffle
  16.         case 0x43: //NPC Repair Item / Town
  17.         {
  18.             BYTE slot = GETBYTE((*P),2);
  19.             if(!CheckInventorySlot( thisclient, slot)) return false;
  20.             if(thisclient->items[slot].count<1) return true;
  21.             //Log( MSG_INFO,"Item socketed?: %i", thisclient->items[slot].socketed);
  22.             thisclient->items[slot].lifespan = 100;
  23.             //Log( MSG_INFO,"Item socketed?: %i", thisclient->items[slot].socketed);
  24.             //Still TODO: find where prices of storage and repair are and add it to the code.
  25.             BEGINPACKET( pak, 0x7cd );
  26.             ADDQWORD   ( pak, thisclient->CharInfo->Zulies );
  27.             ADDBYTE    ( pak, 0x01 );
  28.             ADDBYTE    ( pak, slot );
  29.             ADDWORD   ( pak, BuildItemHead( thisclient->items[slot] ));
  30.             ADDDWORD   ( pak, BuildItemData( thisclient->items[slot] ));
  31.             ADDBYTE    ( pak, 0x00 );
  32.             thisclient->client->SendPacket( &pak );
  33.             thisclient->SetStats( );
  34.         }
  35.         break;
  36.         default:
  37.             Log( MSG_WARNING,"Repair Item unknown action: %i", action);
  38.     }
  39.     return true;
  40. }

with this
  1.  
  2. // Repair npc
  3. bool CWorldServer::pakRepairItem( CPlayer* thisclient, CPacket* P )
  4. {
  5.     BYTE slot = GETBYTE((*P),2);
  6.     if(!CheckInventorySlot( thisclient, slot)) return false;
  7.     if(thisclient->items[slot].count<1) return true;
  8.     //Log( MSG_INFO,"Item socketed?: %i", thisclient->items[slot].socketed);
  9.     thisclient->items[slot].lifespan = 100;
  10.     //Log( MSG_INFO,"Item socketed?: %i", thisclient->items[slot].socketed);
  11.     //Still TODO: find where prices of storage and repair are and add it to the code.
  12.     BEGINPACKET( pak, 0x7cd );
  13.     ADDQWORD   ( pak, thisclient->CharInfo->Zulies );
  14.     ADDBYTE    ( pak, 0x01 );
  15.     ADDBYTE    ( pak, slot );
  16.     ADDWORD   ( pak, BuildItemHead( thisclient->items[slot] ));
  17.     ADDDWORD   ( pak, BuildItemData( thisclient->items[slot] ));
  18.     ADDBYTE    ( pak, 0x00 );
  19.     thisclient->client->SendPacket( &pak );
  20.     thisclient->SetStats( );
  21.     return true;
  22. }

It will still work but now we aren't using the action code from the NPC at all so it make packet injection a whole lot easier
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: NPC repair

Postby Maxxon on Sat Sep 13, 2008 9:24 am

you dont loose much if you don't check for the NPC since when you try to hack by injecting, you could simply send the byte for the NPC you want to "use".
a hack check would be getting the NPC from the packet and then looking if the player is at least near to it.
Image
an anymous comment on a program called reloader:
what if a fatal error happens, will it restart it?
User avatar
Maxxon
Hawker's pet
Hawker's pet
 
Posts: 1305
Joined: Sat Nov 10, 2007 12:42 pm

Re: NPC repair

Postby PurpleYouko on Sat Sep 13, 2008 2:39 pm

true. I guess it is kind of useless the way it is now.

We might just as well lose the whole switch really.
Especially since we haven't actually implemented items wearing out yet :lol:
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Previous

Return to Support - OspRose Emulator

Who is online

Users browsing this forum: No registered users and 12 guests

cron