Jump to content

Official Block System - Messenger


Recommended Posts

Am 9.7.2017 um 21:54 schrieb Dimitar:

How did you mean it? I just did these steps: https://pastebin.com/WFHspvrw , nothing else.

Did you changed the packet.h on serversource & binary too? - so on both packet.h files?
Because if you have in serversource packet.h 29 and in binary packet.h 30 -> you will get the "Unknown packet header" problem.

Best regards.

Link to comment
Share on other sites

  • Bronze
La 09.07.2017 la 10:09, flexio a spus:

When a player write from channel 1 to 99(example) core drops. 

input_main.cpp


else if (MessengerManager::instance().IsBlocked_Target(ch->GetName(), pkChr->GetName()))

change to


else if (pkChr && MessengerManager::instance().IsBlocked_Target(ch->GetName(), pkChr->GetName()))

 

La 29.06.2017 la 15:12, Mali61 a spus:

I know :facepalm: simple only 1 return

if you do this, you can send/recive mesages to/from the person you blocked without any error. :(

Link to comment
Share on other sites

  • 2 weeks later...
  • Bronze

Hi guys i have a Problem with this System: 

Client Sysser

0727 19:16:33089 :: AttributeError
0727 19:16:33089 :: : 
0727 19:16:33089 :: 'module' object has no attribute 'IsBlockByName'
0727 19:16:33089 :: 

 

I can`t remove blocked players. 

and when i click on a player i cant see the bar with Whisper, Exchange Friend Duel and with Gm account i see the bar

i dont understand Where I should insert that -.- 

//In Server-Side:

	if (MessengerManager::instance().IsBlocked(player1name, player2name))
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BLOKLANDIN"));
		return;
	}
	if (MessengerManager::instance().IsFriend(player1name, player2name))
	{
		ChatPacket(CHAT_TYPE_INFO, "This is your friend.");
		return;
	}
//In Client:
	if messenger.IsBlockByName(player2name) or messenger.IsBlockByName(player1name):
		return
		
//In Quest
	if pc.is_blocked(targetname) == true then
		say("This player blocked")
		
	if pc.is_friend(targetname) == true then
		say("This is your friend")

 

Link to comment
Share on other sites

  • Bronze
Acum 18 ore, Reco a spus:

Hi guys i have a Problem with this System: 

Client Sysser

0727 19:16:33089 :: AttributeError
0727 19:16:33089 :: : 
0727 19:16:33089 :: 'module' object has no attribute 'IsBlockByName'
0727 19:16:33089 :: 

 

I can`t remove blocked players. 

and when i click on a player i cant see the bar with Whisper, Exchange Friend Duel and with Gm account i see the bar

i dont understand Where I should insert that -.- 


//In Server-Side:

	if (MessengerManager::instance().IsBlocked(player1name, player2name))
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BLOKLANDIN"));
		return;
	}
	if (MessengerManager::instance().IsFriend(player1name, player2name))
	{
		ChatPacket(CHAT_TYPE_INFO, "This is your friend.");
		return;
	}
//In Client:
	if messenger.IsBlockByName(player2name) or messenger.IsBlockByName(player1name):
		return
		
//In Quest
	if pc.is_blocked(targetname) == true then
		say("This player blocked")
		
	if pc.is_friend(targetname) == true then
		say("This is your friend")

 

you can insert that if u want to do something by yourself. I mean if pc.is_blocked == true begin say("somebody hates you") .Function that you can use in client/server source /quest.

Link to comment
Share on other sites

  • Honorable Member
On 28.07.2017 at 6:04 PM, ProblemsIn said:

Is little bit weird when u block someone, u can't see him but he can see u.

If i block a guy is because i don't want to he know i'm there, i guess

 

That feature doesn't included this topic

 

Link to comment
Share on other sites

5 hours ago, Mali61 said:

That feature doesn't included this topic

U could add that feature on the system. The system itself would be much more appealing.

If I block someone and that person keeps seeing me ... It does not make much sense, since I can not see her anymore and her can see me normally.
It was much better if it were the other way round, I say.

It's just an opinion.

Link to comment
Share on other sites

  • 5 months later...
  • Bronze

@Mali61 if you changed something in the system,something doesn't work in cmd_general

cmd_general.cpp: In function 'void do_pvp(CHARACTER*, const char*, int, int)':
cmd_general.cpp:802: error: 'tch' was not declared in this scope
cmd_general.cpp:808: error: 'tch' was not declared in this scope
 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • Honorable Member
On 28.02.2018 at 4:23 PM, Dobrescu Sebastian said:

void MessengerManager::RemoveFromBlockList(MessengerManager::keyA account, MessengerManager::keyA companion)

You have to escape it. Haven't you learned anything from the past sql exploit ?

 

 

No, whatever

You know that bug fixed, you can fix like the messenger

 

Link to comment
Share on other sites

  • Honorable Member
10 minutes ago, Dobrescu Sebastian said:

Yes, but i saw others using it without the fix. And i was like " what the hell man, people just don't want to learn from the past "

Yes bro I can't learn anything from the past sorry

 

Link to comment
Share on other sites

  • Premium
1 hour ago, Mali61 said:

Yes bro I can't learn anything from the past sorry

I wasn't talking about you. I appreciate that there are people who post free systems. I am taking about owner of server who download a system, but don't look in code. Every code can be improved. I know people who used systems from internet and got their servers f.up. It's not about who created the system, it's about who use it.

Please accept my apologies, I didn't mean to upset you.

Link to comment
Share on other sites

  • 8 months later...

Whisper fix

int CInputMain::Whisper(LPCHARACTER ch, const char * data, size_t uiBytes)
{
	const TPacketCGWhisper* pinfo = reinterpret_cast<const TPacketCGWhisper*>(data);

	if (uiBytes < pinfo->wSize)
		return -1;

	int iExtraLen = pinfo->wSize - sizeof(TPacketCGWhisper);

	if (iExtraLen < 0)
	{
		sys_err("invalid packet length (len %d size %u buffer %u)", iExtraLen, pinfo->wSize, uiBytes);
		ch->GetDesc()->SetPhase(PHASE_CLOSE);
		return -1;
	}

	if (ch->GetLastPMPulse() < thecore_pulse())
		 ch->ClearPMCounter();
		 
	if (ch->GetPMCounter() > 3 && ch->GetLastPMPulse() > thecore_pulse())
	{
	   ch->GetDesc()->SetPhase(PHASE_CLOSE);
	   return -1;
	} 	
	
	if (ch->FindAffect(AFFECT_BLOCK_CHAT))
	{
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("채팅 금지 상태입니다."));
		return (iExtraLen);
	}

	LPCHARACTER pkChr = CHARACTER_MANAGER::instance().FindPC(pinfo->szNameTo);

	if (pkChr == ch)
		return (iExtraLen);
	
	ch->IncreasePMCounter();
	ch->SetLastPMPulse();

	LPDESC pkDesc = NULL;
	
	std::string targetname;

	BYTE bOpponentEmpire = 0;

	if (test_server)
	{
		if (!pkChr)
			sys_log(0, "Whisper to %s(%s) from %s", "Null", pinfo->szNameTo, ch->GetName());
		else
			sys_log(0, "Whisper to %s(%s) from %s", pkChr->GetName(), pinfo->szNameTo, ch->GetName());
	}
		
	if (ch->IsBlockMode(BLOCK_WHISPER))
	{
		if (ch->GetDesc())
		{
			TPacketGCWhisper pack;
			pack.bHeader = HEADER_GC_WHISPER;
			pack.bType = WHISPER_TYPE_SENDER_BLOCKED;
			pack.wSize = sizeof(TPacketGCWhisper);
			strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));
			ch->GetDesc()->Packet(&pack, sizeof(pack));
		}
		return iExtraLen;
	}

	CCI * pkCCI;
	
	if (!pkChr)
	{
		pkCCI = P2P_MANAGER::instance().Find(pinfo->szNameTo);

		if (pkCCI)
		{
			pkDesc = pkCCI->pkDesc;
			pkDesc->SetRelay(pinfo->szNameTo);
			bOpponentEmpire = pkCCI->bEmpire;
			targetname = pkCCI->szName;

			if (test_server)
				sys_log(0, "Whisper to %s from %s (Channel %d Mapindex %d)", "Null", ch->GetName(), pkCCI->bChannel, pkCCI->lMapIndex);
		}
	}
	else
	{
		pkDesc = pkChr->GetDesc();
		bOpponentEmpire = pkChr->GetEmpire();
		targetname = pkChr->GetName();
	}

	if (!pkDesc)
	{
		if (ch->GetDesc())
		{
			TPacketGCWhisper pack;

			pack.bHeader = HEADER_GC_WHISPER;
			pack.bType = WHISPER_TYPE_NOT_EXIST;
			pack.wSize = sizeof(TPacketGCWhisper);
			strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));
			ch->GetDesc()->Packet(&pack, sizeof(TPacketGCWhisper));
			sys_log(0, "WHISPER: no player");
		}
	}
	else
	{
		if (ch->IsBlockMode(BLOCK_WHISPER))
		{
			if (ch->GetDesc())
			{
				TPacketGCWhisper pack;
				pack.bHeader = HEADER_GC_WHISPER;
				pack.bType = WHISPER_TYPE_SENDER_BLOCKED;
				pack.wSize = sizeof(TPacketGCWhisper);
				strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));
				ch->GetDesc()->Packet(&pack, sizeof(pack));
			}
		}
		else if (pkChr && pkChr->IsBlockMode(BLOCK_WHISPER))
		{
			if (ch->GetDesc())
			{
				TPacketGCWhisper pack;
				pack.bHeader = HEADER_GC_WHISPER;
				pack.bType = WHISPER_TYPE_TARGET_BLOCKED;
				pack.wSize = sizeof(TPacketGCWhisper);
				strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));
				ch->GetDesc()->Packet(&pack, sizeof(pack));
			}
		}
		#ifdef ENABLE_MESSENGER_BLOCK
		else if ((pkCCI != NULL || pkChr != NULL) && MessengerManager::instance().CheckMessengerList(ch->GetName(), targetname.c_str(), SYST_BLOCK))
		{
			if (ch->GetDesc())
			{
				TPacketGCWhisper pack;

				char msg_2[CHAT_MAX_LEN + 1];
				snprintf(msg_2, sizeof(msg_2), LC_TEXT("%s'yi blokladim"), targetname.c_str());
				int len = MIN(CHAT_MAX_LEN, strlen(msg_2) + 1);

				pack.bHeader = HEADER_GC_WHISPER;
				pack.wSize = sizeof(TPacketGCWhisper) + len;
				pack.bType = WHISPER_TYPE_SYSTEM;
				strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));

				TEMP_BUFFER buf;

				buf.write(&pack, sizeof(TPacketGCWhisper));
				buf.write(msg_2, len);
				ch->GetDesc()->Packet(buf.read_peek(), buf.size());
			}
		}
		#endif
		else

 

Link to comment
Share on other sites

  • 3 months later...
  • 10 months later...
  • 1 month later...
  • 11 months later...
  • 1 month later...

Here is how I made the whisper button using the block by name function, exactly how it works from the messenger window when you type the name yourself.

uiwhisper.py

Search:

			self.minimizeButton = GetObject("minimizebutton")

Add below:

			self.blockPlayer = GetObject("blockplayer")

Search: 

		self.chatLine.SetEscapeEvent(ui.__mem_func__(self.Minimize))

Add below: 

		self.blockPlayer.SetEvent(ui.__mem_func__(self.BlockPlayer))

Search:

		self.minimizeButton = None

Add below:

		self.blockPlayer = None

Search:
Under def OpenWithTarget(self, targetName): function

			self.minimizeButton.Show()

Add below:

		if app.ENABLE_MESSENGER_BLOCK:
			if not messenger.IsBlockByName(self.targetName):
				self.blockPlayer.Show()
		else:
			self.blockPlayer.Hide()

Search:
Under 	def OpenWithoutTarget(self, event): function

		self.minimizeButton.Hide()

Add below:

		if app.ENABLE_MESSENGER_BLOCK:
			if not messenger.IsBlockByName(self.targetName):
				self.blockPlayer.Show()
		else:
			self.blockPlayer.Hide()

Search:

	def ReportViolentWhisper(self):

Add before:

	def BlockPlayer(self):
		net.SendMessengerAddBlockByNamePacket(self.targetName)


uiscript/whisperdialog.py
 

Search:

				{
					"name" : "reportviolentwhisperbutton",
					"type" : "button",

					"x" : 145,
					"y" : 10,

					"text" : uiScriptLocale.WHISPER_REPORT,

					"default_image" : "d:/ymir work/ui/public/large_button_01.sub",
					"over_image" : "d:/ymir work/ui/public/large_button_02.sub",
					"down_image" : "d:/ymir work/ui/public/large_button_03.sub",
				},

Add below:

				{
					"name" : "blockplayer",
					"type" : "button",

					"x" : 145,
					"y" : 10,

					"text" : uiScriptLocale.WHISPER_BLOCK,

					"default_image" : "d:/ymir work/ui/public/small_thin_button_01.sub",
					"over_image" : "d:/ymir work/ui/public/small_thin_button_02.sub",
					"down_image" : "d:/ymir work/ui/public/small_thin_button_03.sub",
				},



You may need to play with the button in the whisper window because I got more buttons and It might be arranged differently.

Edit: Also this version of the system is not full, you might wanna try and take it from some serverfiles which fixed most things for it. The only problem I am having now is cross core, it does not block the players if they are on different cores.

Edit 2: Cross core fix
After I made this "fix", I totally removed the system from my sources. Fixing one problem gets you to 100 more.
You might need to change MESSENGER_BLOCK with yours as I changed the functions and made more checks.
Fixing this problem will get you to another core problem, when on different cores if the blocker removes the blocked, the blocked one is being disconnected and the blocker gets some errors and needs to relog in order to do anything.

I know some servers that were using this system and removed it later on, but if properly fixed it might get your job done.

Search:

			if (test_server)
				sys_log(0, "Whisper to %s from %s (Channel %d Mapindex %d)", "Null", ch->GetName(), pkCCI->bChannel, pkCCI->lMapIndex);

Add below:

#ifdef __MESSENGER_BLOCK_SYSTEM__
			if (MessengerManager::instance().CheckMessengerList(ch->GetName(), pkCCI->szName, MESSENGER_BLOCK))
			{
				if (ch->GetDesc())
				{
					TPacketGCWhisper pack;

					char msg[CHAT_MAX_LEN + 1];
					snprintf(msg, sizeof(msg), LC_TEXT("Unblock %s to continue."), pkCCI->szName);
					int len = MIN(CHAT_MAX_LEN, strlen(msg) + 1);

					pack.bHeader = HEADER_GC_WHISPER;
					pack.wSize = sizeof(TPacketGCWhisper) + len;
					pack.bType = WHISPER_TYPE_SYSTEM;
					strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));

					TEMP_BUFFER buf;

					buf.write(&pack, sizeof(TPacketGCWhisper));
					buf.write(msg, len);
					ch->GetDesc()->Packet(buf.read_peek(), buf.size());

					ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Unblock %s to continue."), pkCCI->szName);
				}
				return iExtraLen;
			}
			else if (MessengerManager::instance().CheckMessengerList(pkCCI->szName, ch->GetName(), MESSENGER_BLOCK))
			{
				if (ch->GetDesc())
				{
					TPacketGCWhisper pack;

					char msg[CHAT_MAX_LEN + 1];
					snprintf(msg, sizeof(msg), LC_TEXT("%s has blocked you."), pkCCI->szName);
					int len = MIN(CHAT_MAX_LEN, strlen(msg) + 1);

					pack.bHeader = HEADER_GC_WHISPER;
					pack.wSize = sizeof(TPacketGCWhisper) + len;
					pack.bType = WHISPER_TYPE_SYSTEM;
					strlcpy(pack.szNameFrom, pinfo->szNameTo, sizeof(pack.szNameFrom));

					TEMP_BUFFER buf;

					buf.write(&pack, sizeof(TPacketGCWhisper));
					buf.write(msg, len);
					ch->GetDesc()->Packet(buf.read_peek(), buf.size());

					ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s has blocked you."), pkCCI->szName);
				}
				return iExtraLen;
			}
#endif

 

Edited by klynaTz
  • Love 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 5 months later...

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 4

      [Discussion] Rain - The First Person that leaked the M2 Files

    2. 4

      [Discussion] Rain - The First Person that leaked the M2 Files

    3. 0

      [Client] All tabs opening after quest/npc talk or even shop // PORTS

    4. 0

      Arrow does not hide at warp

    5. 0

      Problem with sidebar by vegas

    6. 58

      Discord Rich Presence

    7. 145

      Full Costume Mount System

    8. 3

      Memory allocation for beginner

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.