int unit_teleport_timer(int tid, unsigned int tick, int id, intptr_t data){
struct block_list *bl = map_id2bl(id);
int *mast_tid = unit_get_masterteleport_timer(bl);
if(tid == INVALID_TIMER)
return 0;
else if(*mast_tid && *mast_tid != tid)
return 0;
else {
TBL_PC *msd = unit_get_master(bl);
switch(data){
case BL_HOM:
case BL_ELEM:
case BL_PET :
case BL_MER :
if(msd && *mast_tid != INVALID_TIMER && !check_distance_bl(&msd->bl, bl, MAX_MER_DISTANCE)){
*mast_tid = INVALID_TIMER;
unit_warp(bl, msd->bl.id, msd->bl.x, msd->bl.y, CLR_TELEPORT );
}
break;
}
}
return 0;
}