HerculesWS/Hercules

clif_set_unit_walking sends blank to_x and to_y on mob_damage call

Opened this issue · 0 comments

Describe the bug
Sometimes when damaging a mob (tested mostly on mushrooms at job_thief1) after the damage packet the server sends a monster moved packet.
It seems

To Reproduce
Steps to reproduce the behavior:

  1. Go to job_thief1 and attack a mushroom
  2. Client receives a 09FD packet with info eg. CoordsFrom 150 150 | CoordsTo 0 0
  3. Commenting the following line at mob.c removes the issue (the packet 0,0 is not sent)

Also adding the following warning at clif_set_unit_walking:
ShowWarning("clif_set_unit_walking: sending from (%d %d) to (%d %d).\n", bl->x, bl->y, ud->to_x, ud->to_y);
Prints this:
[Warning]: clif_set_unit_walking: sending from (261 325) to (0 0).

mob_damage at mob.c
clif->set_unit_walking(&md->bl, NULL, unit->bl2ud(&md->bl), AREA);

Also adding the following just above said line fixes the the issue:

unit->bl2ud(&md->bl)->to_x = md->bl.x;
unit->bl2ud(&md->bl)->to_y = md->bl.y;

Screenshots
8fd71e427664f98749ac375a02558cf4
Video showcase: https://www.youtube.com/watch?v=KdORdjhBxPE

System specs (please complete the following information):
[Info]: Hercules 32-bit for Windows
[Info]: Build revision: '202112010'
[Info]: Git revision (src): '33e1de6c866c4adc6d2da695736f66b9694439f5'
[Info]: Git revision (scripts): '33e1de6c866c4adc6d2da695736f66b9694439f5'
[Info]: OS version: 'Windows 10 Workstation (other) (build 19044) [x86_64]'
[Info]: CPU: 'x86_64 CPU, Family 23, Model 8, Stepping 2 [16]'
[Info]: Compiled with Microsoft Visual C++ 2022 (v1930), zlib: 1.2.7
[Info]: Compile Flags: N/A
[Info]: Feature Flags: 0x0
[Info]: Timer Function Type: ticks count
[Info]: Packet version: 20190605 main

Plugins used or source modifications
None

Additional context
Tested and confirmed using openkore, hope that is not a problem.