Jump to content

Recommended Posts

Hey guys Im using files that when i close the warehouse the items disappear after i close it

 

I search and the error is from the channel 1 core and it shows this 

LoadSafebox: cannot create item vnum 0 id 70000046 (name: MODERADOR)

It says that the item vnum is 0 and dont take the right item vnum

Can someone tell my where i can check LoadSafebox if it is in the source or not?

Link to comment
https://metin2.dev/topic/18168-items-disappear-after-close-warehouse/
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

19 hours ago, anonim55 said:

You could delete all items from all accounts' safebox and see if happens again. I am not sure but you can try.

It still happen :( i think is something from LoadSafeBox at char.cpp

char.cpp

Spoiler

void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems)
{
    bool bLoaded = false;

    //PREVENT_TRADE_WINDOW
    SetOpenSafebox(true);
    //END_PREVENT_TRADE_WINDOW

    if (m_pkSafebox)
        bLoaded = true;

    if (!m_pkSafebox)
        m_pkSafebox = M2_NEW CSafebox(this, iSize, dwGold);
    else
        m_pkSafebox->ChangeSize(iSize);

    m_iSafeboxSize = iSize;

    TPacketCGSafeboxSize p;

    p.bHeader = HEADER_GC_SAFEBOX_SIZE;
    p.bSize = iSize;

    GetDesc()->Packet(&p, sizeof(TPacketCGSafeboxSize));

    if (!bLoaded)
    {
        for (int i = 0; i < iItemCount; ++i, ++pItems)
        {
            if (!m_pkSafebox->IsValidPosition(pItems->pos))
                continue;

            LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id);

            if (!item)
            {
                sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName());
                continue;
            }

            item->SetSkipSave(true);
            item->SetSockets(pItems->alSockets);
            item->SetAttributes(pItems->aAttr);

            if (!m_pkSafebox->Add(pItems->pos, item))
            {
                M2_DESTROY_ITEM(item);
            }
            else
                item->SetSkipSave(false);
        }
    }
}

 

32 minutes ago, Fenix2009 said:

It still happen :( i think is something from LoadSafeBox at char.cpp

char.cpp

  Hide contents

void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems)
{
    bool bLoaded = false;

    //PREVENT_TRADE_WINDOW
    SetOpenSafebox(true);
    //END_PREVENT_TRADE_WINDOW

    if (m_pkSafebox)
        bLoaded = true;

    if (!m_pkSafebox)
        m_pkSafebox = M2_NEW CSafebox(this, iSize, dwGold);
    else
        m_pkSafebox->ChangeSize(iSize);

    m_iSafeboxSize = iSize;

    TPacketCGSafeboxSize p;

    p.bHeader = HEADER_GC_SAFEBOX_SIZE;
    p.bSize = iSize;

    GetDesc()->Packet(&p, sizeof(TPacketCGSafeboxSize));

    if (!bLoaded)
    {
        for (int i = 0; i < iItemCount; ++i, ++pItems)
        {
            if (!m_pkSafebox->IsValidPosition(pItems->pos))
                continue;

            LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id);

            if (!item)
            {
                sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName());
                continue;
            }

            item->SetSkipSave(true);
            item->SetSockets(pItems->alSockets);
            item->SetAttributes(pItems->aAttr);

            if (!m_pkSafebox->Add(pItems->pos, item))
            {
                M2_DESTROY_ITEM(item);
            }
            else
                item->SetSkipSave(false);
        }
    }
}

 

Hello,
I have compared my and you source and I have same code of char.cpp as you and I dont get this error. So I think there is error elsewhere.
 

If I helped you, do not forget to press "Thanks" button! 

3 minutes ago, .Rise said:

Hello,
I have compared my and you source and I have same code of char.cpp as you and I dont get this error. So I think there is error elsewhere.
 

Can u check input_db.cpp? Pls

Maybe is when it sends the data to the database it occurs the error

here is mine 

If u could do that would be nice :)

Spoiler

void CInputDB::SafeboxLoad(LPDESC d, const char * c_pData)
{
    if (!d)
        return;

    TSafeboxTable * p = (TSafeboxTable *) c_pData;

    if (d->GetAccountTable().id != p->dwID)
    {
        sys_err("SafeboxLoad: safebox has different id %u != %u", d->GetAccountTable().id, p->dwID);
        return;
    }

    if (!d->GetCharacter())
        return;

    BYTE bSize = 1;

    LPCHARACTER ch = d->GetCharacter();

    //PREVENT_TRADE_WINDOW
    if (ch->GetOfflineShopOwner() || ch->GetShopOwner() || ch->GetExchange() || ch->GetMyShop() || ch->IsCubeOpen() || ch->IsAttrTransferOpen() )
    {
        d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른거래창이 열린상태에서는 창고를 열수가 없습니다." ) );
        d->GetCharacter()->CancelSafeboxLoad();
        return;
    }
    //END_PREVENT_TRADE_WINDOW

    // ADD_PREMIUM
    if (d->GetCharacter()->GetPremiumRemainSeconds(PREMIUM_SAFEBOX) > 0 ||
            d->GetCharacter()->IsEquipUniqueGroup(UNIQUE_GROUP_LARGE_SAFEBOX))
        bSize = 3;
    // END_OF_ADD_PREMIUM

    //if (d->GetCharacter()->IsEquipUniqueItem(UNIQUE_ITEM_SAFEBOX_EXPAND))
    //bSize = 3; // 창고확장권

    //d->GetCharacter()->LoadSafebox(p->bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
    d->GetCharacter()->LoadSafebox(bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
}

 

2 minutes ago, Fenix2009 said:

Can u check input_db.cpp? Pls

Maybe is when it sends the data to the database it occurs the error

here is mine 

If u could do that would be nice :)

  Hide contents

void CInputDB::SafeboxLoad(LPDESC d, const char * c_pData)
{
    if (!d)
        return;

    TSafeboxTable * p = (TSafeboxTable *) c_pData;

    if (d->GetAccountTable().id != p->dwID)
    {
        sys_err("SafeboxLoad: safebox has different id %u != %u", d->GetAccountTable().id, p->dwID);
        return;
    }

    if (!d->GetCharacter())
        return;

    BYTE bSize = 1;

    LPCHARACTER ch = d->GetCharacter();

    //PREVENT_TRADE_WINDOW
    if (ch->GetOfflineShopOwner() || ch->GetShopOwner() || ch->GetExchange() || ch->GetMyShop() || ch->IsCubeOpen() || ch->IsAttrTransferOpen() )
    {
        d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른거래창이 열린상태에서는 창고를 열수가 없습니다." ) );
        d->GetCharacter()->CancelSafeboxLoad();
        return;
    }
    //END_PREVENT_TRADE_WINDOW

    // ADD_PREMIUM
    if (d->GetCharacter()->GetPremiumRemainSeconds(PREMIUM_SAFEBOX) > 0 ||
            d->GetCharacter()->IsEquipUniqueGroup(UNIQUE_GROUP_LARGE_SAFEBOX))
        bSize = 3;
    // END_OF_ADD_PREMIUM

    //if (d->GetCharacter()->IsEquipUniqueItem(UNIQUE_ITEM_SAFEBOX_EXPAND))
    //bSize = 3; // 창고확장권

    //d->GetCharacter()->LoadSafebox(p->bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
    d->GetCharacter()->LoadSafebox(bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
}

 

No... Still same (only I dont have OfflineShop and AttrTransfer..

There is mine:

void CInputDB::SafeboxLoad(LPDESC d, const char * c_pData)
{
	if (!d)
		return;

	TSafeboxTable * p = (TSafeboxTable *) c_pData;

	if (d->GetAccountTable().id != p->dwID)
	{
		sys_err("SafeboxLoad: safebox has different id %u != %u", d->GetAccountTable().id, p->dwID);
		return;
	}

	if (!d->GetCharacter())
		return;

	BYTE bSize = 1;

	LPCHARACTER ch = d->GetCharacter();

	//PREVENT_TRADE_WINDOW
	if (ch->GetShopOwner() || ch->GetExchange() || ch->GetMyShop() || ch->IsCubeOpen() )
	{
		d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른거래창이 열린상태에서는 창고를 열수가 없습니다." ) );
		d->GetCharacter()->CancelSafeboxLoad();
		return;
	}
	//END_PREVENT_TRADE_WINDOW

	// ADD_PREMIUM
	if (d->GetCharacter()->GetPremiumRemainSeconds(PREMIUM_SAFEBOX) > 0 ||
			d->GetCharacter()->IsEquipUniqueGroup(UNIQUE_GROUP_LARGE_SAFEBOX))
		bSize = 3;
	// END_OF_ADD_PREMIUM

	//if (d->GetCharacter()->IsEquipUniqueItem(UNIQUE_ITEM_SAFEBOX_EXPAND))
	//bSize = 3; // 창고확장권

	//d->GetCharacter()->LoadSafebox(p->bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
	d->GetCharacter()->LoadSafebox(bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
}

 

If I helped you, do not forget to press "Thanks" button! 

Just now, .Rise said:

No... Still same (only I dont have OfflineShop and AttrTransfer..

There is mine:


void CInputDB::SafeboxLoad(LPDESC d, const char * c_pData)
{
	if (!d)
		return;

	TSafeboxTable * p = (TSafeboxTable *) c_pData;

	if (d->GetAccountTable().id != p->dwID)
	{
		sys_err("SafeboxLoad: safebox has different id %u != %u", d->GetAccountTable().id, p->dwID);
		return;
	}

	if (!d->GetCharacter())
		return;

	BYTE bSize = 1;

	LPCHARACTER ch = d->GetCharacter();

	//PREVENT_TRADE_WINDOW
	if (ch->GetShopOwner() || ch->GetExchange() || ch->GetMyShop() || ch->IsCubeOpen() )
	{
		d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른거래창이 열린상태에서는 창고를 열수가 없습니다." ) );
		d->GetCharacter()->CancelSafeboxLoad();
		return;
	}
	//END_PREVENT_TRADE_WINDOW

	// ADD_PREMIUM
	if (d->GetCharacter()->GetPremiumRemainSeconds(PREMIUM_SAFEBOX) > 0 ||
			d->GetCharacter()->IsEquipUniqueGroup(UNIQUE_GROUP_LARGE_SAFEBOX))
		bSize = 3;
	// END_OF_ADD_PREMIUM

	//if (d->GetCharacter()->IsEquipUniqueItem(UNIQUE_ITEM_SAFEBOX_EXPAND))
	//bSize = 3; // 창고확장권

	//d->GetCharacter()->LoadSafebox(p->bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
	d->GetCharacter()->LoadSafebox(bSize * SAFEBOX_PAGE_SIZE, p->dwGold, p->wItemCount, (TPlayerItem *) (c_pData + sizeof(TSafeboxTable)));
}

 

WTF why the fck it assumes the item vnum is 0, just dont get it...

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.