Custom GRade Item Database problems

Results 1 to 1 of 1
  1. #1
    Apprentice TenshiNano is offline
    MemberRank
    Oct 2013 Join Date
    12Posts

    Custom GRade Item Database problems

    Hi,

    I'm here to ask for help after 2 days of search and fixing for the Custom grade Item system released buy Avalion.

    I fixed the database saving problem, the +0% problem but there is one last thing who happens and its pretty strange.

    If i drop one item with bonus for exemple :

    +50 DEX
    +50 STR

    And then i restart the server, values will change. I looked into database on INVENTORY_TBL and values just swap place. Like that :


    Good bonus (The real one dropped on server)
    0,199,0,0,,1,0,7200000,0,0,0,-1036260812,0,0,0,0,0,2,185017091,460553,0,0

    Wrong bonus (The one who is used when i restart the server)
    0,199,0,0,,1,0,7200000,0,0,0,-1036260812,0,0,0,0,0,2,460553,185017091,0,0

    And if i restart more than once, if i'm lucky, values just swap back and goes in the good position, and the bonus are correct again.
    I checked my SaveOneItem and GetOneItem function and everything seems good ...
    Here they are :

    SaveOneItem:
    Code:
    void CDbManager::SaveOneItem( CItemElem* pItemElem, PItemStruct pItemStruct )
    Code:
    {
    	char szPiercing[32]		= {0,};
    
    
    	if( pItemElem->IsEmpty() == FALSE )
    	{
    #if __VER >= 11 // __MA_VER11_05	// 케릭터 봉인 거래 기능 world,database,neuz
    		if( pItemElem->m_dwItemId == II_SYS_SYS_SCR_SEALCHARACTER )
    			sprintf( pItemStruct->szItem, "%d,%d,%d,%d,,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
    					pItemElem->m_dwObjId, pItemElem->m_dwItemId,
    					0, 0, 
    					pItemElem->m_nItemNum, pItemElem->m_nRepairNumber,
    					pItemElem->m_nHitPoint, pItemElem->m_nRepair,
    					0, pItemElem->m_byFlag,
    					pItemElem->GetSerialNumber(), pItemElem->GetOption(), 
      					pItemElem->m_bItemResist, pItemElem->m_nResistAbilityOption,
      					pItemElem->m_idGuild,
    					pItemElem->m_nResistSMItemId
    				);
    		else
    			sprintf( pItemStruct->szItem, "%d,%d,%d,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
    #ifdef __ITEMGRADE
    			",%d,%d,%I64d"
    #endif
    #ifdef __OLD_NEW_GLOW_V2
    			",%d"
    #endif // __OLD_NEW_GLOW_V2
    #ifdef __BLING_BLING
    			",%d"
    #endif
    #ifdef __MODEL_CHANGE
    			",%d"
    #endif // __MODEL_CHANGE
    
    
    			"/",
    					pItemElem->m_dwObjId, pItemElem->m_dwItemId,
    					0, 0, pItemElem->m_szItemText,
    					pItemElem->m_nItemNum, pItemElem->m_nRepairNumber,
    					pItemElem->m_nHitPoint, pItemElem->m_nRepair,
    					0, pItemElem->m_byFlag,
    					pItemElem->GetSerialNumber(), pItemElem->GetOption(), 
      					pItemElem->m_bItemResist, pItemElem->m_nResistAbilityOption,
      					pItemElem->m_idGuild,
    					pItemElem->m_nResistSMItemId
    #ifdef __ITEMGRADE
    					, pItemElem->nGetGrade()
    					, pItemElem->GetItemGradeMain()
    					, pItemElem->GetItemGradeOpt()			
    #endif					
    #ifdef __OLD_NEW_GLOW_V2
    					, pItemElem->m_nNewGlow
    #endif // __OLD_NEW_GLOW_V2
    #ifdef __BLING_BLING
    					, pItemElem->m_nReflect
    #endif
    #ifdef __MODEL_CHANGE
    					, pItemElem->m_dwnewID
    #endif // __MODEL_CHANGE
    
    
    
    
    );


    GetOneItem:

    Code:
    int CDbManager::GetOneItem( CItemElem* pItemElem, char* pstrItem, int *pLocation )
    Code:
    {
    	int IndexItem		= 0;
    	IndexItem	= GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_dwItemId	= (DWORD)GetIntPaFromStr( pstrItem, pLocation );
    	BOOL bEquip	= GetIntPaFromStr( pstrItem, pLocation );
    	int nTrade	= GetIntPaFromStr( pstrItem, pLocation );
    	GetStrPaFromStr( pstrItem, pItemElem->m_szItemText, pLocation );
    	pItemElem->m_nItemNum	= GetIntPaFromStr( pstrItem, pLocation );
    
    
    	if( CheckValidItem( pItemElem->m_dwItemId, pItemElem->m_nItemNum ) == FALSE )
    		pItemElem->m_nItemNum	= 1;
    
    
    	pItemElem->m_nRepairNumber	= (BYTE)GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_nHitPoint	= GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_nRepair	= GetIntPaFromStr( pstrItem, pLocation );
    	int nMaterial	= GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_byFlag		= (BYTE)GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->SetSerialNumber( GetSerialNumberPaFromStr( pstrItem, pLocation ) );
    	pItemElem->SetOption( GetIntPaFromStr( pstrItem, pLocation ) );
    	pItemElem->m_bItemResist	= (BYTE)GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_nResistAbilityOption	= GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_idGuild = (u_long)GetIntPaFromStr( pstrItem, pLocation );
    	pItemElem->m_nResistSMItemId = GetIntPaFromStr( pstrItem, pLocation );
    #ifdef __ITEMGRADE
    	pItemElem->nSetGrade(GetIntPaFromStr(pstrItem, pLocation));
    	pItemElem->SetItemGradeMain(GetIntPaFromStr(pstrItem, pLocation));
    	pItemElem->SetItemGradeOpt(GetInt64PaFromStr(pstrItem, pLocation));
    #endif
    
    
    	pItemElem->m_dwObjId		= IndexItem;
    
    
    #if __VER >= 11 // __MA_VER11_05	// 케릭터 봉인 거래 기능 world,database,neuz
    	if( pItemElem->m_dwItemId == II_SYS_SYS_SCR_SEALCHARACTER )
    	{
    	#if __VER >= 11 // __SYS_PLAYER_DATA
    		CPlayerDataCenter::GetInstance()->m_Access.Enter();
    		const char*	lpszPlayer	= CPlayerDataCenter::GetInstance()->GetPlayerString( pItemElem->m_nHitPoint );
    	#else	// __SYS_PLAYER_DATA
    		LPCSTR lpszPlayer	= prj.GetPlayerString( pItemElem->m_nHitPoint );
    	#endif	// __SYS_PLAYER_DATA
    		if( lpszPlayer != NULL)
    			memcpy(pItemElem->m_szItemText,lpszPlayer,sizeof(pItemElem->m_szItemText));
    	#if __VER >= 11 // __SYS_PLAYER_DATA
    		CPlayerDataCenter::GetInstance()->m_Access.Leave();
    	#endif	// __SYS_PLAYER_DATA
    	}
    #endif // __MA_VER11_05	// 케릭터 봉인 거래 기능 world,database,neuz
    
    
    #ifdef __OLD_NEW_GLOW_V2
    	pItemElem->m_nNewGlow = GetIntPaFromStr( pstrItem, pLocation );
    	if( pItemElem->m_nNewGlow < FALSE )
    		pItemElem->m_nNewGlow = NULL;
    	else
    	if( pItemElem->m_nNewGlow > TRUE )
    		pItemElem->m_nNewGlow = NULL;
    #endif // __OLD_NEW_GLOW_V2	
    #ifdef __BLING_BLING
    	pItemElem->m_nReflect = GetIntPaFromStr( pstrItem, pLocation );
    	if( pItemElem->m_nReflect < FALSE )
    		pItemElem->m_nReflect = NULL;
    	else
    	if( pItemElem->m_nReflect > TRUE )
    		pItemElem->m_nReflect = NULL;
    #endif
    #ifdef __MODEL_CHANGE
    	pItemElem->m_dwnewID = GetIntPaFromStr( pstrItem, pLocation);
    	ItemProp * pItemProp = prj.GetItemProp( pItemElem->m_dwnewID);
    		if(!pItemProp)
    		{
    			pItemElem->m_dwnewID = NULL;
    		}
    		else if(pItemElem->m_dwnewID == NULL_ID)
    		{
    			pItemElem->m_dwnewID = NULL;
    		}
    	
    #endif
    	++*pLocation;
    	return IndexItem;
    }


    Do you know what's wrong with this ?

    Thanks alot =)

    Sorry for my bad english i'm belgium :/




Advertisement