Character...tried to drop item..., but had not gotten an item.

Here you can post threads on the development of the current beta releases of the core (099)

Moderator: POL Developer

Post Reply
Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Character...tried to drop item..., but had not gotten an item.

Post by Harley » Mon Mar 06, 2017 12:29 pm

Good day!
Have a question.
Where to find this line
Character ... tried to drop item ..., but had not gotten an item.
at
https://github.com/polserver/polserver

And what I have to add there to make "kick char" when this line shows up?

With best regards.
Last edited by Harley on Sat Mar 11, 2017 8:49 am, edited 1 time in total.

guialtran
Journeyman Poster
Posts: 65
Joined: Wed Jul 30, 2008 12:42 pm

Re: Character ... tried to drop item ..., but had not gotten an item.

Post by guialtran » Mon Mar 06, 2017 2:35 pm

D:\polserver-master\pol-core\pol\dropitem.cpp (2 hits)
Line 771: "Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
Line 841: "Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )

press clone or download, unzip

install notepad++ ----> https://notepad-plus-plus.org/download/v7.3.2.html
Attachments
Captura de tela 2017-03-06 19.31.34.png

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character ... tried to drop item ..., but had not gotten an item.

Post by Harley » Mon Mar 06, 2017 5:30 pm

thanks guialtran!

If you know what is code line to give auto kick at the POL src, please, let me know!

Updated:
I used search and found some line at create.cpp:

Code: Select all

client->Disconnect();
Can I use this one something like that?

Code: Select all

    POLLOG_ERROR.Format(
        "Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
        << client->chr->serial << item_serial;
        client->Disconnect();
With best regards!

guialtran
Journeyman Poster
Posts: 65
Joined: Wed Jul 30, 2008 12:42 pm

Re: Character ... tried to drop item ..., but had not gotten an item.

Post by guialtran » Mon Mar 06, 2017 9:03 pm

I do not understand what you want, sorry.


D:\uo master\polserver-master\pol-core\pol\network\auxclient.cpp (2 hits)
Line 102: void AuxConnection::disconnect()
Line 205: _auxconnection->disconnect();

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character ... tried to drop item ..., but had not gotten an item.

Post by Harley » Wed Mar 08, 2017 4:18 pm

Nando, Turley?
I think you can help me with this question. Very need your help.

We have lags from progs, that players use to macroing. Their scripts for Stealth & Inject haven't required checks. And I want to stop some that issues with this way.

If you will give the cue, I'll be very grateful!

Can I use this line:
client->Disconnect();

After this:
POLLOG_ERROR.Format(
"Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
<< client->chr->serial << item_serial;


And how can I make checks for
POLLOG_ERROR.Format(
"Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
<< client->chr->serial << item_serial;

For example:
if( POLLOG_ERROR.Format > 5 )
client->Disconnect();
endif

With best regards, Harley.

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character...tried to drop item..., but had not gotten an item.

Post by Harley » Sat Mar 11, 2017 8:49 am

I still need your help, guys! Very need.

Nando
POL Developer
Posts: 223
Joined: Wed Sep 17, 2008 6:53 pm
Contact:

Re: Character...tried to drop item..., but had not gotten an item.

Post by Nando » Sat Mar 11, 2017 9:17 am

Did you try using "client->Disconnect()", or are you waiting for confirmation that it would work before you try? :D

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character...tried to drop item..., but had not gotten an item.

Post by Harley » Sat Mar 11, 2017 9:25 am

I'm waiting for the answer about that))
And how can I make checks for
POLLOG_ERROR.Format(
"Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
<< client->chr->serial << item_serial;

For example:
if( POLLOG_ERROR.Format > 5 )
client->Disconnect();
endif
And what I need to add here
Character 0x{:X}...

for display nick name & account of character? Not only serial.

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character...tried to drop item..., but had not gotten an item.

Post by Harley » Tue Mar 14, 2017 4:04 am

And another question.

How can I add name with account to serial:
Character 0x{:X} tried to ...

And how can I add item name at:
drop item 0x{:X} ...

RusseL
Grandmaster Poster
Posts: 293
Joined: Fri Feb 20, 2009 8:30 pm

Re: Character...tried to drop item..., but had not gotten an item.

Post by RusseL » Tue Mar 14, 2017 7:22 am

just look same file a little bit higher

https://github.com/polserver/polserver/ ... m.cpp#L355

Turley
POL Developer
Posts: 571
Joined: Sun Feb 05, 2006 4:45 am

Re: Character...tried to drop item..., but had not gotten an item.

Post by Turley » Sun Mar 19, 2017 2:13 am

I would suggest instead of modifying the core to simply add a packethook for the droppacket and do the tests there. Something like:
Exported Function CheckDrop(char, ByRef packet)
var serial := packet.getint32(1);
var inhand := char.getgottenitem();
If (serial and inhand and inhand.serial == serial)
return 0;
EndIf
//Disconnect here or increase a counter to allow some bad pkts

return 1;
EndFunction

Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character...tried to drop item..., but had not gotten an item.

Post by Harley » Tue Mar 28, 2017 5:04 am

Turley wrote:
Sun Mar 19, 2017 2:13 am
I would suggest instead of modifying the core to simply add a packethook for the droppacket and do the tests there. Something like:
Exported Function CheckDrop(char, ByRef packet)
var serial := packet.getint32(1);
var inhand := char.getgottenitem();
If (serial and inhand and inhand.serial == serial)
return 0;
EndIf
//Disconnect here or increase a counter to allow some bad pkts

return 1;
EndFunction
Turley, thanks for your answer.
This is very interesting, and what is the packet?
In truth, I never used packet hooks because I don't understand how to make them and how to use.

And we use this packet hook by CWO:
Packet 0x08
{
Length 14
ReceiveFunction dropping:dropping
}
use uo;
use os;
use cfgfile;

var config := ReadConfigFile("::tiles");

program drag()
return 1;
endprogram

exported function dropping(who, byref packet)

who := who; //Avoid compiler warnings

var dropserial := packet.GetInt32(10);
if ( dropserial != 0xFFFFFFFF ) // If the character is not dropping it into the outside world
var dropitem := SystemFindObjectBySerial(dropserial);
var dragitem := SystemFindObjectBySerial(packet.GetInt32(1));
if (dragitem.graphic == dropitem.graphic && !dragitem.isA(POLCLASS_CONTAINER)) // If the graphics are the same and its not a container, its trying to stack them
var elem := FindConfigElem(config, dropitem.graphic);
if (!elem.stackable) // If its not stackable...
if (dropitem.container)
packet.SetInt32(10, dropitem.container.serial); // If the stack is in a container then send it to the container instead
else
packet.SetInt32(10, 0xFFFFFFFF); // If the stack isn't in a container then send it to the outside world
endif
endif
endif
endif
return 0;
endfunction
Will be conflicts with this packethook?
And how to use them together without any issues?

Maybe you give me and advice how to make this check in pol core
And how can I make checks for
POLLOG_ERROR.Format(
"Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n" )
<< client->chr->serial << item_serial;

For example:
if( POLLOG_ERROR.Format > 5 )
client->Disconnect();
endif

Skinny
Apprentice Poster
Posts: 51
Joined: Wed Dec 19, 2012 10:27 pm

Re: Character...tried to drop item..., but had not gotten an item.

Post by Skinny » Tue Mar 28, 2017 9:32 am

;)
The suggested code:

Code: Select all

use uo;
use os;
use cfgfile;

var config := ReadConfigFile("::tiles");

program drag()
	return 1;
endprogram

exported function dropping(who, byref packet)

	who := who; //Avoid compiler warnings

	var dropserial := packet.GetInt32(10);
	if ( dropserial != 0xFFFFFFFF )	// If the character is not dropping it into the outside world
		var dropitem := SystemFindObjectBySerial(dropserial);
		var dragitem := SystemFindObjectBySerial(packet.GetInt32(1));
		if (dragitem.graphic == dropitem.graphic && !dragitem.isA(POLCLASS_CONTAINER))	// If the graphics are the same and its not a container, its trying to stack them
			var elem := FindConfigElem(config, dropitem.graphic);
			if (!elem.stackable)	// If its not stackable...
				if (dropitem.container)
					packet.SetInt32(10, dropitem.container.serial);	// If the stack is in a container then send it to the container instead
				else
					packet.SetInt32(10, 0xFFFFFFFF);	// If the stack isn't in a container then send it to the outside world
				endif
			endif
		endif
	endif
	
	var serial := packet.GetInt32(1);
	var inhand := who.getgottenitem();
	if (serial and inhand and inhand.serial == serial)
		return 0;
	endif
	
	var badpackets := GetObjProperty(who, "badpackets");
	if (!badpackets)
		SetObjProperty(who, "badpackets", 1);
		return 0;
	elseif(badpackets > 5)
		SendSysMessage(who, "You have been disconnected for excessive macro with an item that had not gotten.");
		SetObjProperty(who, "badpackets", 0);
		DisconnectClient(who);
		return 1;
	else
		badpackets += 1;
		SetObjProperty(who, "badpackets", badpackets);
		return 0;
	endif
	
endfunction


Harley
Grandmaster Poster
Posts: 269
Joined: Sat Mar 18, 2006 1:41 am
Location: World Earth

Re: Character...tried to drop item..., but had not gotten an item.

Post by Harley » Wed Mar 29, 2017 5:19 am

Skinny wrote:
Tue Mar 28, 2017 9:32 am
;)
The suggested code:

Code: Select all

use uo;
use os;
use cfgfile;

var config := ReadConfigFile("::tiles");

program drag()
	return 1;
endprogram

exported function dropping(who, byref packet)

	who := who; //Avoid compiler warnings

	var dropserial := packet.GetInt32(10);
	if ( dropserial != 0xFFFFFFFF )	// If the character is not dropping it into the outside world
		var dropitem := SystemFindObjectBySerial(dropserial);
		var dragitem := SystemFindObjectBySerial(packet.GetInt32(1));
		if (dragitem.graphic == dropitem.graphic && !dragitem.isA(POLCLASS_CONTAINER))	// If the graphics are the same and its not a container, its trying to stack them
			var elem := FindConfigElem(config, dropitem.graphic);
			if (!elem.stackable)	// If its not stackable...
				if (dropitem.container)
					packet.SetInt32(10, dropitem.container.serial);	// If the stack is in a container then send it to the container instead
				else
					packet.SetInt32(10, 0xFFFFFFFF);	// If the stack isn't in a container then send it to the outside world
				endif
			endif
		endif
	endif
	
	var serial := packet.GetInt32(1);
	var inhand := who.getgottenitem();
	if (serial and inhand and inhand.serial == serial)
		return 0;
	endif
	
	var badpackets := GetObjProperty(who, "badpackets");
	if (!badpackets)
		SetObjProperty(who, "badpackets", 1);
		return 0;
	elseif(badpackets > 5)
		SendSysMessage(who, "You have been disconnected for excessive macro with an item that had not gotten.");
		SetObjProperty(who, "badpackets", 0);
		DisconnectClient(who);
		return 1;
	else
		badpackets += 1;
		SetObjProperty(who, "badpackets", badpackets);
		return 0;
	endif
	
endfunction


I have tested and it doesn't works!((
Character 0x2 tried to drop item 0x409AA0B9, but had not gotten an item.
Character 0x2 tried to drop item 0x409AA0B7, but had not gotten an item.
Character 0x2 tried to drop item 0x409AA05B, but had not gotten an item.
...............

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest