Have a question.
Where to find this line
atCharacter ... tried to drop item ..., but had not gotten an item.
https://github.com/polserver/polserver
And what I have to add there to make "kick char" when this line shows up?
With best regards.
Moderator: POL Developer
atCharacter ... tried to drop item ..., but had not gotten an item.
Code: Select all
client->Disconnect();
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();
And what I need to add hereAnd 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
Turley, thanks for your answer.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
Packet 0x08
{
Length 14
ReceiveFunction dropping:dropping
}
Will be conflicts with this packethook?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
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
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
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
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.
...............
Code: Select all
Packet 0x08
{
Length 15
ReceiveFunction dropping:dropping
Version 2
}
I use 7.0.3Skinny 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:See about 0x08 packet.Code: Select all
Packet 0x08 { Length 15 ReceiveFunction dropping:dropping Version 2 }
Code: Select all
Packet 0x08
{
Length 14
ReceiveFunction dropping:dropping
}
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.
Harley wrote: ↑Sat Apr 01, 2017 2:07 pm Another question about that packet hook.
How to find and determine this one:What packet I have to use (what BYTE[???]) to make another code for kick players when they make "item out of range"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.
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
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
This information saves in this position with 4 bytes size:
Lets check the order sequence:
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.
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
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
Code: Select all
Packet 0x6C
{
Length 0x13
ReceiveFunction target:OnTarget
}
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
Yes, sure.
Yes, 0x6C packet respond for it.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:I revealed this one and found when it happened.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.
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
This code is wrong. This 0x6C packet is sent both by Client and Server.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
Hmm... I think this works.Harley wrote: ↑Sun Apr 02, 2017 6:31 am And I found maked script by MontuZ:I'm trying to analyze it. Is it all right there?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
Code: Select all
Packet 0x6C
{
Length 19
ReceiveFunction scriptname:functionname
}
Yes!
Seeing notes in 0x6C packet, if the Cursor Target is 0, so, this saying that is "Select Object".
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???
Code: Select all
Packet.SetInt32( OFFSET_CMD, 0xFFFFFFFF ); // What is here???
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
Code: Select all
if ( dropserial != 0xFFFFFFFF )
Code: Select all
if ( Hex(dropserial) != "0xFFFFFFFF" )
Code: Select all
if ( dropserial != -1 )