ITM_SEND_TBL items are untradable.

06/25/2018 09:18 FlyffDeveloper#1
Hey everyone,


I'm using the itm_send_tbl to send item from my webshop to the players. However once I moved over from php to C# it seems like items from the webshop are untradeable.

I'm using the following snippet in my webshop code to create an entry to the ITM_SEND_TBL,

ITEM_SEND_TBL sendItem = new ITEM_SEND_TBL()
{
m_idPlayer = selectedCharacter,
serverindex = "01",
Item_Name = shopItem.itemid.ToString(),
Item_count = shopItem.count.Value,
idSender = "0000000",
ReceiveDt = DateTime.UtcNow,
SendComment = "Bought from Webshop"
};

Any ideas? I haven't done anything in the code related to sending items or trading items and this worked without any problems in the php version of the website with the same method of sending items.
06/25/2018 12:25 xTwiLightx#2
Your provided code does not help at all, since it only shows us how your instance is being constructed - better provide the classes' code. Is there any log written (error.txt, error.log, CQuery-Logfile)?

My only guess is that m_bCharged is set to 1 when a data set is being inserted into the table. Nonetheless that should not make the trading impossible iirc.
06/25/2018 12:34 FlyffDeveloper#3
Quote:
Originally Posted by xTwiLightx View Post
Your provided code does not help at all, since it only shows us how your instance is being constructed - better provide the classes' code. Is there any log written (error.txt, error.log, CQuery-Logfile)?

My only guess is that m_bCharged is set to 1 when a data set is being inserted into the table. Nonetheless that should not make the trading impossible iirc.
Im using an edmx to auto-generate the C# classes from the flyff-database tables. So I'm not sure what other additional information I can give.

I know that when it is inserted m_bCharged is set to 0 and I experimented with different values. Since I also thought it has to be something with that.

Certain items like fashion from a box also turns into 'Event Reward' items.
Which makes it seem like somewhere in the code or through the system it is set to be binded.
06/25/2018 12:47 xTwiLightx#4
That is strange, because there is no flag set when using ITEM_SEND_TBL.

Code:
BOOL CDbManager::SendItemtoCharacter( int nSlot, CMover* pMover, CQuery *qry, CQuery *qry1, CQuery *qrylog, LPDB_OVERLAPPED_PLUS lpDbOverlappedPlus )
and
Code:
BOOL CDbManager::GetSendItem( CQuery *pQry, __SendItemContents * pSendItemContents )
are your methods for research.

m_bCharged is set to "TRUE" in SendItemtoCharacter initially, but should be overwritten in GetSendItem:
Code:
pItemElem->m_bCharged				= pQry->GetInt( "m_bCharged" ) <= 0 ? TRUE : FALSE;
Also, m_bCharged is not being used as a check for trading.
06/25/2018 13:39 FlyffDeveloper#5
Alright I'll check those out.

Its weird if charged is unrelated to being tradeable or not. I know that it triggers the "TID_GAME_CANNOTTRADE_ITEM" message which is only being used in TradeSetItem2.

The only check in that method that I can imagine might be the culprit woud be the "IsBinds" check.

So what I tried was to disable a few of the checks temporarily to see which ones are causing the item to be untradeable.
Code:
BOOL CItemElem::IsBinds( void )
{
	ItemProp* pProperty = GetProp();
	if( m_dwKeepTime && pProperty->dwItemKind2 != IK2_WARP )
	{
		if(m_dwKeepTime > 0)
			return TRUE;
	}
		
#ifdef __MODEL_CHANGE
	if(m_dwnewID != NULL)
		return TRUE;
#endif
	
#if __VER >= 11 // __SYS_IDENTIFY
	if( g_xRandomOptionProperty->GetRandomOptionSize( GetRandomOptItemId() ) > 0
		&& ( g_xRandomOptionProperty->GetRandomOptionKind( this ) == CRandomOptionProperty::eBlessing || g_xRandomOptionProperty->GetRandomOptionKind( this ) == CRandomOptionProperty::eEatPet ) )
		return TRUE;
	if( GetLevelDown() < 0 )
		return TRUE;
#endif	// __SYS_IDENTIFY

	return FALSE;

        //Disable these two
	if( IsFlag( CItemElem::binds ) )
		//return TRUE;	
		
	if( (pProperty->dwFlag & IP_FLAG_BINDS) == IP_FLAG_BINDS )
		//return TRUE;
}
However even with these two checks at the bottom, items are still untradeable (although some items like fashion is tradeable, but any other items like scrolls are not).

I'll keep digging :)
06/27/2018 11:48 KingKeesie#6
Quote:
Originally Posted by FlyffDeveloper View Post
Alright I'll check those out.

Its weird if charged is unrelated to being tradeable or not. I know that it triggers the "TID_GAME_CANNOTTRADE_ITEM" message which is only being used in TradeSetItem2.

The only check in that method that I can imagine might be the culprit woud be the "IsBinds" check.

So what I tried was to disable a few of the checks temporarily to see which ones are causing the item to be untradeable.
Code:
BOOL CItemElem::IsBinds( void )
{
	ItemProp* pProperty = GetProp();
	if( m_dwKeepTime && pProperty->dwItemKind2 != IK2_WARP )
	{
		if(m_dwKeepTime > 0)
			return TRUE;
	}
		
#ifdef __MODEL_CHANGE
	if(m_dwnewID != NULL)
		return TRUE;
#endif
	
#if __VER >= 11 // __SYS_IDENTIFY
	if( g_xRandomOptionProperty->GetRandomOptionSize( GetRandomOptItemId() ) > 0
		&& ( g_xRandomOptionProperty->GetRandomOptionKind( this ) == CRandomOptionProperty::eBlessing || g_xRandomOptionProperty->GetRandomOptionKind( this ) == CRandomOptionProperty::eEatPet ) )
		return TRUE;
	if( GetLevelDown() < 0 )
		return TRUE;
#endif	// __SYS_IDENTIFY

	return FALSE;

        //Disable these two
	if( IsFlag( CItemElem::binds ) )
		//return TRUE;	
		
	if( (pProperty->dwFlag & IP_FLAG_BINDS) == IP_FLAG_BINDS )
		//return TRUE;
}
However even with these two checks at the bottom, items are still untradeable (although some items like fashion is tradeable, but any other items like scrolls are not).

I'll keep digging :)
Maybe try compare the fashion and scrolls entries in propitem/spec. Maybe something is different
06/27/2018 15:02 FlyffDeveloper#7
I doubt its anything in that. Because if I spawn the same item with /ci it is tradeable. So its def something being set in the code when its being sent over or something. I did some more testing yesterday and might have figured something out.

But I need to do some more testing to confirm.
06/27/2018 18:32 Blouflash#8
Quote:
Originally Posted by FlyffDeveloper View Post
I doubt its anything in that. Because if I spawn the same item with /ci it is tradeable. So its def something being set in the code when its being sent over or something. I did some more testing yesterday and might have figured something out.

But I need to do some more testing to confirm.
Visual Studio provides you with a debugger. Use it!

You can start your debugging journey here: CDPSrvr::OnTradePut
06/27/2018 19:11 FlyffDeveloper#9
What i've figured out is that the following check causes the majority of the items to be untradeable

"if( IsFlag( CItemElem::binds ) )"

so now I'm just looking at why the SendItem methods could be making it so that this flag is set to be untradeable.
07/15/2018 08:25 FlyffDeveloper#10
This issue can be closed as I fixed it.

There was some check in the IsBinds() code regarding the Model_Change feature that wasn't coded correctly and caused the issue.


#closerequest