otclient icon indicating copy to clipboard operation
otclient copied to clipboard

Limiting packets sent by OTClient

Open Sceptero opened this issue 11 years ago • 2 comments

Many new servers use "maxPacketsPerSecond = 25". Holding down a hotkey button pressed results in a kick from those servers. Cipsoft's tibia client must be limiting number of packets which are sent while holding down a hotkey because you can do it and not get kicked out of the server. Maybe adding some configurable delay between each packet of the same type would solve the problem.

Sceptero avatar Sep 06 '14 17:09 Sceptero

I'm pretty sure that cipbia currently sends packet onKeyDown and if given time passes onKeyUp, this was used to reduce dummies abuse

zakius avatar Dec 10 '14 08:12 zakius

Code to limit hotkey (not packets per second of whole client). In source src\framework\luafunctions.cpp add new function (we need high precision time in LUA):

g_lua.bindGlobalFunction("timeMillis", []() { return (int) stdext::millis(); });

In modules game_hotkeys\hotkeys_manager.lua before:

function doKeyCombo(keyCombo)

Add:

local lastHotkeyUse = 0

After:

if hotKey.autoSend then

Add:

if timeMillis() - lastHotkeyUse < 100 then return end
lastHotkeyUse = timeMillis()

Simple limit until we get source fix for it. 100 = 100 miliseconds (0.1 sec) between hotkeys actions. Tested on newest sources.

gesior avatar Jun 20 '15 22:06 gesior