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

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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: 68
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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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: 68
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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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: 243
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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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
Forum Regular
Posts: 327
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: 594
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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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
Journeyman Poster
Posts: 61
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
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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.
...............

Skinny
Journeyman Poster
Posts: 61
Joined: Wed Dec 19, 2012 10:27 pm

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

Post by Skinny » Thu Mar 30, 2017 12:08 pm

Which client version do you use?
6.0.1.7+?
If yes, you need change uopacket.cfg to:

Code: Select all

Packet 0x08
{
	Length 15
	ReceiveFunction dropping:dropping
	Version 2
}
See about 0x08 packet.

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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

Post by Harley » Thu Mar 30, 2017 2:53 pm

Skinny wrote:
Thu Mar 30, 2017 12:08 pm
Which client version do you use?
6.0.1.7+?
If yes, you need change uopacket.cfg to:

Code: Select all

Packet 0x08
{
	Length 15
	ReceiveFunction dropping:dropping
	Version 2
}
See about 0x08 packet.
I use 7.0.3
Hm, we have in uopacket.cfg

Code: Select all

Packet 0x08
{
	Length 14
	ReceiveFunction dropping:dropping
}
If I change to Length 15, I will not break the work of the previous packet?


*Updated after 15 minutes*

Checked and it works!
But if it's not hard, please answer the question.

And question to all, is there any guide how to script packet hooks and else with packets?
With best regards!

RusseL
Forum Regular
Posts: 327
Joined: Fri Feb 20, 2009 8:30 pm

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

Post by RusseL » Fri Mar 31, 2017 1:15 am

Harley wrote:
Thu Mar 30, 2017 2:53 pm
And question to all, is there any guide how to script packet hooks and else with packets?
With best regards!
Scripting - https://github.com/polserver/polserver/ ... thooks.txt
Packet Guide - https://docs.polserver.com/packets/index.php

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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

Post by Harley » Sat Apr 01, 2017 2:07 pm

Thanks RusseL.

Another question about that packet hook.
How to find and determine this one:

Code: Select all

Client (Character .....) tried to drop an item out of range.
Client (Character .....) tried to drop an item out of range.
Client (Character .....) tried to drop an item out of range.
*Updated after 10 minutes*
I guess that like Turley wrote the code, and RusseL gave me an instruction, that past messages were about
BYTE[4] Container Serial Dropped Onto (FF FF FF FF drop to ground)

BYTE[4] - is packet.GetInt32(1);
I don't understand, why 1 in GetInt32 and how to reveal that number?

But now I try to find here:
https://docs.polserver.com/packets/inde ... acket=0x08
What packet I have to use (what BYTE[???]) to make another code for kick players when they make "item out of range"

With best regards and hope to ur help!

Skinny
Journeyman Poster
Posts: 61
Joined: Wed Dec 19, 2012 10:27 pm

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

Post by Skinny » Sat Apr 01, 2017 9:30 pm

Harley wrote:
Sat Apr 01, 2017 2:07 pm
Another question about that packet hook.
How to find and determine this one:

Code: Select all

Client (Character .....) tried to drop an item out of range.
Client (Character .....) tried to drop an item out of range.
Client (Character .....) tried to drop an item out of range.
What packet I have to use (what BYTE[???]) to make another code for kick players when they make "item out of range"
;)
The new 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)

	//ABOUT 'Container Serial Dropped Onto'
	//if using client version < 6.0.1.7 (14 bytes), use:
	//	packet.GetInt32(10);
	//else if using client version >= 6.0.1.7 (15 bytes, also need to change uopacket.cfg file), use:
	//	packet.GetInt32(11);

	var dropserial := packet.GetInt32(11);
	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(11, dropitem.container.serial);	// If the stack is in a container then send it to the container instead
				else
					packet.SetInt32(11, 0xFFFFFFFF);	// If the stack isn't in a container then send it to the outside world
				endif
			endif
		endif
	else
		// Check if "Client (Character {}) tried to drop an item out of range.\n"
		var x_location := packet.GetInt16(5);
		var y_location := packet.GetInt16(7);
		if(CoordinateDistance(who.x, who.y, x_location, y_location) > 2)
			var badrange := GetObjProperty(who, "badrange");
			if (!badrange)
				SetObjProperty(who, "badrange", 1);
				return 0;
			elseif(badrange > 5)
				SendSysMessage(who, "You have been disconnected for excessive attempts to throw an item out of range.");
				SetObjProperty(who, "badrange", 0);
				DisconnectClient(who);
				return 1;
			else
				badrange += 1;
				SetObjProperty(who, "badrange", badrange);
				return 0;
			endif
		endif
	endif
	
	var serial := packet.GetInt32(1);
	var inhand := who.getgottenitem();
	if (serial and inhand and inhand.serial == serial)
		return 0;
	endif
	
	// Check if "Character 0x{:X} tried to drop item 0x{:X}, but had not gotten an item.\n"
	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

Let's explain...
Packet Name: Drop Item
Last Modified: 2009-08-13 09:52:18
Modified By: MuadDib

Packet: 0x08
Sent By: Client
Size: 14/15 bytes

Packet Build
2D Client Version (before v6.0.1.7)
BYTE[1] 0x08
BYTE[4] Item Serial
BYTE[2] X Location
BYTE[2] Y Location
BYTE[1] Z Location
BYTE[4] Container Serial Dropped Onto (FF FF FF FF drop to ground)

3D Client (UOKR+) and Legacy 2D 6.0.1.7+ Version
BYTE[1] 0x08
BYTE[4] Item Serial
BYTE[2] X Location
BYTE[2] Y Location
BYTE[1] Z Location
BYTE[1] Backpack grid index (see notes)
BYTE[4] Container Serial Dropped Onto (FF FF FF FF drop to ground)

Subcommand Build
N/A

Notes
The backpack grid index exists since 6.0.1.7 2D and 2.45.5.6 KR.
Older clients are sending 14 bytes without this grid index byte!

Older Notes:
3D clients sometimes sends 2 of them (bursts) for ONE drop action. The last one having -1's in X/Y locs.

Be very careful how to handle this odd "bursts" server side, neither always process, nor always skipping is correct.

0x08 packet
Harley wrote:
Sat Apr 01, 2017 2:07 pm
I guess that like Turley wrote the code, and RusseL gave me an instruction, that past messages were about
BYTE[4] Container Serial Dropped Onto (FF FF FF FF drop to ground)
This information saves in this position with 4 bytes size:
The Container Serial Dropped Onto
OR
The information '0xFFFFFFFF' if the item drop to ground
Harley wrote:
Sat Apr 01, 2017 2:07 pm
BYTE[4] - is packet.GetInt32(1);
I don't understand, why 1 in GetInt32 and how to reveal that number?
Lets check the order sequence:
BYTE[1] + BYTE[4] + BYTE[2] + BYTE[2] + BYTE[1] + BYTE[1] + BYTE[4] = 15 bytes

See 'BYTE[1] 0x08':
1 byte is 8 bits, right?
So, if we have to get this value, use 'packet.GetInt8(0)'
Why GetInt8()? Because a 8 bits integer is 1 byte.
Why zero in GetInt8(0)? Because the first packet position starts with 0, like an array position.

Hmm.. So, lets see 'BYTE[4] Item Serial':
4 bytes are 32 bits, right?
So, we use 'packet.GetInt32(1)'.
Why GetInt32()? Because a 32 bits integer are 4 bytes.
Why 1 in GetInt32(1)? Because, following the sequence, the next byte to reach the serial information is in position 1.

As a last example, lets see 'BYTE[2] Y Location':
2 bytes are 16 bits.
We use 'packet.GetInt16(7)'.
Why GetInt16()? Because a 16 bits integer are 2 bytes.
Why 7 in GetInt16(7)? Because, following the sequence, the next byte to reach the Y Location information is in position 7.
Lets count:
Position 0 -> BYTE[1] 0x08 (sum 0 + 1 = next position)
Position 1 -> BYTE[4] Item Serial (sum 1 + 4 = next position)
Position 5 -> BYTE[2] X Location (sum 5 + 2 = next position)
Position 7 -> BYTE[2] Y Location (sum 7 + 2 = next position)
Position 9 -> BYTE[1] Z Location (sum 9 + 1 = next position)
Position 10 -> BYTE[1] Backpack grid index (see notes) (sum 10 + 1 = next position)
Position 11 -> BYTE[4] Container Serial Dropped Onto (FF FF FF FF drop to ground) (11 + 4 = final byte)

Image

Well, I've tried to explain it in the most practical way. I hope it helps you.

:)

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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

Post by Harley » Sun Apr 02, 2017 6:31 am

Skinny, are you genius!
Your guide is very important for all of us!
Thanks for you attention.
I think that table each one can use for another packets, yeap?)

Now I try to understand another issue and fix it, that I think have not only my shard.
We have another flood from players:

Code: Select all

xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
I revealed this one and found when it happened.
When player try to make two things at once. For example: use fish steaks and bandages.
I think that packet respond for it:
https://docs.polserver.com/packets/inde ... acket=0x6C

*Updated after 10 minutes*
I found that someone tried to fix it.
viewtopic.php?t=1275

But didn't make a script.

Code: Select all

use uo;
use os;

Program Install()
print("Anty Out-Of-Sync Target Activated");
return 1;
Endprogram

exported function SendAntyMacro(who, byref packet)

who := who;
syslog("SendAntyMacro");
return 1;

endfunction 
And I found maked script by MontuZ:
target.src

Code: Select all

/*
   Author: Unreal (MontuZ@Gmail.com) April 23, 2006.
   Version: 1.0
   Core: 096
*/

Use uo;
Use os;

Const OFFSET_TYPE := 0x1;
Const OFFSET_SERIAL := 0x7;
Const OFFSET_CMD := 0xB;

Program Install()

	Print( "Hooking Target Packets..." );
	Return 1;

Endprogram

exported Function OnTarget( Who, byref Packet )

    Var xTarget;
    Var xTgt_Type := Packet.GetInt8( OFFSET_TYPE );
    Var xTgt_Cmd := Packet.GetInt32( OFFSET_CMD );

      If( xTgt_Cmd == 0 && xTgt_Type == 0 )
       xTarget := SystemFindObjectBySerial( Packet.GetInt32( OFFSET_SERIAL ) );
        If( !xTarget )
         Packet.SetInt32( OFFSET_SERIAL, 0 );
         Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF );
        Return 0;
        Endif
      Endif

    Return 0;

Endfunction
uopacket.cfg

Code: Select all

Packet 0x6C
{
  Length 0x13
  ReceiveFunction target:OnTarget
}


I'm trying to analyze it. Is it all right there?
Last edited by Harley on Sun Apr 02, 2017 11:46 am, edited 1 time in total.

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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

Post by Harley » Sun Apr 02, 2017 10:06 am

I made a table like Skinny did.
0x6C Packet.png
Is it right?

Now my thoughts. If I was right or wrong, tell me please. I want to learn it and will be very greateful for all your help!

out of sequence cursor. - this is occur from this:
BYTE[1] Cursor Target (see notes)

I want to translate MontuZ script:

Code: Select all

exported Function OnTarget( Who, byref Packet )

	Var xTarget;
	Var xTgt_Type := Packet.GetInt8( OFFSET_TYPE ); // Getting Cursor Target
	Var xTgt_Cmd := Packet.GetInt32( OFFSET_CMD ); // Getting X

	If( xTgt_Cmd == 0 && xTgt_Type == 0 ) // If X == 0 and if Cursor Target == 0
		xTarget := SystemFindObjectBySerial( Packet.GetInt32( OFFSET_SERIAL ) ); // Find character serial who Clicked On
		If( !xTarget ) // If didn't find
			Packet.SetInt32( OFFSET_SERIAL, 0 ); // What is here???
			Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF ); // What is here???
			Return 0;
		Endif
	Endif

	Return 0;

Endfunction
Was I right?

And I don't understand, what do packet here?
Packet.SetInt32( OFFSET_SERIAL, 0 ); // What is here???
Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF ); // What is here???


With best regards!

Skinny
Journeyman Poster
Posts: 61
Joined: Wed Dec 19, 2012 10:27 pm

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

Post by Skinny » Sun Apr 02, 2017 11:46 am

Harley wrote:
Sun Apr 02, 2017 6:31 am
I think that table each one can use for another packets, yeap?
Yes, sure.
Harley wrote:
Sun Apr 02, 2017 6:31 am
Now I try to understand another issue and fix it, that I think have not only my shard.
We have another flood from players:

Code: Select all

xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
xxx/xxx used out of sequence cursor.
I revealed this one and found when it happened.
When player try to make two things at once. For example: use fish steaks and bandages.
I think that packet respond for it:
https://docs.polserver.com/packets/inde ... acket=0x6C
Yes, 0x6C packet respond for it.
Harley wrote:
Sun Apr 02, 2017 6:31 am
*Updated after 10 minutes*
I found that someone tried to fix it.
viewtopic.php?t=1275

But didn't make a script.

Code: Select all

use uo;
use os;

Program Install()
print("Anty Out-Of-Sync Target Activated");
return 1;
Endprogram

exported function SendAntyMacro(who, byref packet)

who := who;
syslog("SendAntyMacro");
return 1;

endfunction 
This code is wrong. This 0x6C packet is sent both by Client and Server.
He used 'SendFunction' in uopacket.cfg and always 'return 1' on SendAntyMacro function. In this case, the Server will never send target cursor for the client (player).
Harley wrote:
Sun Apr 02, 2017 6:31 am
And I found maked script by MontuZ:

Code: Select all

/*
   Author: Unreal (MontuZ@Gmail.com) April 23, 2006.
   Version: 1.0
   Core: 096
*/

Use uo;
Use os;

Const OFFSET_TYPE := 0x1;
Const OFFSET_SERIAL := 0x7;
Const OFFSET_CMD := 0xB;

Program Install()

	Print( "Hooking Target Packets..." );
	Return 1;

Endprogram

exported Function OnTarget( Who, byref Packet )

    Var xTarget;
    Var xTgt_Type := Packet.GetInt8( OFFSET_TYPE );
    Var xTgt_Cmd := Packet.GetInt32( OFFSET_CMD );

      If( xTgt_Cmd == 0 && xTgt_Type == 0 )
       xTarget := SystemFindObjectBySerial( Packet.GetInt32( OFFSET_SERIAL ) );
        If( !xTarget )
         Packet.SetInt32( OFFSET_SERIAL, 0 );
         Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF );
        Return 0;
        Endif
      Endif

    Return 0;

Endfunction
I'm trying to analyze it. Is it all right there?
Hmm... I think this works.
Remember to put 'ReceiveFunction' in uopacket.cfg
See an example:

Code: Select all

Packet 0x6C
{
Length 19
ReceiveFunction scriptname:functionname
}
Harley wrote:
Sun Apr 02, 2017 10:06 am
I made a table like Skinny
0x6C Packet.png
Is it right?
Yes! :D

Harley
Forum Regular
Posts: 301
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

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

Post by Harley » Sun Apr 02, 2017 11:53 am

Skinny, look please my previous post again, I edited it when you was writing new post;-)

Skinny
Journeyman Poster
Posts: 61
Joined: Wed Dec 19, 2012 10:27 pm

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

Post by Skinny » Sun Apr 02, 2017 12:35 pm

Harley wrote:
Sun Apr 02, 2017 10:06 am
Now my thoughts. If I was right or wrong, tell me please. I want to learn it and will be very greateful for all your help!

out of sequence cursor. - this is occur from this:
BYTE[1] Cursor Target (see notes)
Seeing notes in 0x6C packet, if the Cursor Target is 0, so, this saying that is "Select Object".

Lets read notes about 0x6C packet:
Notes
Cursor Target
0: Select Object
1: Select X, Y, Z

Cursor Type
0: Neutral
1: Harmful
2: Helpful
3: Cancel current targetting (server sent)

The model # should never be trusted.

Once the server requests the client to target something, the server can undo this also. You can "kill" the targeting cursor faithfully and without any bugs. Send another Packet with Type set to 0 (Object), Cursor ID 00000000, and Cursor Type as 3. The client will respond to this by sending a response to the original request just as if the user had hit ESC to cancel targeting.

Code: Select all

Packet.SetInt32( OFFSET_SERIAL, 0 ); // What is here???
He forces to set zero to serial value.

Code: Select all

Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF ); // What is here???
I think this is wrong.
Try modify to this:

Code: Select all

/*
   Author: Unreal (MontuZ@Gmail.com) April 23, 2006.
   Version: 1.0
   Core: 096
*/

Use uo;
Use os;

Const OFFSET_TYPE := 0x1;
Const OFFSET_SERIAL := 0x7;
Const OFFSET_CMD := 0xB;

Program Install()

	Print( "Hooking Target Packets..." );
	Return 1;

Endprogram

exported Function OnTarget( Who, byref Packet )

    Var xTarget;
    Var xTgt_Type := Packet.GetInt8( OFFSET_TYPE );
    Var xTgt_Cmd_x := Packet.GetInt16( OFFSET_CMD );
    Var xTgt_Cmd_y := Packet.GetInt16(13);

      If( xTgt_Cmd_x == 0 && xTgt_Cmd_y == 0 && xTgt_Type == 0 )
       xTarget := SystemFindObjectBySerial( Packet.GetInt32( OFFSET_SERIAL ) );
        If( !xTarget )
         Packet.SetInt32( OFFSET_SERIAL, 0 );
         Packet.SetInt32( 2, 0 );
         Print("TEST IF HOOK WORKS");
        Endif
      Endif

    Return 0;

Endfunction
Did you test previous script?
Test the previous script and this above script.

Skinny
Journeyman Poster
Posts: 61
Joined: Wed Dec 19, 2012 10:27 pm

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

Post by Skinny » Thu Apr 06, 2017 1:12 am

Harley, you need fix this code:

Code: Select all

if ( dropserial != 0xFFFFFFFF )
Change to:

Code: Select all

if ( Hex(dropserial) != "0xFFFFFFFF" )
Or change to:

Code: Select all

if ( dropserial != -1 )
Detailed explanation is that the POL assumes that integers are 32bit signed.
And there is no format to say that the comparison is unsigned.

Thanks Nando for the tip.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest