Jump to content

Recommended Posts

Hi guys!

 

While i was watching on youtube videos , I saw accidentally noticed the problem in Metin2 videos. The problem for you, I'll help you solve the problem for you both as you know.

 

BUG VİDEO 

 

Let's solve the bug! :D

 

Open exchange.cpp and search; 

for (i = 0; i < INVENTORY_MAX_NUM / 2; ++i)
	{
		if (!(item = victim->GetInventoryItem(i)))
			continue;

		s_grid1.Put(i, 1, item->GetSize());
	}

dc45f37b53.png

Find this code;

for (i = 0; i < INVENTORY_MAX_NUM / 2; ++i)

EDİT : 

bool CExchange::CheckSpace()
{
	static CGrid s_grid1(5, INVENTORY_MAX_NUM / 5 / 4 ); // inven page 1
	static CGrid s_grid2(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 2
	static CGrid s_grid3(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 3
	static CGrid s_grid4(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 4
	
	s_grid1.Clear();
	s_grid2.Clear();
	s_grid3.Clear();
	s_grid4.Clear();

	LPCHARACTER	victim = GetCompany()->GetOwner();
	LPITEM item;

	int i;
	/* PAGE SLOT COUNT fixed exchange bug from one item copright -cBaraN- */
	int INVENTORY_PAGE_SLOT_COUNT = INVENTORY_MAX_NUM/4;
	for (i = 0; i < INVENTORY_PAGE_SLOT_COUNT; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
        s_grid1.Put(i, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT; i < INVENTORY_PAGE_SLOT_COUNT*2; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
        s_grid2.Put(i - INVENTORY_PAGE_SLOT_COUNT, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT*2; i < INVENTORY_PAGE_SLOT_COUNT*3; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
        s_grid3.Put(i - INVENTORY_PAGE_SLOT_COUNT*2, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT*3; i < INVENTORY_PAGE_SLOT_COUNT*4; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;
        s_grid4.Put(i - INVENTORY_PAGE_SLOT_COUNT*3, 1, item->GetSize());
    }

	// ¾Æ... ¹º°¡ °³º´½Å °°Áö¸¸... ¿ëÈ¥¼® Àκ¥À» ³ë¸Ö Àκ¥ º¸°í µû¶ó ¸¸µç ³» À߸øÀÌ´Ù ¤Ğ¤Ğ
	static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM);
	
	// ÀÏ´Ü ¿ëÈ¥¼®À» ±³È¯ÇÏÁö ¾ÊÀ» °¡´É¼ºÀÌ Å©¹Ç·Î, ¿ëÈ¥¼® Àκ¥ º¹»ç´Â ¿ëÈ¥¼®ÀÌ ÀÖÀ» ¶§ Çϵµ·Ï ÇÑ´Ù.
	bool bDSInitialized = false;
	
	for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
	{
		if (!(item = m_apItems[i]))
			continue;

		if (item->IsDragonSoul())
		{
			if (!victim->DragonSoul_IsQualified())
			{
				return false;
			}

			if (!bDSInitialized)
			{
				bDSInitialized = true;
				victim->CopyDragonSoulItemGrid(s_vDSGrid);
			}

			bool bExistEmptySpace = false;
			WORD wBasePos = DSManager::instance().GetBasePosition(item);
			if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
				return false;
			
			for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
			{
				WORD wPos = wBasePos + i;
				if (0 == s_vDSGrid[wBasePos])
				{
					bool bEmpty = true;
					for (int j = 1; j < item->GetSize(); j++)
					{
						if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
						{
							bEmpty = false;
							break;
						}
					}
					if (bEmpty)
					{
						for (int j = 0; j < item->GetSize(); j++)
						{
							s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] =  wPos + 1;
						}
						bExistEmptySpace = true;
						break;
					}
				}
				if (bExistEmptySpace)
					break;
			}
			if (!bExistEmptySpace)
				return false;
		}
		else
		{
			int iPos = s_grid1.FindBlank(1, item->GetSize());

			if (iPos >= 0)
			{
				s_grid1.Put(iPos, 1, item->GetSize());
			}else
			{
				iPos = s_grid2.FindBlank(1, item->GetSize());

				if (iPos >= 0)
				{
					s_grid2.Put(iPos, 1, item->GetSize());
				}else
				{
					iPos = s_grid3.FindBlank(1, item->GetSize());
					
					if (iPos >= 0)
					{
						s_grid3.Put(iPos, 1, item->GetSize());
					}else
					{
						iPos = s_grid4.FindBlank(1, item->GetSize());
						
						if (iPos >= 0)
						{
							s_grid4.Put(iPos, 1, item->GetSize());
						}else
						{
							return false;
						}
					}
				}
			}
		}
	}

	return true;
}

Best regards;

Can BARAN... 

 

Watch this video if you want to thank.  : :D

when u try change a 2sword hand ( 3 slots )  and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory.

 

I hope that I have been helpful with this little information about the bug.

 

And sorry my english.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 2
  • Love 6
Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/
Share on other sites

You must create new grids too.

This bug appears only if you implement them wrong. 

Nice post, bro! :)

 

 

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4


s_grid3.Clear();
s_grid4.Clear();


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid3.Put(i, 1, item->GetSize());
}


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid4.Put(i, 1, item->GetSize());
}
  • Love 1
Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38836
Share on other sites

 

You must create new grids too.

This bug appears only if you implement them wrong. 

Nice post, bro! :)

 

 

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4


s_grid3.Clear();
s_grid4.Clear();


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid3.Put(i, 1, item->GetSize());
}


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid4.Put(i, 1, item->GetSize());
}

 

 

Try as you will see, I told you my bro. :D

 

Best regards;

Can BARAN... 

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38839
Share on other sites

 

 

You must create new grids too.

This bug appears only if you implement them wrong. 

Nice post, bro! :)

 

 

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4


s_grid3.Clear();
s_grid4.Clear();


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid3.Put(i, 1, item->GetSize());
}


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid4.Put(i, 1, item->GetSize());
}

 

 

Try as you will see, I told you my bro. :D

 

Best regards;

Can BARAN... 

 

 

Yeah... Tested right now, but you must add the grids too. 

Thank you again for this post ! :D

  • Love 1
Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38840
Share on other sites

when u try change a 2sword hand ( 3 slots )  and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory.

 

I hope that I have been helpful with this little information about the bug.

 

And sorry my english.

  • Love 1
Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38853
Share on other sites

when u try change a 2sword hand ( 3 slots )  and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory.

 

I hope that I have been helpful with this little information about the bug.

 

And sorry my english.

 

Thanks for the explanation bro. 

 

Best regards;

Can BARAN...

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38854
Share on other sites

 

You must create new grids too.

This bug appears only if you implement them wrong. 

Nice post, bro! :)

 

 

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4


s_grid3.Clear();
s_grid4.Clear();


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid3.Put(i, 1, item->GetSize());
}


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid4.Put(i, 1, item->GetSize());
}

 

 

You're wrong

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4

Will cause the bugs but there is a fix for this.

 

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38865
Share on other sites

 

 

You must create new grids too.

This bug appears only if you implement them wrong. 

Nice post, bro! :)

 

 

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4


s_grid3.Clear();
s_grid4.Clear();


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid3.Put(i, 1, item->GetSize());
}


for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i)
{
if (!(item = victim->GetInventoryItem(i)))
continue;


s_grid4.Put(i, 1, item->GetSize());
}

 

 

You're wrong

static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3
static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4

Will cause the bugs but there is a fix for this.

 

 

 

 

I've never encountered any problem with Inventory Slots using INVENTORY_MAX_NUM/5 / 2

But... whatever

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38911
Share on other sites

 

not work i tested...any other solution?

 

 

So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing.

 

 

Correct structure works, i tested.

 

Best regards;

Can BARAN...

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38975
Share on other sites

  • Premium

 

 

not work i tested...any other solution?

 

 

So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing.

 

 

Correct structure works, i tested.

 

Best regards;

Can BARAN...

 

 

Think about it.

You added a variable which it's not used by anything. How can a simple variable, which is never used, to change how your code works? Check what you've posted again.

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38977
Share on other sites

 

 

 

not work i tested...any other solution?

 

 

So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing.

 

 

Correct structure works, i tested.

 

Best regards;

Can BARAN...

 

 

Think about it.

You added a variable which it's not used by anything. How can a simple variable, which is never used, to change how your code works? Check what you've posted again.

 

 

Freebsd "gmake clean" will not work without using the code. Try again.

 

Best regards;

Can BARAN...

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38986
Share on other sites

You are not being reasonable, nor replying to the actual question.

 

Maybe you did fix something, but if you did, I have to agree with Cataclismo, it's not published in this thread.

Instead of blindly doing gmake clean, explain why should it fix anything to add a variable.

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38987
Share on other sites

You are not being reasonable, nor replying to the actual question.

 

Maybe you did fix something, but if you did, I have to agree with Cataclismo, it's not published in this thread.

Instead of blindly doing gmake clean, explain why should it fix anything to add a variable.

 

 

Ow... sorry, I forgot to share resources. I add to this thread. Thx, think :)

 

Best regards;

Can BARAN...

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-38992
Share on other sites

 

 

Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files)

 

This is not used in game source , so how can it work?

 

 

It's not working. Read above.

 

I understand , last night when I read the topic seemed strange to just add a variable.

 

I see now he edited the subject, and it may work.

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-39004
Share on other sites

 

 

Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files)

 

This is not used in game source , so how can it work?

 

 

It's not working. Read above.

 

 

I renew the expression. You can look at.

 

Best regards;

Can BARAN...

Link to comment
https://metin2.dev/topic/6096-how-to-fix-exchange-bug-src/#findComment-39005
Share on other sites

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.