CWO wrote:
Are you sending the initialization at login/reconnect?
Yep.
Here is my modified packet, but it can only handle speekhack, not the the movement difference in the clients
Let me point out that I am not using this on a live shard, since I was not happy with the results.
uopacket.cfg
Code:
Packet 0x02
{
Length 7
ReceiveFunction antispeed:HandleSpeedHackers
}
pkg.cfg
Code:
Enabled 1
Name antispeedhack
Maintainer Repsak
Email repsak@pangaea-world.dk
CoreRequired 96
Version 1.0
Author/Basis CWO
logon.src
Code:
use uo;
use polsys;
use util;
program Login_AntiSpeedHack(who)
SetObjProperty(who, "#moves", CInt(0));
SetObjProperty(who, "#shackwarning", CInt(0));
EraseObjProperty(who, "#movepid");
var shackstack := array;
shackstack[1] := RandomInt(0x4000000000000)+1;
shackstack[2] := RandomInt(0x4000000000000)+1;
shackstack[3] := RandomInt(0x4000000000000)+1;
shackstack[4] := RandomInt(0x4000000000000)+1;
shackstack[5] := RandomInt(0x4000000000000)+1;
shackstack[6] := RandomInt(0x4000000000000)+1;
var shstack := CreatePacket(0xBF, 29);
shstack.SetInt16(1,0x001D);
shstack.SetInt16(3,0x0001);
shstack.SetInt32(5, shackstack[1]);
shstack.SetInt32(9, shackstack[2]);
shstack.SetInt32(13, shackstack[3]);
shstack.SetInt32(17, shackstack[4]);
shstack.SetInt32(21, shackstack[5]);
shstack.SetInt32(25, shackstack[6]);
shstack.SendPacket(who);
SetObjProperty(who, "#shackstack", shackstack);
endprogram
reconnect.src
Code:
use uo;
use polsys;
use util;
program Reconnect_AntiSpeedHack(who)
SetObjProperty(who, "#moves", CInt(0));
SetObjProperty(who, "#shackwarning", CInt(0));
EraseObjProperty(who, "#movepid");
var shackstack := array;
shackstack[1] := RandomInt(0x4000000000000)+1;
shackstack[2] := RandomInt(0x4000000000000)+1;
shackstack[3] := RandomInt(0x4000000000000)+1;
shackstack[4] := RandomInt(0x4000000000000)+1;
shackstack[5] := RandomInt(0x4000000000000)+1;
shackstack[6] := RandomInt(0x4000000000000)+1;
var shstack := CreatePacket(0xBF, 29);
shstack.SetInt16(1,0x001D);
shstack.SetInt16(3,0x0001);
shstack.SetInt32(5, shackstack[1]);
shstack.SetInt32(9, shackstack[2]);
shstack.SetInt32(13, shackstack[3]);
shstack.SetInt32(17, shackstack[4]);
shstack.SetInt32(21, shackstack[5]);
shstack.SetInt32(25, shackstack[6]);
shstack.SendPacket(who);
SetObjProperty(who, "#shackstack", shackstack);
endprogram
antispeedhelper.src
Code:
use uo;
use os;
use polsys;
use util;
program antispeed(who)
SetObjProperty(who, "#movepid", GetPid());
var packet, newkey, shackwarning;
while(GetObjProperty(who, "#moves"))
if (GetEquipmentByLayer(who, 25))
sleepms(80); // 80
else
sleepms(160); // 160
endif
set_critical(1);
newkey := RandomInt(0x4000000000000)+1;
packet := CreatePacket(0xBF, 9);
packet.SetInt16(1,0x0009);
packet.SetInt16(3,0x0002);
packet.SetInt32(5,newkey);
packet.SendPacket(who);
shackwarning := CInt(GetObjProperty(who, "#shackwarning"));
SetObjProperty(who, "#moves", CInt(GetObjProperty(who, "#moves")-1));
var shackstack := GetObjProperty(who, "#shackstack");
shackstack.append(newkey);
SetObjProperty(who, "#shackstack", shackstack);
set_critical(0);
if (shackwarning)
SetObjProperty(who, "#shackwarning", shackwarning-1);
if (shackwarning > 5)
Print(who.name + " is getting excessive speedhack warnings!");
SetObjProperty(who, "#shackwarning", CInt(0));
endif
endif
endwhile
SetObjProperty(who, "#shackwarning", CInt(0));
EraseObjProperty(who, "#movepid");
endprogram
antispeed.src
Code:
use uo;
use os;
use polsys;
use unicode;
use util;
program AntiSpeedHack()
Print("PacketHooks - Anti SpeedHack" );
return 1;
endprogram
exported function HandleSpeedHackers(character, byref packet)
var direction := packet.GetInt8(1);
var shackcheck := packet.GetInt32(3);
if ((character.facing != direction) && (character.facing != (direction - 128) ))
//Changed facing, send a new key since this isn't really a move
//var newkey := RandomInt(0x4000000000000)+1;
//var sstack := GetObjProperty(character, "#shackstack");
//sstack[6] := newkey;
//SetObjProperty(character, "#shackstack", sstack);
var packet := CreatePacket(0xBF, 9);
packet.SetInt16(1,0x0009);
packet.SetInt16(3,0x0002);
//packet.SetInt32(5,newkey);
packet.SetInt32(5, shackcheck);
packet.SendPacket(character);
return 0;
endif
var sstack := GetObjProperty(character, "#shackstack");
var moves := CInt(GetObjProperty(character, "#moves"));
if(shackcheck and shackcheck in sstack and moves < 6)
var newstack := array;
foreach num in sstack
if (num != shackcheck)
newstack.append(num);
endif
endforeach
SetObjProperty(character, "#moves", moves+1);
SetObjProperty(character, "#shackstack", newstack);
if (!GetObjProperty(character, "#movepid"))
Start_Script("antispeedhelper", character);
endif
else
SendSysMessage(character, "Too fast");
SetObjProperty(character, "#shackwarning", GetObjProperty(character, "#shackwarning")+2);
var reject := CreatePacket(0x21, 8);
reject.SetInt8(1, packet.GetInt8(2));
reject.SetInt16(2, character.x);
reject.SetInt16(4, character.y);
reject.SetInt8(6, direction);
reject.SetInt8(7, character.z);
reject.SendPacket(character);
return 1;
endif
return 0;
endfunction
antispeed.src is the one I have worked the most with, trying the change the upper time (80 and 160) to see hot the client would react.
I should add that the original pkg did not work, so I had to make a few modification on the original design.