Jump to content

GF v18.1 - Messenger Get Friend Names


Recommended Posts

  • Forum Moderator

M2 Download Center

This is the hidden content, please
( Internal )

Github repository:

This is the hidden content, please

  • Metin2 Dev 50
  • Eyes 2
  • Dislove 1
  • Not Good 1
  • Think 1
  • Confused 1
  • Good 10
  • Love 1
  • Love 34
Link to comment
Share on other sites

Webzen didn't create a new function to return m_FriendNameMap. They just make m_FriendNameMap public. (It was protected before). Also, you can use const_iterator instead of iterator. (You're not modifying it.)

Here is the reversed version of webzen's function.

This version is for c++11

Spoiler

PyObject * messengerGetFriendNames(PyObject * poSelf, PyObject * poArgs)
{
	const CPythonMessenger & messenger = CPythonMessenger::Instance();	
	PyObject * mainTuple = PyTuple_New(messenger.m_FriendNameMap.size());	
	
	uint32_t pos = 0;
	for (const auto friendName : messenger.m_FriendNameMap)
	{
		PyTuple_SetItem(mainTuple, pos, PyString_FromString(friendName.c_str()));
		++pos;
	}

	return mainTuple;
}

 

This is for c++03

Spoiler

PyObject * messengerGetFriendNames(PyObject * poSelf, PyObject * poArgs)
{
	const CPythonMessenger & messenger = CPythonMessenger::Instance();	
	PyObject * mainTuple = PyTuple_New(messenger.m_FriendNameMap.size());	
	
	int pos = 0;
	for (std::set<std::string>::const_iterator it = messenger.m_FriendNameMap.begin(); it != messenger.m_FriendNameMap.end(); ++it)
	{
		PyTuple_SetItem(mainTuple, pos, PyString_FromString(it->c_str()));
		++pos;
	}

	return mainTuple;
}

 

PS:

This function has come with a system that called mailbox. 

Best Regards

Ken

  • Love 2

Do not be sorry, be better.

Link to comment
Share on other sites

  • Forum Moderator
1 hour ago, Ken said:

Webzen didn't create a new function to return m_FriendNameMap. They just make m_FriendNameMap public. (It was protected before). Also, you can use const_iterator instead of iterator. (You're not modifying it.)

I was thinking of this way too, but i'm was so bored to remake tutorial for replace protected m_FriendNameMap with public one <_<, because i did it some months ago just for mailbox. 

Spoiler

i9gtfab.png

 

Edited by Metin2 Dev
Core X - External 2 Internal
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.