Fixed bugreport:6044 mercenaries should warp after being far from the master after 3 seconds.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16327 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
66d5d750fe
commit
a01a3cbb21
@ -46,6 +46,7 @@ struct mercenary_data {
|
||||
int contract_timer;
|
||||
|
||||
unsigned devotion_flag : 1;
|
||||
unsigned int masterteleport_timer;
|
||||
};
|
||||
|
||||
bool merc_class(int class_);
|
||||
|
@ -182,8 +182,22 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
sd->areanpc_id=0;
|
||||
|
||||
if( sd->md && !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE) )
|
||||
{// mercenary is too far from the master so warp the master's position
|
||||
unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT );
|
||||
{
|
||||
// mercenary should be warped after being 3 seconds too far from the master [greenbox]
|
||||
if (sd->md->masterteleport_timer == 0)
|
||||
{
|
||||
sd->md->masterteleport_timer = gettick();
|
||||
}
|
||||
else if (DIFF_TICK(gettick(), sd->md->masterteleport_timer) > 3000)
|
||||
{
|
||||
sd->md->masterteleport_timer = 0;
|
||||
unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset the tick, he is not far anymore
|
||||
sd->md->masterteleport_timer = 0;
|
||||
}
|
||||
} else if (md) {
|
||||
if( map_getcell(bl->m,x,y,CELL_CHKNPC) ) {
|
||||
@ -206,9 +220,25 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
|
||||
clif_move(ud);
|
||||
}
|
||||
}
|
||||
else if( mrd && mrd->master && !check_distance_bl(&mrd->master->bl, bl, MAX_MER_DISTANCE) )
|
||||
{// mercenary is too far from the master so warp the master's position
|
||||
unit_warp( bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT );
|
||||
else if( mrd && mrd->master )
|
||||
{
|
||||
if (!check_distance_bl(&mrd->master->bl, bl, MAX_MER_DISTANCE))
|
||||
{
|
||||
// mercenary should be warped after being 3 seconds too far from the master [greenbox]
|
||||
if (mrd->masterteleport_timer == 0)
|
||||
{
|
||||
mrd->masterteleport_timer = gettick();
|
||||
}
|
||||
else if (DIFF_TICK(gettick(), mrd->masterteleport_timer) > 3000)
|
||||
{
|
||||
mrd->masterteleport_timer = 0;
|
||||
unit_warp( bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mrd->masterteleport_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(tid == INVALID_TIMER) //A directly invoked timer is from battle_stop_walking, therefore the rest is irrelevant.
|
||||
|
Loading…
x
Reference in New Issue
Block a user