Jump to content
Logo
Your Metin2 zone for C++, Python, Lua.

Item Shop dracaryS


Erio

Recommended Posts

Witam mam problem z dodaniem systemu dracaryS

1. Error (DB)

ClientManager.cpp: In member function 'bool CClientManager::InitializeItemShop()':
ClientManager.cpp:4395:51: error: cannot convert 'std::unique_ptr<_SQLMsg>' to 'SQLMsg*' {aka '_SQLMsg*'} in initial                                                                                                                         ization
 4395 |  SQLMsg* pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   std::unique_ptr<_SQLMsg>

 

2. Error (DB)

ClientManager.cpp:4715:28: error: 'GetEventFlag' was not declared in this scope; did you mean 'SetEventFlag'?
 4715 |          DWORD newItemID = GetEventFlag("SPECIAL_ITEM_ID") + 1;
      |                            ^~~~~~~~~~~~
      |                            SetEventFlag
ClientManager.cpp:4716:51: error: no matching function for call to 'CClientManager::SetEventFlag(const char [16], DW                                                                                                                         ORD&)'
 4716 |          SetEventFlag("SPECIAL_ITEM_ID", newItemID);
      |                                                   ^

 

Link to comment

Żeby naprawić błąd 1 musisz przepisać kod, prawdopodobnie itemshop był pisany na starszą wersję kodu

Użyj:

std::unique_ptr<SQLMsg> pMsg = CDBManager::instance().DirectQuery(szQuery, SQL_PLAYER);

Co do błędu 2, nie wiem o jaką dokładnie paczkę chodzi, ale może brakować include na górze pliku bądź po prostu nie ma tej definicji.

Kod Metin2 w pigułce 😂 (Metin2 Code in Nutshell 😂)

tak.png

https://grzyb.ovh/

Link to comment

Tak właśnie jest Muchomorku ^^

Korzystam z podstawki "Terenzo 2023"

void CClientManager::SetDragonCoin(DWORD id, long long amount)
{
	char szQuery[84];
	snprintf(szQuery, sizeof(szQuery), "UPDATE account.account SET coins = %lld WHERE id = %d", amount, id);
	std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery));
}

void CClientManager::ItemShopIncreaseSellCount(DWORD itemID, int itemCount)
{
	long long sellCount = 0;
	char szQuery[84];
	snprintf(szQuery, sizeof(szQuery), "SELECT sellCount FROM player.ishop_data WHERE id = %u", itemID);
	std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery));
	if (pMsg->Get()->uiNumRows > 0)
	{
		MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
		str_to_number(sellCount, row[0]);
	}
	//sellCount += itemCount;
	sellCount += 1;
	snprintf(szQuery, sizeof(szQuery), "UPDATE player.ishop_data SET sellCount = %lld WHERE id = %u", sellCount, itemID);
	std::unique_ptr<SQLMsg> pMsgLast(CDBManager::instance().DirectQuery(szQuery));
}
long long CClientManager::GetDragonCoin(DWORD id)
{
	char szQuery[84];
	snprintf(szQuery, sizeof(szQuery), "SELECT coins FROM account.account WHERE id = %d", id);
	std::unique_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery));
	if (pMsg->Get()->uiNumRows == 0)
		return 0;
	MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
	long long dc = 0;
	str_to_number(dc, row[0]);
	return dc;
}

 

Link to comment
Guest
This topic is now closed to further replies.
Style Version: 0.1

The code was completely created from scratch and optimized.

The basic style on which it was created: Default

Created by: Grzyb.ovh

The style was to be simple to browse topics, devoid of graphics, uniform in color and definitely simple. ×

×
×
  • Create New...

Important Information

Do you like cookies? 🍪 We use cookies to provide the highest quality of service. Learn more