Jump to content

Fix item-shop on website 100% (Without ItemAward)


Draveniou1

Recommended Posts

  • Bronze

Hello.

Today we fixed the item-shop in a normal item market

Now you can use the item-shop normally and not with ItemAwardManager.cpp

We tried on a server with about 190 people online I think it works on a server with more players online 🙂

CHANGES:

1) OPEN IN DB FOLDER
2) SEARCH CACHE.CPP
3) OPEN

SEARCH:

	if (m_data.vnum == 0) // vnum이 0이면 삭제하라고 표시된 것이다.
	{
		char szQuery[QUERY_MAX_LEN];
		snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id);
		CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL);

		if (g_test_server)
			sys_log(0, "ItemCache::Flush : DELETE %u %s", m_data.id, szQuery);
	}


CHANGE WITH:


	if (m_data.vnum == 0) // vnum이 0이면 삭제하라고 표시된 것이다.
	{
		if (g_test_server)
		{
		}
	}

 

WARNING #01 

It does not work on all files but try to work on your own files

99% WORKING YOU CHECK UP

  • Metin2 Dev 1
  • Smile Tear 1
  • Scream 1
  • Lmao 6
  • Good 2
Link to comment
Share on other sites

  • Management
Link to comment
Share on other sites

  • Bronze
4 minutes ago, Karbust said:

Steve Harvey Reaction GIF

 

I mean this should stay that way so that the server does not get into error

	if (m_data.vnum == 0) // vnum이 0이면 삭제하라고 표시된 것이다.
	{
		if (g_test_server)
		{
		}
	}

 

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

  • Management
54 minutes ago, Draveniou1 said:

 

I mean this should stay that way so that the server does not get into error

	if (m_data.vnum == 0) // vnum이 0이면 삭제하라고 표시된 것이다.
	{
		if (g_test_server)
		{
		}
	}

 

You probably should figure out the why it breaks instead leaving a stupid and useless if... It doesn't return anything, so it literally goes through the if and executes whatever code comes after it.

  • Love 1

raw

raw

Link to comment
Share on other sites

  • Bronze
2 minutes ago, Karbust said:

You probably should figure out the why it breaks instead leaving a stupid and useless if... It doesn't return anything, so it literally goes through the if and executes whatever code comes after it.

you can change and you will eat a nice db.core

  • Lmao 5
Link to comment
Share on other sites

  • Contributor

@ Draveniou1 I hope you don't take it as an insult, I just want to explain this itemshop problem to you.

The non-item_award item_shop's problem are not coming from the DB, but the itemshop(.php) itself.
To solve the problem you have to do 2 things:

  • Checking your item id range in db/conf.txt
  • Inserting with a random id BUT outside of that vnum range in your itemshop.php

Doing that way, you'll never have id conflict even if you skip item_award.
Official chinese/hongkong server actually did this long time ago before item_award was a thing. (M2H conversation about this.)

Item_award was made to solve this problem, so I really not understand people who want to skip using it.

---------------------------------------------------------------------------------------

19 hours ago, ASIKOO said:

Hi,

The condition is empty, it should be deleted, right?

He didn't delete it because there is an else right after that and he probably didn't know what to do in this situation so he left it blank.
His code would look like this in the right formatting:

void CItemCache::OnFlush()
{
	if (m_data.vnum != 0) // not equal instead of equal
	{
		[...] // this is the former else statement content!
	}

	[...]
}

But as I said, the problem lies in the itemshop.php, not in the db, so I do not advise to edit this.

Edited by TMP4
  • Good 2
  • Love 1
  • Love 4
Link to comment
Share on other sites

  • Bronze
1 hour ago, TheLionIK said:

Or...use item award like a normal human being.  Thanks.

I agree, but I also tried to make the regular item-shop

 

--------------------------------------------------------------

The problem with the normal item-shop is that items are deleted from memory after a time limit

--------------------------

char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL);

--------------------------------------------------------------

Link to comment
Share on other sites

53 minutes ago, Draveniou1 said:

I agree, but I also tried to make the regular item-shop

 

--------------------------------------------------------------

The problem with the normal item-shop is that items are deleted from memory after a time limit

--------------------------

char szQuery[QUERY_MAX_LEN]; snprintf(szQuery, sizeof(szQuery), "DELETE FROM item%s WHERE id=%u", GetTablePostfix(), m_data.id); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_DESTROY, 0, NULL);

--------------------------------------------------------------

Because it's not means to be used this way ... item_award exist for a reason, touching the item table while the game is running it's stupid (unless you modify no cache items like safebox)

  • Metin2 Dev 1
  • Good 1
Link to comment
Share on other sites

Announcements



×
×
  • 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.