This won't fix the problem, but it's 100% detectable with this. There are some exceptions I haven't taken into account such as portals that will throw false positives, but after looking at the data for a bit you'll see it's fairly good at getting most people. I can't guarantee it'll work out of the box with the most recent dsp build, but it should get you most of the way there.
Open mmo.h and find position_t and make it look like this:
Code: Select all
struct position_t
{
uint8 rotation; // угол поворота сущности относительно своей позиции (используется 255 система, место 360°)
float x;
float y; // высота расположения сущности относительно "уровня моря"
float z;
float px;
float py;
float pz;
int16 zone;
uint16 moving; // что-то вроде расстояния перемещения, необходимое для правильной отрисовки в клиенте количества шагов сущности
};
Open time_server.cpp and right after this line:
Code: Select all
uint8 WeekDay = (uint8)CVanaTime::getInstance()->getWeekday();
Add this block:
Code: Select all
zoneutils::ForEachZone([](CZone* PZone)
{
luautils::OnGameTick(PZone);
const int8* fmtQuery = "update server_status set tick = unix_timestamp(now()) where zoneid = %i";
Sql_Query(SqlHandle, fmtQuery, map_port-56000);
PZone->ForEachChar([](CCharEntity* PChar)
{
float x = PChar->loc.p.x;
float y = PChar->loc.p.y;
float z = PChar->loc.p.z;
float px = PChar->loc.p.px;
float py = PChar->loc.p.py;
float pz = PChar->loc.p.pz;
float d = sqrt(pow((x - px), 2) + pow((z - pz), 2));
if (PChar->loc.p.zone != 1 && d /2.4*10 > 60 && PChar->animation != ANIMATION_CHOCOBO && !PChar->StatusEffectContainer->HasStatusEffect(EFFECT_FLEE))
{
const int8* fmtQuery = "INSERT INTO speed values (%u, '%s',%u,'%.3f',concat('%.3f',' ','%.3f',' ','%.3f','|','%.3f',' ','%.3f',' ','%.3f'),now());";
Sql_Query(SqlHandle, fmtQuery, PChar->id,PChar->GetName(),map_port-56000,d/2.4*10,x,y,z,px,py,pz);
ShowDebug(CL_YELLOW"%s's speed to high: %.3f\n" CL_RESET,PChar->GetName(), d / 2.4 * 10);
}
if (PChar->loc.p.zone != 1 && d / 2.4 * 10 > 100 && PChar->animation == ANIMATION_CHOCOBO)
{
const int8* fmtQuery = "INSERT INTO speed values (%u, '%s',%u,'%.3f',concat('%.3f',' ','%.3f',' ','%.3f','|','%.3f',' ','%.3f',' ','%.3f'),now());";
Sql_Query(SqlHandle, fmtQuery, PChar->id, PChar->GetName(), map_port - 56000, d / 2.4 * 10, x, y, z, px, py, pz);
ShowDebug(CL_YELLOW"%s's Chocobo is on fire! %.3f\n" CL_RESET, PChar->GetName(), d / 2.4 * 10);
}
if (PChar->loc.p.zone == 1)
{
ShowDebug(CL_YELLOW"%s zoned, ignoring speed, unzoning.\n" CL_RESET, PChar->GetName());
}
PChar->loc.p.px = PChar->loc.p.x;
PChar->loc.p.py = PChar->loc.p.y;
PChar->loc.p.pz = PChar->loc.p.z;
PChar->loc.p.zone = 0;
});
});
In lua_baseentity.cpp find setPos( and after
Code: Select all
if (m_PBaseEntity->objtype == TYPE_PC)
{
add
In lua_baseentity.cpp add this block which you can put in lua scripts to prevent false positives when a script warps them such as portals:
Code: Select all
inline int32 CLuaBaseEntity::setZoneFlag(lua_State *L)
{
m_PBaseEntity->loc.p.zone = 1;
}
Under charutils.cpp for loadchar add this:
Open your db and create a table:
Code: Select all
create table speed2 (charid int(10),charname varchar(30),zone smallint(6),speed varchar(10), pos varchar(300),time datetime);