Jump to content
Maintenance ×
×
×
  • Create New...

Emotion Notice in Message


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hello,

Today i saw some people search this.....
With [007]Dawis char clicked emotion to [TEST] char...

 

Python Version

Spoiler


Root => UiTarget.py


Search this

 

Spoiler

def __OnEmotionAllow(self):


Add this

 

Spoiler

        import player
        sender = player.GetName()
        net.SendChatPacket("/emotion_allow %d" % (self.vid))

net.SendWhisperPacket( (self.nameString), "{} requested the use of emotions with you".format(player.GetName()) )

 

 

C++ Version by @ ASIKOO

 

ACMD(do_emotion_allow)
{
	if ( ch->GetArena() )
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
		return;
	}

	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));

	if (!*arg1)
		return;

	uint32_t	val = 0; str_to_number(val, arg1);

#ifdef M2_FEATURE_NOTICE_EMOTION
	LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(val);

	if (tch)
	{

		bool bFrom = !(s_emotion_set.find(std::make_pair(ch->GetVID(), val)) == s_emotion_set.end());
		bool bTo = !(s_emotion_set.find(std::make_pair(val, ch->GetVID())) == s_emotion_set.end());

		if (bFrom && bTo)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You are currently sharing emotions with your partner! <3");

			return;
		}

		if (!bFrom && bTo)
		{
			s_emotion_set.insert(std::make_pair(ch->GetVID(), val));

			ch->ChatPacket(CHAT_TYPE_INFO, "You allowed emotions with %s.", tch->GetName());
			tch->ChatPacket(CHAT_TYPE_INFO, "%s allowed to share emotions.", ch->GetName());

			return;
		}

		if (bFrom)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You have already asked to share emotions with %s...", tch->GetName());
			ch->ChatPacket(CHAT_TYPE_INFO, "Don't anger your partner and be patient!");

			return;
		}
		else
		{
			s_emotion_set.insert(std::make_pair(ch->GetVID(), val));

			ch->ChatPacket(CHAT_TYPE_INFO, "You asked to share emotions with %s.", tch->GetName());
			tch->ChatPacket(CHAT_TYPE_INFO, "%s requested to share emotions with you.", ch->GetName());

			return;
		}
	}
#else
	s_emotion_set.insert(std::make_pair(ch->GetVID(), val));
#endif
}

 

Best Regards,
[007]Dawis

  • Metin2 Dev 10
  • Love 3
  • Sad 1
Link to comment
Share on other sites

  • 3 months later...
  • Premium
On 23/02/2018 at 1:59 PM, xprtn1337 said:

isnt there missing something?

 

"szeretne érzelmeket veled." => request to kiss,slap etc...

No, you just request to use the emotions.

The short form of that spoiler that is not clear and not even in english is:

Go into uitarget, look for __OnEmoticonAllow and add: 

net.SendWhisperPacket( (self.nameString), "{} requested the use of emotions with you".format(player.GetName()) )

 

Link to comment
Share on other sites

  • 4 weeks later...
On 2018. 02. 27. at 3:15 PM, Fleon said:

No, you just request to use the emotions.

The short form of that spoiler that is not clear and not even in english is:

Go into uitarget, look for __OnEmoticonAllow and add: 

net.SendWhisperPacket( (self.nameString), "{} requested the use of emotions with you".format(player.GetName()) )

 

Fixed.ii forget to translate this. from hungary to ENG.

On 2018. 02. 23. at 2:59 PM, xprtn1337 said:

isnt there missing something?

 

"szeretne érzelmeket veled." => request to kiss,slap etc...

Not missing just my default language is Hungarian....
And i forget to translate into eng...
Now is ENG.
Thank @Fleon

  • Love 1
Link to comment
Share on other sites

  • 4 years later...
  • Administrator

C++ Version

In: cmd_emotion.cpp (game source)
Add:

#include "config.h"

Find:

ACMD(do_emotion_allow)
{
	[...]
}

Replace like this:

ACMD(do_emotion_allow)
{
	if ( ch->GetArena() )
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
		return;
	}

#ifdef M2_FEATURE_NOTICE_EMOTION
	if (thecore_heart->pulse - (int32_t)ch->GetLastShoutPulse() < passes_per_sec * 15)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "Please, stop spam!");
		return;
	}

	ch->SetLastShoutPulse(thecore_heart->pulse);
#endif

	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));

	if (!*arg1)
		return;

	uint32_t	val = 0; str_to_number(val, arg1);
	s_emotion_set.insert(std::make_pair(ch->GetVID(), val));

#ifdef M2_FEATURE_NOTICE_EMOTION
	LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(val);
	if (tch)
	{
		tch->ChatPacket(CHAT_TYPE_INFO, "%s requested the use of emotions with you %s", ch->GetName(), tch->GetName());
	}
#endif
}

And add define in your service.h or similar:

#define M2_FEATURE_NOTICE_EMOTION
  • Metin2 Dev 1
  • Good 1

english_banner.gif

Link to comment
Share on other sites

  • Premium
Posted (edited)

@ASIKOONice idea! Would be nice, if you can do little improvement to that: 

When you click on do_emotion_allow button, allowed emotions will be set to 1 for that character and after the teleport or relog it will be resetted to 0. It will prevent the spamming ChatPacket. I know you did a prevention for that already, but solution from my idea should be little bit better.

And you can add a chat packet information for that player who sent a request to allow emotions:

Spoiler
	LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(val);
	
	if (ch)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Emotions from %s were allowed."), tch->GetName());
	}
	
	if (tch)
	{
		tch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s wants to share emotions with you."), ch->GetName());
	}

 

Edited by ReFresh
  • Good 1

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • Administrator
52 minutes ago, ReFresh said:

@ASIKOONice idea! Would be nice, if you can do little improvement to that: 

When you click on do_emotion_allow button, allowed emotions will be set to 1 for that character and after the teleport or relog it will be resetted to 0. It will prevent the spamming ChatPacket. I know you did a prevention for that already, but solution from my idea should be better.

And you can add a chat packet information for that player who sent a request to allow emotions:

  Hide contents
	LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(val);
	
	if (ch)
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Emotions from %s were allowed."), tch->GetName());
	}
	
	if (tch)
	{
		tch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s wants to share emotions with you."), ch->GetName());
	}

 

I did this, I think we can do even more optimized.
I tried :

ACMD(do_emotion_allow)
{
	if ( ch->GetArena() )
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."));
		return;
	}

	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));

	if (!*arg1)
		return;

	uint32_t	val = 0; str_to_number(val, arg1);

#ifdef M2_FEATURE_NOTICE_EMOTION
	LPCHARACTER tch = CHARACTER_MANAGER::instance().Find(val);

	if (tch)
	{

		bool bFrom = !(s_emotion_set.find(std::make_pair(ch->GetVID(), val)) == s_emotion_set.end());
		bool bTo = !(s_emotion_set.find(std::make_pair(val, ch->GetVID())) == s_emotion_set.end());

		if (bFrom && bTo)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You are currently sharing emotions with your partner! <3");

			return;
		}

		if (!bFrom && bTo)
		{
			s_emotion_set.insert(std::make_pair(ch->GetVID(), val));

			ch->ChatPacket(CHAT_TYPE_INFO, "You allowed emotions with %s.", tch->GetName());
			tch->ChatPacket(CHAT_TYPE_INFO, "%s allowed to share emotions.", ch->GetName());

			return;
		}

		if (bFrom)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, "You have already asked to share emotions with %s...", tch->GetName());
			ch->ChatPacket(CHAT_TYPE_INFO, "Don't anger your partner and be patient!");

			return;
		}
		else
		{
			s_emotion_set.insert(std::make_pair(ch->GetVID(), val));

			ch->ChatPacket(CHAT_TYPE_INFO, "You asked to share emotions with %s.", tch->GetName());
			tch->ChatPacket(CHAT_TYPE_INFO, "%s requested to share emotions with you.", ch->GetName());

			return;
		}
	}
#else
	s_emotion_set.insert(std::make_pair(ch->GetVID(), val));
#endif
}

 

  • Metin2 Dev 1
  • Love 1
  • Good 1

english_banner.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.