Trade bug

Put your bugs you find in osRose here

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

Trade bug

Postby hoegarden31 on Fri Sep 20, 2013 8:48 pm

Hello,

Maybe this is an old bug but i can't find a topic here who actually fix it.
The problem is that players can swap items in the trade. Showing the initial item on the screen, but once traded, the item changes to the swapped item.
I started to block the fact that you can't equip/unequip gear for the armor slots on the char. But this doesn't fix the hole problem. So is there a way to actually block the use of all the quick-bar actions when a player is trading with an other player ? Hope someone will help me out here :D
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Trade bug

Postby hoegarden31 on Thu Oct 03, 2013 5:05 pm

I'm going to play a little game from now :lol:
The first person who come here to just read the post must make a reply and help me out :P

I can't imagine that nobody has fixed this problem... All i need is some direction on how to fix it. We already did some work to prevent the players of swapping gear during the trades, but they still can do it with the quick-bar...
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Trade bug

Postby wolfwing on Thu Oct 03, 2013 6:23 pm

The bug is the swap, you're just making a workaround now.
Make sure you send trade packets to the client instead of nothing, which is your issue here.
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am

Re: Trade bug

Postby hoegarden31 on Fri Oct 04, 2013 4:04 pm

yes i know it is a work around. Just because i'm not very familiar with all this packet sending stuff.
That's also why i'm here so smart people can help me out :)
And i don't see anything different in the dev rev 4 so that surprise me too if that isn't fixed in that version as well.
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Trade bug

Postby wolfwing on Fri Oct 04, 2013 6:15 pm

hoegarden31 wrote:yes i know it is a work around. Just because i'm not very familiar with all this packet sending stuff.
That's also why i'm here so smart people can help me out :)
And i don't see anything different in the dev rev 4 so that surprise me too if that isn't fixed in that version as well.


Probably because you discovered the bug and the abusers told nobody.
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am

Re: Trade bug

Postby hoegarden31 on Mon Oct 07, 2013 4:54 pm

So nobody can teach me how to work with those packets ? I'm a good student :P
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Trade bug

Postby wolfwing on Mon Oct 07, 2013 5:47 pm

hoegarden31 wrote:So nobody can teach me how to work with those packets ? I'm a good student :P

It's pretty straight forward even though the interface is shit. And the only thing you probably have to do is add a single call to the tradepacket function.
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am

Re: Trade bug

Postby PurpleYouko on Tue Oct 08, 2013 2:31 pm

PSSSSSSSTTT!!!

[whisper] Wanna see how NARose did it in their server? [/whisper]
A shadowy figure appears from the gloom of a back alley and opens its trench-coat to show a load of code hanging from a pocket

  1. bool classUSER::Recv_cli_TRADE_P2P( t_PACKET *pPacket )
  2. {
  3.     if ( this->m_iIndex == pPacket->m_cli_TRADE_P2P.m_wObjectIDX ) {
  4.         // ·ÎÁîÇØÄ¿ deebeeÀÇ ¸ÞÀÏ·Î ÀÎÇØ ¾Ë°ÔµÈ ÇØÅ·¹æ¹ý ::
  5.         // 1:1°Å·¡½Ã ÇØÅ·À» ÅëÇؼ­ ÀڽŰú °Å·¡¸¦ ÇÏ°Ô ÇÏ´Â ¹æ¹ýÀ¸·Î ¾ÆÀÌÅÛ º¹»ç...
  6.         return IS_HACKING( this, "Recv_cli_TRADE_P2P :: Trade from self" );
  7.     }
  8.  
  9.     classUSER *pUSER;
  10.  
  11.     pUSER = g_pObjMGR->Get_UserOBJ( pPacket->m_cli_TRADE_P2P.m_wObjectIDX );
  12.     if ( pUSER )
  13.     {
  14.         switch( pPacket->m_cli_TRADE_P2P.m_btRESULT )
  15.         {
  16.             case RESULT_TRADE_REQUEST :     // °Å·¡ ¿äû
  17.             {
  18.                 if ( !(this->m_dwPayFLAG & PLAY_FLAG_TRADE) )
  19.                 {
  20.                     return true;
  21.                 }
  22.                 if ( !(pUSER->m_dwPayFLAG & PLAY_FLAG_TRADE) )
  23.                 {
  24.                     return this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_NO_CHARGE_TARGET );
  25.                 }
  26.                      
  27.                 if ( pUSER->m_iTradeUserIDX || pUSER->m_IngSTATUS.IsIgnoreSTATUS() ) {
  28.                     // ´ë»óÀÌ ¹Ù»Ú´Ù..
  29.                     return this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_BUSY );
  30.                 }
  31.  
  32.                 int iDistance = distance ((int)m_PosCUR.x, (int)m_PosCUR.y, (int)pUSER->m_PosCUR.x, (int)pUSER->m_PosCUR.y);
  33.                 if ( iDistance > MAX_TRADE_DISTANCE )   {
  34.                     // °Å·¡ ¿äû pUSER¿ÍÀÇ °Å¸®´Â üũÈÄ Àڽſ¡°Ô °Å·¡Ãë¼Ò Àü¼Û...
  35.                     return this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_TOO_FAR );
  36.                 }
  37.  
  38.                 this->m_btTradeBIT = 0;
  39.                 this->m_iTradeUserIDX = pPacket->m_cli_TRADE_P2P.m_wObjectIDX;
  40.                 break;
  41.             }
  42.  
  43.             case RESULT_TRADE_ACCEPT :      // °Å·¡ ½ÂÀÎ Çß´Ù.
  44.             {
  45.                 if ( pUSER->m_iTradeUserIDX != this->Get_INDEX() )
  46.                 {
  47.                     return this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_CANCEL );
  48.                 }
  49.                 if ( this->m_IngSTATUS.IsIgnoreSTATUS() || pUSER->m_IngSTATUS.IsIgnoreSTATUS() )
  50.                 {
  51.                     pUSER->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_BUSY );
  52.                     this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_BUSY );
  53.                     return true;
  54.                 }
  55.  
  56.                 this->m_btTradeBIT = pUSER->m_btTradeBIT = BIT_TRADE_ACCEPT;
  57.                 this->m_iTradeUserIDX = pUSER->Get_INDEX();
  58.  
  59.                 ::ZeroMemory( pUSER->m_TradeITEM,   sizeof(tagTradeITEM) * MAX_TRADE_ITEM_SLOT );
  60.                 ::ZeroMemory( this->m_TradeITEM,    sizeof(tagTradeITEM) * MAX_TRADE_ITEM_SLOT );
  61.                 break;
  62.             }
  63.  
  64.             case RESULT_TRADE_REJECT :          // °Å·¡ °ÅºÎ.
  65.             case RESULT_TRADE_CANCEL :          // °Å·¡ µµÁß Ãë¼Ò.
  66.             {
  67.                 if ( pUSER->m_iTradeUserIDX == this->Get_INDEX() )
  68.                 {
  69.                     pUSER->m_btTradeBIT = pUSER->m_iTradeUserIDX = 0;
  70.                 }
  71.                 this->m_btTradeBIT  = this->m_iTradeUserIDX  = 0;
  72.                 break;
  73.             }
  74.  
  75.             case RESULT_TRADE_DONE :            // °Å·¡ ½ÇÇà.
  76.             {
  77.                 // ¼­·Î ´ë»ó¿¡ º¯È­°¡ ¾ø³ª ?
  78.                 if ( this->m_iTradeUserIDX != pUSER->Get_INDEX() || pUSER->m_iTradeUserIDX != this->Get_INDEX() )
  79.                 {
  80.                     this->m_btTradeBIT = this->m_iTradeUserIDX = 0;
  81.                     pUSER->m_btTradeBIT = pUSER->m_iTradeUserIDX = 0;
  82.                     return this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_CANCEL );
  83.                 }
  84.  
  85.                 // µÑ´Ù Áغñ°¡ ¿Ï·á µÆ³ª ?
  86.                 this->m_btTradeBIT |= BIT_TRADE_DONE;
  87.                 if ( pUSER->m_btTradeBIT != ( BIT_TRADE_READY | BIT_TRADE_DONE |BIT_TRADE_ACCEPT) ||
  88.                      this->m_btTradeBIT  != ( BIT_TRADE_READY | BIT_TRADE_DONE |BIT_TRADE_ACCEPT) )
  89.                 {
  90.                     return true;
  91.                 }
  92.  
  93.                 // Áװųª °³ÀλóÁ¡ ¸ðµå³Ä ?
  94.                 if ( this->m_IngSTATUS.IsIgnoreSTATUS() ||
  95.                      pUSER->m_IngSTATUS.IsIgnoreSTATUS() ||
  96.                     !this->Check_TradeITEM () ||
  97.                     !pUSER->Check_TradeITEM () )
  98.                 {
  99.                     this->m_btTradeBIT = this->m_iTradeUserIDX = 0;
  100.                     pUSER->m_btTradeBIT = pUSER->m_iTradeUserIDX = 0;
  101.                     this->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_CANCEL );
  102.                     pUSER->Send_gsv_TRADE_P2P( pPacket->m_cli_TRADE_P2P.m_wObjectIDX, RESULT_TRADE_CANCEL );
  103.                     return true;
  104.                 }
  105.  
  106.                 // ½ÇÁ¦ ¹°°Ç ±³È¯ ÇÒ°÷...
  107.                 classPACKET *pCPacket1 = Packet_AllocNLock ();
  108.                 //////////////////////////////////////////////////////////////////////////
  109.                 // 2006.06.12:À̼ºÈ°:pCPacket1, pCPacket2¿¡ ´ëÇÑ Null üũ
  110.                 if (!pCPacket1) {
  111.                     return false;
  112.                 }
  113.  
  114.                 classPACKET *pCPacket2 = Packet_AllocNLock ();
  115.                 if (!pCPacket2) {
  116.                     Packet_ReleaseNUnlock(pCPacket1);
  117.                     return false;
  118.                 }
  119.                 //////////////////////////////////////////////////////////////////////////
  120.  
  121.  
  122.                 pCPacket1->m_HEADER.m_wType = GSV_SET_MONEYnINV;
  123.                 pCPacket1->m_HEADER.m_nSize = sizeof( gsv_SET_MONEYnINV );
  124.                 pCPacket1->m_gsv_SET_MONEYnINV.m_btItemCNT = 0;
  125.  
  126.                 pCPacket2->m_HEADER.m_wType = GSV_SET_MONEYnINV;
  127.                 pCPacket2->m_HEADER.m_nSize = sizeof( gsv_SET_MONEYnINV );
  128.                 pCPacket2->m_gsv_SET_MONEYnINV.m_btItemCNT = 0;
  129.  
  130.                 if(!this->RemoveTradeItemFromINV ( pUSER, pCPacket1 )||!pUSER->RemoveTradeItemFromINV ( this, pCPacket2 ))
  131.                 {
  132.                     Packet_ReleaseNUnlock( pCPacket1 );
  133.                     Packet_ReleaseNUnlock( pCPacket2 );
  134.                     return false;
  135.                 }
  136.  
  137.                 if(!this->AddTradeItemToINV( pUSER/*pUSER->m_TradeITEM*/, pCPacket1 )||!pUSER->AddTradeItemToINV( this/*this->m_TradeITEM*/, pCPacket2 ))
  138.                 {
  139.                     Packet_ReleaseNUnlock( pCPacket1 );
  140.                     Packet_ReleaseNUnlock( pCPacket2 );
  141.                     return false;
  142.                 }
  143.  
  144.                 pCPacket1->m_HEADER.m_nSize += ( pCPacket1->m_gsv_SET_MONEYnINV.m_btItemCNT * sizeof( tag_SET_INVITEM ) );
  145.                 pCPacket1->m_gsv_SET_MONEYnINV.m_i64Money = this->GetCur_MONEY();
  146.  
  147.                 pCPacket2->m_HEADER.m_nSize += ( pCPacket2->m_gsv_SET_MONEYnINV.m_btItemCNT * sizeof( tag_SET_INVITEM ) );
  148.                 pCPacket2->m_gsv_SET_MONEYnINV.m_i64Money = pUSER->GetCur_MONEY();
  149.  
  150.                 this->SendPacket( pCPacket1 );
  151.                 pUSER->SendPacket( pCPacket2 );
  152.  
  153.                 Packet_ReleaseNUnlock( pCPacket1 );
  154.                 Packet_ReleaseNUnlock( pCPacket2 );
  155.  
  156.                 pUSER->Send_gsv_TRADE_P2P( this->Get_INDEX(), RESULT_TRADE_DONE, 0 );
  157.                 this->Send_gsv_TRADE_P2P( pUSER->Get_INDEX(), RESULT_TRADE_DONE, 0 );
  158.  
  159.                 this->m_btTradeBIT = this->m_iTradeUserIDX  = 0;
  160.                 pUSER->m_btTradeBIT = pUSER->m_iTradeUserIDX = 0;
  161.                 return true;
  162.             }
  163.             case RESULT_TRADE_CHECK_READY   :   // °Å·¡ Áغñ ¿Ï·á.
  164.                 this->m_btTradeBIT |= BIT_TRADE_READY;
  165.                 break;
  166.             case RESULT_TRADE_UNCHECK_READY :   // °Å·¡ Áغñ ÇØÁ¦
  167.                 this->m_btTradeBIT &= ~BIT_TRADE_READY ;
  168.                 pUSER->m_btTradeBIT &= ~BIT_TRADE_DONE;
  169.                 break;
  170.             case RESULT_TRADE_OUT_OF_INV :      // Àκ¥Å丮°¡ ²ËÂ÷¼­ ¹ÞÀ»¼ö ¾ø´Ù.
  171.                 if ( pPacket->m_cli_TRADE_P2P.m_cTradeSLOT < 0 ||
  172.                      pPacket->m_cli_TRADE_P2P.m_cTradeSLOT >= MAX_TRADE_ITEM_SLOT )
  173.                 {
  174.                     return IS_HACKING (this, "Recv_cli_TRADE_P2P" );
  175.                 }
  176.  
  177.                 pUSER->m_TradeITEM[ pPacket->m_cli_TRADE_P2P.m_cTradeSLOT ].m_Item.m_cType = 0;
  178.                 break;
  179.         }
  180.  
  181.         pUSER->Send_gsv_TRADE_P2P( this->Get_INDEX(), pPacket->m_cli_TRADE_P2P.m_btRESULT, pPacket->m_cli_TRADE_P2P.m_cTradeSLOT );
  182.     } else {
  183.         // ´ë»óÀÌ ¾ø´Ù.
  184.         this->m_btTradeBIT = this->m_iTradeUserIDX = 0;
  185.         this->Send_gsv_TRADE_P2P( this->m_iTradeUserIDX, RESULT_TRADE_NOT_TARGET );
  186.     }
  187.  
  188.     return true;
  189. }

here are all the possible states for the bit result used in the switch statement (equivalent of our 'action' used in function bool CWorldServer::pakTradeAction ( CPlayer* thisclient, CPacket* P )
  1. #define RESULT_TRADE_REQUEST            0x00   
  2. #define RESULT_TRADE_ACCEPT             0x01
  3. #define RESULT_TRADE_REJECT             0x02
  4. #define RESULT_TRADE_CANCEL             0x03
  5. #define RESULT_TRADE_CHECK_READY        0x04   
  6. #define RESULT_TRADE_UNCHECK_READY      0x05   
  7. #define RESULT_TRADE_DONE               0x06   
  8. #define RESULT_TRADE_BUSY               0x07   
  9. #define RESULT_TRADE_TOO_FAR            0x08   
  10. #define RESULT_TRADE_NOT_TARGET         0x09   
  11. #define RESULT_TRADE_OUT_OF_INV         0x0a   
  12. #define RESULT_TRADE_NO_CHARGE_TARGET   0x0b


I'm not quite sure exactly how it all works just yet but it does contain some actions that we are not currently using.
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


Return to Bugs

Who is online

Users browsing this forum: No registered users and 5 guests