diff --git a/docs/jsdocs.html b/docs/jsdocs.html index 34762505c..5dcbf3acb 100644 --- a/docs/jsdocs.html +++ b/docs/jsdocs.html @@ -1704,36 +1704,44 @@

January 9th, 2022

-

Example of usage
+

+ Example of usage

function onDrop( iDropped, pDropper )
 {
 	var pSock = pDropper.socket;
 
-	//Lets fetch the serial of the target-location
-	var temp1 = pSock.GetByte( 10 );
-	var temp2 = pSock.GetByte( 11 );
-	var temp3 = pSock.GetByte( 12 );
-	var temp4 = pSock.GetByte( 13 );
+	// Client version 6.0.1.7+ has an additional byte before serial of target container
+	// Will contain a value for backpack grid index item was dropped in when using clients that support grid containers
+	// Will contain a value of -1 in regular 2D UO client and 0 in ClassicUO
+	var serOffset = (pSock.clientMajorVer > 6 || ( pSock.clientMajorVer == 6 && pSock.clientSubVer >= 1 && pSock.clientLetterVer >= 7)) ? 11 : 10;
+	targSer1 = pSock.GetByte( serOffset + 0 ); // 0 = dropped on character, 0xFF = ground/item
+	targSer2 = pSock.GetByte( serOffset + 1 );
+	targSer3 = pSock.GetByte( serOffset + 2 );
+	targSer4 = pSock.GetByte( serOffset + 3 )
 
-	//Check the value of Byte 10 to determine if the target is ground, character or container
-	if( temp1 == 0 ) //Target is a character
-	{
-		var targetChar = CalcCharFromSer( temp1, temp2, temp3, temp4 )
-		pDropper.TextMessage( "I've dropped this item on a character named "+targetChar.name+", let's bounce it back." );
-		return false;
-	}
-	if( temp1 == 0xFF ) //Target is ground or another item
+	if( targSer1 == 0 ) // Target is a character
 	{
-		pDropper.TextMessage( "I've dropped this item on the ground or on another item." );
-		return true;
+		var targetChar = CalcCharFromSer( targSer1, targSer2, targSer3, targSer4 )
+		if( ValidateObject( targetChar ))
+		{
+			pDropper.TextMessage( "I've dropped this item on a character, deny if not my own character!!" );
+			if( targetChar.serial != pDropper.serial )
+			{
+				pDropper.TextMessage( "DENIED!" );
+				return false;
+			}
+		}
 	}
-	if( temp1 <= 0x40 ) //Target is a container
+	else if( targSer1 == 0xFF ) // Target is ground or another non-container item
 	{
-		var targetItem = CalcItemFromItem( temp1, temp2, temp3, temp4 );
-		pDropper.TextMessage( "I've dropped this item in/on a container with ID "+targetItem.id+"." );
-		return true;
+		pDropper.TextMessage( "I've dropped this item on the ground or on another item, let's approve!" );
 	}
-}

+ + // Default to allow dropping, let code handle it! + return true; +} + +

@@ -1780,6 +1788,23 @@

January 9th, 2022

cDropper.TextMessage( "Generic error message!" ); return false; } +} + +function onDropItemOnItem( iDropped, pDropper, iDroppedOn ) +{ + if( !ValidateObject( iDroppedOn )) + return false; + + pDropper.TextMessage( "I've dropped this item in/on a container, deny if it's not my main pack!" ); + var iPack = pDropper.pack; + if( !ValidateObject( iPack ) || iPack.serial != iDroppedOn.serial ) + { + pDropper.TextMessage( "DENIED!" ); + return false; + } + + // Default to allow dropping, let code handle it! + return true; }

@@ -5805,7 +5830,7 @@

January 9th, 2022

Prototype

ITEM FindRootContainer( iObj );

-

ITEM FindRootContainer( iObjSerial );

+

ITEM FindRootContainer( iObjSerial );

Purpose