Jump to content

MALL window item's size bug


Go to solution Solved by Abel(Tiger),

Recommended Posts

  • Contributor

Hey, currently I'm trying to help a friend with a mall window bug where every item's size is 1 somehow (check picture).
My first thought it is some fcked up source code, but after we took my serverfile's source and take all items from the window and reinserted new ones
to item_award the newly insterted items was bugged again to my biggest surprise.

So it is not source-related I believe. Any idea what can cause such bug? item_award and item table are identical with mine and now the source code too. The items have correct size in item_proto and do behave normal in inventory window.

My friend with the same source:

255900Screenshot-1.png

My with the same source:

255900Screenshot-2.png

I can't even guess what can cause such bug, again it's not source-related beleive me or not 🙂

Edited by TMP4
Link to comment
Share on other sites

  • Contributor
11 hours ago, Mitachi said:

I'm not sure, but it seems to me that it shares the same grid as metin2's basic store.
Check the grids in your src

spacer.png

It's 5 and 9, it's a base src. As I said i believe it's not src related problem, is it possible that there are any setting at config files, conf.txt, database or even in client that could cause the grid system / item size (either it is) bug to produce this error?

Shops, Safebox, Inventory are good tho, it is only the mall. I've never seen a bug like this before.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Active+ Member
  • Solution

For the mall the grid is placed on the db, check ClientManager.cpp bellow this line:

CGrid grid(5, MAX(1, pi->pSafebox->bSize) * 9);

screenshot-780.png

 

screenshot-781.png

 

Also try this (a common bug in metin2 source):

In ClientManagerBoot.cpp search:

sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

And move it before the iterator is initialized like this:

	m_map_itemTableByVnum.clear();
	
	// Now it's here
	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

	itertype(m_vec_itemTable) it = m_vec_itemTable.begin();

	while (it != m_vec_itemTable.end())
	{
		TItemTable * item_table = &(*(it++));

		sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u", 
				item_table->dwVnum,
				item_table->szName,
				item_table->szLocaleName,
				item_table->alValues[0],
				item_table->alValues[1],
				item_table->alValues[2],
				item_table->alValues[3],
				item_table->alValues[4],
				item_table->alValues[5],
				item_table->dwWearFlags,
				item_table->dwAntiFlags,
				item_table->dwImmuneFlag,
				item_table->dwRefinedVnum,
				item_table->wRefineSet,
				item_table->bAlterToMagicItemPct);

      	// Also you can insert these values after the sort but because we
        // already looping through the list of items once (for the syslog), it's better to 
      	// move the sort function above (the complexity is half this way)
		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
	}

	// It was here
	
	return true;

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 4
Link to comment
Share on other sites

  • Contributor
1 hour ago, Abel(Tiger) said:

For the mall the grid is placed on the db, check ClientManager.cpp bellow this line:

CGrid grid(5, MAX(1, pi->pSafebox->bSize) * 9);

screenshot-780.png

 

screenshot-781.png

 

Also try this (a common bug in metin2 source):

In ClientManagerBoot.cpp search:

sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

And move it before the iterator is initialized like this:

	m_map_itemTableByVnum.clear();
	
	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

	itertype(m_vec_itemTable) it = m_vec_itemTable.begin();

	while (it != m_vec_itemTable.end())
	{
		TItemTable * item_table = &(*(it++));

		sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u", 
				item_table->dwVnum,
				item_table->szName,
				item_table->szLocaleName,
				item_table->alValues[0],
				item_table->alValues[1],
				item_table->alValues[2],
				item_table->alValues[3],
				item_table->alValues[4],
				item_table->alValues[5],
				item_table->dwWearFlags,
				item_table->dwAntiFlags,
				item_table->dwImmuneFlag,
				item_table->dwRefinedVnum,
				item_table->wRefineSet,
				item_table->bAlterToMagicItemPct);

		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
	}
	
	return true;

 

I have a clue now.

My reference serverfile have 1 page safebox but my firend's server have enabled 3 page safebox in account.account table (safebox_expire column, it's a default feature btw) for every account, so that's why it's good for me and bad for him with the same source files. 
"CGrid grid(5, MAX(1, pi->pSafebox->bSize) * 9);"

I can't test it right now but I'm sure that it is the problem. Thanks for pointing out to that row 🙂

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Active+ Member

That variable it's always 1 for the mall window, my advice is to compare all the code from function CClientManager::RESULT_SAFEBOX_LOAD with a clasic one and solve the bug with the addresses I told you about.

Link to comment
Share on other sites

  • Contributor
On 8/26/2021 at 1:36 PM, Abel(Tiger) said:

For the mall the grid is placed on the db, check ClientManager.cpp bellow this line:

CGrid grid(5, MAX(1, pi->pSafebox->bSize) * 9);

screenshot-780.png

 

screenshot-781.png

 

Also try this (a common bug in metin2 source):

In ClientManagerBoot.cpp search:

sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

And move it before the iterator is initialized like this:

	m_map_itemTableByVnum.clear();
	
	// Now it's here
	sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());

	itertype(m_vec_itemTable) it = m_vec_itemTable.begin();

	while (it != m_vec_itemTable.end())
	{
		TItemTable * item_table = &(*(it++));

		sys_log(1, "ITEM: #%-5lu %-24s %-24s VAL: %ld %ld %ld %ld %ld %ld WEAR %lu ANTI %lu IMMUNE %lu REFINE %lu REFINE_SET %u MAGIC_PCT %u", 
				item_table->dwVnum,
				item_table->szName,
				item_table->szLocaleName,
				item_table->alValues[0],
				item_table->alValues[1],
				item_table->alValues[2],
				item_table->alValues[3],
				item_table->alValues[4],
				item_table->alValues[5],
				item_table->dwWearFlags,
				item_table->dwAntiFlags,
				item_table->dwImmuneFlag,
				item_table->dwRefinedVnum,
				item_table->wRefineSet,
				item_table->bAlterToMagicItemPct);

      	// Also you can insert these values after the sort but because we
        // already looping through the list of items once (for the syslog), it's better to 
      	// move the sort function above (the complexity is half this way)
		m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
	}

	// It was here
	
	return true;

 

After I moved that sort to upper as you suggested, the bug disappeard. 

Still don't know why it was good in one serverfile, why it wasen't in the other one WITH THE SAME SOURCE, maybe there are some setting, option anywhere that cause this, but your trick clearly solved the bug so I ticked it as the best asnwer, thank you 🙂

(I should have try it earlier but as I said I'm helping a friend with this and we did not have time yesterday)

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Similar Content

  • Activity

    1. 5

      Effect weapons

    2. 3

      Crystal Metinstone

    3. 3

      Feeding game source to LLM

    4. 113

      Ulthar SF V2 (TMP4 Base)

    5. 3

      Feeding game source to LLM

    6. 0

      Target Information System

    7. 3

      Feeding game source to LLM

    8. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.