Better way to do SmallPacket0x0B6 Send Tells To Players

Post Reply
WiiStream

Better way to do SmallPacket0x0B6 Send Tells To Players

Post by WiiStream » Wed Apr 17, 2013 5:24 pm

Code: Select all

void SmallPacket0x0B6(map_session_data_t* session, CCharEntity* PChar, int8* data)
{
	string_t RecipientName = data+5;
	string_t message = data+20;
	ShowNotice(CL_RED"SENDING MESSAGE %s TO PLAYER %s FROM PLAYER %s\n" CL_RESET,message.c_str(),RecipientName.c_str(),PChar->GetName());
	if(jailutils::InPrison(PChar))
    {
		ShowNotice(CL_GREEN"SENDING MESSAGE: TO SENDER JAIL\n" CL_RESET);
        PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 0, 316));
        return;
    }
	CCharEntity* PTargetChar = zoneutils::GetCharByName(data+5);
	if(PTargetChar != NULL )
	{
		ShowNotice(CL_GREEN"SENDING MESSAGE IS NOT NULL OK TO SEND\n" CL_RESET);
		if (PTargetChar->nameflags.flags == FLAG_AWAY)
			{
				ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER HAS AWAY FLAG SET TELL SENDER\n" CL_RESET);
				PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 181));
				return;
			}
		if( PTargetChar->status != STATUS_DISAPPEAR)
		{
			ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS NOT ZONING SEND MESSAGE OK\n" CL_RESET);
		PTargetChar->pushPacket(new CChatMessagePacket(PChar, MESSAGE_TELL,data+20 ));
		return;
		}
		else
		{
			ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS ZONEING TELL SENDER\n" CL_RESET);
			PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
			return;
		}
		return;
	}
	else
	{

		ShowNotice(CL_GREEN"SENDING MESSAGE: DO A FULL SWEEP\n" CL_RESET);
			map_session_list_t::iterator it = map_session_list.begin();
			while(it != map_session_list.end())
			{
				map_session_data_t* map_session_data = it->second;
				CCharEntity* PCharInMog = map_session_data->PChar;
				if(PCharInMog!=NULL)
				{
					ShowNotice(CL_GREEN"SENDING MESSAGE: PLAYER IS NOT NULL\n" CL_RESET);
					PTargetChar = PCharInMog;
					PCharInMog->pushPacket(new CChatMessagePacket(PChar, MESSAGE_TELL,data+20 ));
					break;
				}
				else
				{
                ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS NOT ONLINE TELL SENDER\n" CL_RESET);
		        PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
				break;
				}
				++it;
			}
		
		
		return;
	}
		 

	return;
}

WiiStream

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by WiiStream » Thu Apr 18, 2013 7:12 pm

Forgot to add the moghouse chat into it Updated

gedads
Developer
Posts: 171
Joined: Fri Jan 04, 2013 7:48 pm

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by gedads » Sun May 05, 2013 3:31 pm

Hi, since you seem to know how to code, can i ask you a few thing if you have some time to kill?

Could you add MH for adoulin ?
Can you make npc move?
Can you add an on gamehour or minute automatisation?
a special request: move textfile parameter from 8th position to a 10th or eleventh one.
and a last one: allow people to access textfile 2 for aht urghan in order to display messages.


Thank you

PS:I'm checking your google code page often to see if there are updates, and there's no description at all, is it normal?

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by whasf » Mon May 06, 2013 9:01 pm

You have a lot of debug messages left in there!

what is with this assignment: PTargetChar = PCharInMog;

Please submit .patch files, they make it much easier to determine what has changed in the code
-- Whasf

Robert
Posts: 33
Joined: Fri Aug 16, 2013 9:14 am

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by Robert » Tue Aug 27, 2013 2:46 pm

Code: Select all

void SmallPacket0x0B6(map_session_data_t* session, CCharEntity* PChar, int8* data)
{
  // ShowNotice("PCHAR SEND TELL SYSTEM CALLED\n");
	string_t RecipientName = data+5;
	string_t message = data+20;
	//ShowNotice(CL_RED"SENDING MESSAGE %s TO PLAYER %s FROM PLAYER %s\n" CL_RESET,message.c_str(),RecipientName.c_str(),PChar->GetName());
	if(jailutils::InPrison(PChar))
    {
		//ShowNotice(CL_GREEN"SENDING MESSAGE: TO SENDER JAIL\n" CL_RESET);
        PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 0, 316));
        return;
    }
	CCharEntity* PTargetChar = zoneutils::GetCharByName(data+5);
	if(PTargetChar != NULL )
	{
		//ShowNotice(CL_GREEN"SENDING MESSAGE IS NOT NULL OK TO SEND\n" CL_RESET);
		if (PTargetChar->nameflags.flags == FLAG_AWAY)
			{
				//ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER HAS AWAY FLAG SET TELL SENDER\n" CL_RESET);
				if(PTargetChar == PChar)
			    {
				char buf1[110];
	sprintf(buf1,"DEBUG: SEND MESSAGE CHAT 0 ");
	PChar->pushPacket(new CChatMessageStringPacket(PChar, MESSAGE_STRING_SAY , ("%s",buf1)));
				return;
			    }
				else
				{
				PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 181));
				}
				return;
			}
		if( PTargetChar->status != STATUS_DISAPPEAR)
		{
			//ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS NOT ZONING SEND MESSAGE OK\n" CL_RESET);
			if(PTargetChar == PChar)
			{
				PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
				return;
			}
			else
			{
			PTargetChar->pushPacket(new CChatMessagePacket(PChar, MESSAGE_TELL,data+20 ));
			}
		return;
		}
		else
		{
			//ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS ZONEING TELL SENDER\n" CL_RESET);
			if(PTargetChar == PChar)
			{
				char buf1[110];
	sprintf(buf1,"DEBUG: SEND MESSAGE CHAT 1");
	PChar->pushPacket(new CChatMessageStringPacket(PChar, MESSAGE_STRING_SAY , ("%s",buf1)));
				return;
			}
			else
			{
				PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
			
			}
			
			return;
		}
		return;
	}
	else
	{

		//ShowNotice(CL_GREEN"SENDING MESSAGE: DO A FULL SWEEP\n" CL_RESET);
			map_session_list_t::iterator it = map_session_list.begin();
			while(it != map_session_list.end())
			{
				map_session_data_t* map_session_data = it->second;
				CCharEntity* PCharInMog = map_session_data->PChar;
				if(PCharInMog!=NULL)
				{PTargetChar = PCharInMog;
					//ShowNotice(CL_GREEN"SENDING MESSAGE: PLAYER IS NOT NULL\n" CL_RESET);
					
					if(PTargetChar == PChar) // IF WE ARe TALKING TO OUR SELF SHOULD DO NOTHING
			          {
				      PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
				      }
					else //ELSE WE ARE TAKING TO SOME ONE ELSE
					{
						if(PTargetChar == PCharInMog) // IF THE PERSON WE ARE TALKING TO == THE PERSON IN THE MOG HOUSE SEND MESSAGE
						{
                        PCharInMog->pushPacket(new CChatMessagePacket(PChar, MESSAGE_TELL,data+20 ));
						}
						else// ELSE WE SHOUD DO NOTHING OTHER THEN SAY THE PLAYERS NOT ONLINE
						{
							PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
						}
					}
					break;
				}
				else
				{
                //ShowNotice(CL_GREEN"SENDING MESSAGE: RECEIVER IS NOT ONLINE TELL SENDER\n" CL_RESET);
		        PChar->pushPacket(new CMessageStandardPacket(PChar, 0, 0, 125));
				break;
				}
				++it;
			}
		
		
		return;
	}
		 

	return;
}
Last edited by Robert on Mon Sep 09, 2013 11:36 pm, edited 1 time in total.

Robert
Posts: 33
Joined: Fri Aug 16, 2013 9:14 am

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by Robert » Mon Sep 09, 2013 4:26 am

Hi, since you seem to know how to code, can i ask you a few thing if you have some time to kill?

Could you add MH for adoulin ?
Can you make npc move?
Can you add an on gamehour or minute automatisation?
a special request: move textfile parameter from 8th position to a 10th or eleventh one.
and a last one: allow people to access textfile 2 for aht urghan in order to display messages.


Thank you

PS:I'm checking your google code page often to see if there are updates, and there's no description at all, is it normal?
Sorry about not explaining what i did when i comment, ill try to do better with that.
and im working a a system to move npcs mobs now, along with a no-pol trying to make hacky version of pol so its on the clients side and it can check if the client has
the dat files of seekers and the other expansions. to update the accounts stable from that no pol.
and also add a lock out system so users can not login with any other tool with out passing the check system.

reason being if a user is using expansions 30 and thats all they have then they should not be able to go to the other zones at all. but the system will still zone them
by command, and then they are stuck, and i have to deal with dumb crap to unstick them. or make some other way for them to unstick there selfs.
so i might as make it so its not possible to do in the first place.

thats why im making the no-pol.
also its good for learning how to pass vars from c# to php to flash or what ever else i decide to use.
and ill commit the source to it all. so you guys can play around with it make it better.

honestly I can not tell you if i can do that stuff, because i only do what my brain tells me to do lol it has the answer when it see the problem.
I do not know the game at all so its just a puzzle to me.
the on rev 118 now i think. and i believe its stable. rev 90 - 112 was very unstable!

Robert
Posts: 33
Joined: Fri Aug 16, 2013 9:14 am

Re: Better way to do SmallPacket0x0B6 Send Tells To Players

Post by Robert » Mon Sep 09, 2013 4:36 am

whasf wrote:You have a lot of debug messages left in there!

what is with this assignment: PTargetChar = PCharInMog;

Please submit .patch files, they make it much easier to determine what has changed in the code
ya i do have alot of debug mesages, i trace out everything i run into to learn the system.
and when i am login it the tracers calls the functions in different orders some times, then then i find the order like 1 2 3 4 5 6
and it could be using 4 or 6 different functions once i get things working the way I think it should be, ill clean it up.

I still can not get the elevators to run smooth up and down on command.
I can get them to run smooth up and down every 1 minute and 30 seconds but its its not VANATIME NOTHING WORKS!
If I had a way to reset VANATIME or make a function like VATATIME CALL it ELEVATORTIME then once its up it resets that time and goes back to the normal time when went up back down.
but someday ill get it working. unless you guys get it working retail like

Post Reply