Jump to content

'GetMapIndex' was not declared in this scope


Recommended Posts

I am trying to install offline shop search system on Ken offline shop
I get a error while compiling.The screenshot is below

https://metin2.download/picture/LEPdX96xNi77pkeEr4SkwrQyJXXeVLOA/.png

I cant find where this GetMapIndex function is
There is a similar function in char.cpp where it doesn't throw error but in offlineshop_manager.cpp it does

I tried to locate the function where it is in char.cpp but no success

I am attaching my char.cpp here

char.cpp

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

As you said I checked in entity.h the function is there and its already included in offlineshop_manager.cpp

To be precide what I am trying to do is.

I hope my screenshot will help fix this system

Function location

https://metin2.download/picture/R99gXIvjEfup4a3dqO8r92vF3E8K9Mh6/.png

 

What I am trying to do

https://metin2.download/picture/2F68n0T3JWOgIgmc2cHuG1w4i9lORkXi/.png

 

When I create offline shop for first in Map1 an entry is made in database mapIndex=1

https://metin2.download/picture/c3AWOdmjJipy202R2b2aBuq2Cm1Ih9Zc/.png

https://metin2.download/picture/bv75IQBS1l7V64RS7ve91IPkr64Q0mDs/.png

But when I use add item menu offline shop menu the entry in mapIndex=0

 

 

 

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

I thank you to all the people who have taken effort in solving my issue.

meneleos special thank to you.

Its working now

But another bug

Th search is case sensitive, it shows the items only when I type the exact word

For example if I search "Sword" it shows list of swords. A screenshot below

https://metin2.download/picture/4ZQTFp0QY7JBgzhQfsy5w8Hi6Xz3FNCW/.png

But If I type "sword" the list doesnt appears

My search code is here 

void CInputMain::PrivateSearch(LPCHARACTER ch, const char * data)
{

	struct packet_private_search * pinfo = (struct packet_private_search *) data;
	const char* Item_Search = pinfo->item_name; //Nombre Recibido
	int Item_Gold = pinfo->item_gold;

	if (strlen(Item_Search) == 0){
		ch->ChatPacket(CHAT_TYPE_INFO,"[Shop Search] Type any name.");
		return;
	}
	if (Item_Gold < 0){
		ch->ChatPacket(CHAT_TYPE_INFO,"[Shop Search] Set a value greater than 0");
		return;
	}
	if (Item_Gold > 2000000000){
		ch->ChatPacket(CHAT_TYPE_INFO,"[Shop Search] Place a value less than 2kkk");
		return;
	}


	int check = 0;
	int check_0 = 0;
    char szQuery[1024];
	snprintf(szQuery, sizeof(szQuery),"SELECT * FROM player.offline_shop_item WHERE status=0 and mapIndex=%d",ch->GetMapIndex());
	std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery));
	std::auto_ptr<SQLMsg> pMsg1(DBManager::Instance().DirectQuery(szQuery));

	if (pMsg->Get()->uiNumRows > 0) 
	{
		//Check si no existe ningun item con ese nombre
		while (MYSQL_ROW row_check = mysql_fetch_row(pMsg1->Get()->pSQLResult))
		{
			const char * Item_Totales_0 = row_check[43]; //Nombres Tablas
			const char * Item_Vnums_0 = row_check[4]; //Vnums Tablas
			const char * Item_Gold_0 = row_check[41]; //Gold Tablas

		 	DWORD Vnum_Item_0 = 0;
			str_to_number(Vnum_Item_0, Item_Vnums_0); //Convierte el vnum de string a numero entero

			int Gold_Item_0 = 0;
			str_to_number(Gold_Item_0, Item_Gold_0); //Convierte el vnum de string a numero entero

			if (strstr(Item_Totales_0, Item_Search)){
				check++;
			}
			if (Item_Gold > 0){
				if (Gold_Item_0 <= Item_Gold){
					check_0++;
				}
			}
		}
		if(check == 0){
			ch->ChatPacket(CHAT_TYPE_INFO,"[Shop Search] No item with that name is found.");
			return;
		}
		if (Item_Gold > 0){
			if(check_0 == 0){
				ch->ChatPacket(CHAT_TYPE_INFO,"[Shop Search] There is no item with that value.");
				return;
			}
		}

		while (MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult))
		{
			const char * Item_Totales = row[43]; //Nombres Tablas
			const char * Item_Vnums = row[4]; //Vnums Tablas
			const char * Item_Gold_1 = row[41]; //Gold Tablas

		 	DWORD Vnum_Item = 0;
			str_to_number(Vnum_Item, Item_Vnums); //Convierte el vnum de string a numero entero

			int Gold_Item = 0;
			str_to_number(Gold_Item, Item_Gold_1); //Convierte el vnum de string a numero entero

			if (strstr(Item_Totales, Item_Search)){
				if (Item_Gold > 0){
					if (Gold_Item <= Item_Gold){
						ch->ChatPacket(CHAT_TYPE_COMMAND, "PrivateSearch_ItemsSearch %d",Vnum_Item);
						ch->ChatPacket(CHAT_TYPE_COMMAND, "PrivateSearch_RefreshItems");
					}
				}else{
					ch->ChatPacket(CHAT_TYPE_COMMAND, "PrivateSearch_ItemsSearch %d",Vnum_Item);
					ch->ChatPacket(CHAT_TYPE_COMMAND, "PrivateSearch_RefreshItems");
				}
			}
		}
	}
}

 

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

Here is the Shop Search System for Ken Offline Shop.

#Link removed

It has few bugs known to my knowledge

Problem1-It checks for case sensitive while searching items.It means you have to type the correct name of item as it shows in your inventory.

Problem2 -The list is not get cleared even when there are no offline shop is in town

Problem3-The item doesnt show bonus in the list

Problem4-There is a core crash error which I have shown below

https://metin2.download/picture/g7gq5Lrc7t9a3C3G0DFDEa3Tvfm46Eb2/.png

(gdb) bt full
#0  COfflineShopManager::DestroyOfflineShop (this=0xbfbfbcb4, ch=0x0,
    dwVID=29563, bDestroyAll=false) at offlineshop_manager.cpp:198
        npc = 0x4808e000
        pkOfflineShop = 0x33bfb310
        szQuery3 = "▒\000\000\000\000\000\000\000\000\\▒▒3x▒▒▒\000\000\000\000\0                                                                                           00\000\000\000\024\000\000\000t\005▒(\\▒▒▒\\▒▒▒ذ▒▒▒▒\236(▒\200▒(\\▒▒▒(▒▒▒▒▒\236(     

If someone can fix these bugs the system will be usable for any server with ken offline shop

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

  • Contributor

I am pretty sure the system is been sold by felipard (WorldArd), So getting help with it is againt the rules 

If you bought the system(I don't think you did) go contact the author

 

@Raylee

On 8/12/2019 at 2:39 PM, WeedHex said:

The list loading is from python I think, taking item_proto names.

If someone release the clean code for "intelligent research" can be cool.

	def UpdateItemsList(self):
		i = 0
		if len(self.inputValue.GetText()) > 2:
			items_list = item.GetItemsByName(str(self.inputValue.GetText()))
			for items in items_list:
				i += 1
				print items
				self.ItemsSlotBar.SetSize(155, 1+ (i*HEIGHT_STEP))
				self.ItemsList.SetSize(155, 1+ (i*HEIGHT_STEP))
				self.SetSize(START_WIDTH, START_HEIGHT + (i*HEIGHT_STEP))
				self.board.SetSize(START_WIDTH, START_HEIGHT + (i*HEIGHT_STEP))
				self.SearchButton.SetPosition(45, 52)
				self.CloseButton.SetPosition(45, 30)
				self.ItemsSlotBar.Show()
				item.SelectItem(items)
				itemName = item.GetItemName()
				self.ItemsList.AppendItem(Item(itemName, items))
		else:
			self.SetSize(START_WIDTH, START_HEIGHT)
			self.board.SetSize(START_WIDTH, START_HEIGHT)
			self.SearchButton.SetPosition(45, 52)
			self.CloseButton.SetPosition(45, 30)
			self.ItemsSlotBar.Hide()

 

  • Love 1

My only accounts are here and on M2D, Don't trust anyone else from other shitty sites.
266868740522639360.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.