bump.
I see this at eathena. anyone know how to work this code in rathena?
void pc_inventory_rentals(struct map_session_data *sd)
{
int i, c = 0;
int counter,flag = 0;
unsigned int expire_tick, next_tick = UINT_MAX;
for( i = 0; i < MAX_INVENTORY; i++ )
{
if( sd->status.inventory[i].nameid == 0 )
continue; // Nothing here
if( sd->status.inventory[i].expire_time == 0 )
continue;
if( sd->status.inventory[i].expire_time <= time(NULL) )
{
clif_rental_expired(sd->fd, sd->status.inventory[i].nameid);
// loop through rental item cards (if it exists)
// then add it to user's inventory
for(counter=0;counter<4;counter++){
if(sd->status.inventory[i].card[counter]>0){
struct item card_it;
memset(&card_it,0,sizeof(card_it));
card_it.nameid=sd->status.inventory[i].card[counter];
card_it.identify=itemdb_isidentified(card_it.nameid);
if ((flag = pc_additem(sd, &card_it, 1)))
{
clif_additem(sd, 0, 0, flag);
if( pc_candrop(sd,&card_it) )
map_addflooritem(&card_it,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
// delete rental item
pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
}
else
{
expire_tick = (unsigned int)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
clif_rental_time(sd->fd, sd->status.inventory[i].nameid, (int)(expire_tick / 1000));
next_tick = min(expire_tick, next_tick);
c++;
}
}
if( c > 0 ) // min(next_tick,3600000) 1 hour each timer to keep announcing to the owner, and to avoid a but with rental time > 15 days
sd->rental_timer = add_timer(gettick() + min(next_tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
else
sd->rental_timer = INVALID_TIMER;
}