Fix /setspeedmod: apply per-character, persist across stat recalculation

Previously stomped the shared GServer->MOVE_SPEED_MOD movement-timing
divisor, which character.cpp's UpdatePosition also uses for monster position
interpolation -- GM testing broke movement/attack range server-wide until
restart. Now stores a per-character SpeedModPercent that GetMoveSpeed()
applies on every recompute, so it survives future SetStats() calls instead
of being silently overwritten back to base speed. Also fixes Mspd_base (the
value actually broadcast to clients) never being set while WALKING.
This commit is contained in:
Thomas committed 2026-07-10 14:19:32 +02:00
1 parent 15e562cb04
commit 16dccc94f2
4 files changed
+28 -2

No files matched your search

+19 -2
View File
@@ -3814,10 +3814,27 @@ bool CWorldServer::pakGMChangeMonsterDmg(CPlayer* thisclient, int rate)
return true;
}
//change the mSpeedModif || For test only
//change this GM's own move speed by a percentage (100 = unmodified) || For test only
bool CWorldServer::pakGMChangeMSpeedModif(CPlayer* thisclient, int modif)
{
GServer->MOVE_SPEED_MOD = modif;
// NOTE: this used to stomp GServer->MOVE_SPEED_MOD, a server-wide
// constant that character.cpp's UpdatePosition also uses for monster
// position interpolation -- overwriting it here broke movement/attack
// range for everyone until the next restart reloaded it from
// list_config.movespeedmod. Use a per-character percent instead, which
// GetMoveSpeed() applies on every recompute so it survives future stat
// refreshes (equip changes, buffs, etc.) instead of being a one-shot
// value that the next SetStats() call overwrites back to base.
if(modif == 0) modif = 100;
thisclient->Stats->SpeedModPercent = modif;
thisclient->SetStats( );
BEGINPACKET( pakspd, 0x782 );
ADDWORD( pakspd, thisclient->clientid );
ADDBYTE( pakspd, thisclient->Status->Stance );
ADDWORD( pakspd, thisclient->Stats->Mspd_base );
SendToVisible( &pakspd, thisclient );
BEGINPACKET (pak, 0x702);
ADDSTRING(pak, "mSpeedModif Changed.");
ADDBYTE(pak, 0);