Jump to content

Dungeon flag in chat


caanmasu

Recommended Posts

  • Active Member

 

Hello
With some forum colleagues we have created a command to display the flags of a dungeon for debugging purposes.

 

 

spacer.png

 

Usage:

/dgetf [map_index]

If map_index is not specified, the index of the current map is taken.

 

cmd.cpp
Add:

ACMD(do_dgetf);


Add command in list (above of { "\n",): 

	{ "dgetf",	do_dgetf,		0,		POS_DEAD,	GM_IMPLEMENTOR },



 

cmd_gm.cpp
Add this block:

ACMD(do_dgetf)
{
	char arg1[256];
	
	one_argument(argument, arg1, sizeof(arg1));
	
	if(!ch)
		return;
	
	DWORD mapIndex = ch->GetMapIndex();
	
	if (*arg1)
		str_to_number(mapIndex, arg1);
		
	LPDUNGEON pDungeon = CDungeonManager::instance().FindByMapIndex(mapIndex);
	if (pDungeon)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "Dungeon flag list for %d:", mapIndex);
		pDungeon->SendFlagList(ch);
	}
	else
		ch->ChatPacket(CHAT_TYPE_INFO, "No dungeon found for mapindex: %d", mapIndex);
}

 

dungeon.cpp

Add this block:

void CDungeon::SendFlagList(LPCHARACTER ch)
{
	for (const auto& [key, val]: m_map_Flag)
		ch->ChatPacket(CHAT_TYPE_INFO, "%s: %d", key.c_str(),val);
}


dungeon.h
Add below of "void    SetWarpLocation (long map_index, int x, int y);":
 

	void	SendFlagList(LPCHARACTER ch);



Greetings.

  • Metin2 Dev 2
  • Love 1
Link to comment
Share on other sites

  • Premium
void CDungeon::SendFlagList(LPCHARACTER ch)
{
	for (auto iter = m_map_Flag.begin(); iter != m_map_Flag.end(); ++iter)
		ch->ChatPacket(CHAT_TYPE_INFO, "%s: %d", iter->first.c_str(),iter->second);
}

Since we've done the c++17 version, this is the c++11 version if someone needs it

  • Metin2 Dev 2
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.