Issue information

Issue ID
#3930
Status
Unable to Reproduce
Severity
None
Started
Hercules Elf Bot
Dec 12, 2009 16:03
Last Post
Hercules Elf Bot
Jun 23, 2012 9:27
Confirmation
N/A

Hercules Elf Bot - Dec 12, 2009 16:03

Originally posted by [b]Yonimelavo[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3930

Hi,

You can use fly wings/teleport/whatever to avoid reaching the mercenary expiration time. The mercenary must be attacking a monster and half a second before the expiration time ends you must teleport. The message "The mercenary contract has expired" will show, but the mercenary will still be there, following you, killing monsters and giving exp.

To test it easily, go to merc_contract_init on mercenary.c and change this line:
CODE
md->contract_timer = add_timer(gettick() + md->mercenary.life_time, merc_contract_end, md->master->bl.id, 0);
to
CODE
md->contract_timer = add_timer(gettick() + 1000, merc_contract_end, md->master->bl.id, 0);

This will make the mercenary go away after a second or so. Then go to a map with aggresive monsters, stand near one, use a mercenary scroll and when he begins to attack the monster just @jump away.

The problem seems to be on unit_remove_map_ in unit.c:
CODE
if( mercenary_get_lifetime(md) <= 0 && !(md->master && !md->master->state.active) )

This function seems to be called from the client when you teleport or the contract time expires. The second half of the condition has always the same values, so the problem must be that when you teleport mercenary_get_lifetime is greater than 0, and if the contract expires while teleporting the function is not called by the client, so the mercenary doesn't go away.

Hercules Elf Bot - Dec 17, 2011 5:05

Originally posted by [b]Ind[/b]
I wasn't able to reproduce