Expired Item

08/30/2017 02:26 Yolo143#1
Hi,

I just wanted to know to make expired item cannot be wear/use again?
Because I set the days for expiration of the item via box, but after a the expiration they can still wear it (But no effect anymore) I just wanted to know how can I make it Auto Unwear and cannot be use/Wear again?

Thank you more power!
08/30/2017 20:05 iSynaptic#2
Hi,

as long as you set the CItemElem::expired Flag correctly ( which is used for this kind of stuff ) you can simply add:

Code:
SendDoEquip( pItemElem, pItemProp->dwParts );
in Function CDPClient::OnJoin( CAr & ar ) under:

Code:
sprintf( lpString, prj.GetText( TID_GAME_ENDUSE ), pItemProp->szName );
g_WndMng.PutString( lpString, NULL, prj.GetTextColor( TID_GAME_ENDUSE ) );
and the item will be unequipped if expired on login.

I didn't checked what happens if the item expires and the user is logged in - maybe it gets unequipped by default but if not, you have to loop the items in mover process or something like that ( would acually have a hard impact on performance i guess as long as you dont send a packet from client side if the item expires ).
08/31/2017 02:40 Yolo143#3
How about making it auto delete? do you have an idea for that? I mean if the item is expired the item will be automatically deleted? Thank you for your response!

EDIT:

they only automatically remove from being wear but they can still use it
09/01/2017 06:56 iSynaptic#4
Thats not possible without rewriting some other systems as well. The Pet System for example also uses the "expired" flag for pets that are dead and it would be a bad desicion to simply remove every expired item by default. There are may also other systems which use expired items in a important way - didnt researched it much.
09/01/2017 14:22 Yolo143#5
Quote:
Originally Posted by iSynaptic View Post
Thats not possible without rewriting some other systems as well. The Pet System for example also uses the "expired" flag for pets that are dead and it would be a bad desicion to simply remove every expired item by default. There are may also other systems which use expired items in a important way - didnt researched it much.
I see

I want to know how can I fix cannot equip expired item because its not working on me they can still wear it :(

Can you take alook here if this is correct or not :3 and also the auto remove item is only working on fashion part its not working on weapons please help me :handsdown:

Code:
void CDPClient::OnJoin( CAr & ar )
{
	CNetwork::GetInstance().OnEvent( CACHE_ACK_JOIN );
	
	// ata2k - (2)시간 해제
	g_Neuz.m_dwTimeOutDis = 0xffffffff;

	CWndBase* pWndBase	= g_WndMng.GetWndBase( APP_SELECT_CHAR );
	if( pWndBase )
		( (CWndSelectChar*)pWndBase )->Destroy();
	g_WndMng.CloseMessageBox();

	fJoin	= TRUE;
	OnSnapshot( ar );
	fJoin	= FALSE;

	CMover* pMover	= CMover::GetActiveMover();
	if( pMover )
	{
		time_t	tNULL	= time_null();
		for( int i = 0; i < pMover->m_Inventory.GetMax(); i++ )
		{
			CItemElem* pItemElem	= pMover->m_Inventory.GetAtId( i );
			if( pItemElem && pItemElem->m_dwKeepTime )
			{
				char lpString[260]	= { 0, };
				ItemProp* pItemProp		= pItemElem->GetProp();
				if( pItemElem->IsFlag( CItemElem::expired ) )
				{
					sprintf( lpString, prj.GetText( TID_GAME_ENDUSE ), pItemProp->szName );
					g_WndMng.PutString( lpString, NULL, prj.GetTextColor( TID_GAME_ENDUSE ) );
					SendDoEquip( pItemElem, pItemProp->dwParts );

				}
				else
				{
					time_t t	= pItemElem->m_dwKeepTime - tNULL;
					if( t > 0 )
					{
						CTimeSpan time( t );
						if( time.GetDays() )
						{
							sprintf( lpString, prj.GetText( TID_GAME_DAYUSE ), pItemProp->szName, static_cast<int>(time.GetDays() + 1) );
							g_WndMng.PutString( lpString, NULL, prj.GetTextColor( TID_GAME_DAYUSE ) );
						}
						else
						{
							sprintf( lpString, prj.GetText( TID_GAME_TIMEUSE ), pItemProp->szName, time.GetHours() + 1 );
							g_WndMng.PutString( lpString, NULL, prj.GetTextColor( TID_GAME_TIMEUSE ) );
						}
					}
					else
					{
						sprintf( lpString, prj.GetText( TID_GAME_TIMEUSE ), pItemProp->szName, 0 );
						g_WndMng.PutString( lpString, NULL, prj.GetTextColor( TID_GAME_TIMEUSE ) );
					}
				}
			}
		}
	}

#ifdef __GAME_GRADE_SYSTEM
	g_Neuz.m_dwTimeGameGradeMarkRendering = g_tmCurrent + SEC( CNeuzApp::GAME_GRADE_MARK_RENDERING_INTERVAL_SECOND );
#endif // __GAME_GRADE_SYSTEM

}
09/02/2017 06:46 iSynaptic#6
If this dont work, there is simply no m_dwKeepTime set on the items you provide.
I tested it with a 7 Days CS Set - Roled my Server to 7 days in future and the items got unequiped on login, so it worked there.
09/03/2017 01:25 Yolo143#7
There is I set it on 3 days (weapon) but the only item that is being remove is only the fashion party only and also even if its not expired the item will remove after you log-in again xD
09/03/2017 02:15 iSynaptic#8
If you changed the Server Settings, you also have to restart the DB Server, not only the World Server. Just create a 7 Days Set, equip it and relog and you will see that it dont get unequiped ( at least on my server ).
09/03/2017 06:40 Yolo143#9
So I think there's something wrong with my files now, yup I restarted my server but still got the same ending btw thanks again! :D