summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index b8380a840..949a66d8c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -179,8 +179,8 @@ void pc_setinvincibletimer(struct map_session_data* sd, int val) {
val += map[sd->bl.m].invincible_time_inc;
if( sd->invincible_timer != INVALID_TIMER )
- iTimer->delete_timer(sd->invincible_timer,pc_invincible_timer);
- sd->invincible_timer = iTimer->add_timer(iTimer->gettick()+val,pc_invincible_timer,sd->bl.id,0);
+ timer->delete(sd->invincible_timer,pc_invincible_timer);
+ sd->invincible_timer = timer->add(timer->gettick()+val,pc_invincible_timer,sd->bl.id,0);
}
void pc_delinvincibletimer(struct map_session_data* sd)
@@ -189,9 +189,9 @@ void pc_delinvincibletimer(struct map_session_data* sd)
if( sd->invincible_timer != INVALID_TIMER )
{
- iTimer->delete_timer(sd->invincible_timer,pc_invincible_timer);
+ timer->delete(sd->invincible_timer,pc_invincible_timer);
sd->invincible_timer = INVALID_TIMER;
- skill->unit_move(&sd->bl,iTimer->gettick(),1);
+ skill->unit_move(&sd->bl,timer->gettick(),1);
}
}
@@ -240,15 +240,15 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
if( sd->spiritball && sd->spiritball >= max ) {
if(sd->spirit_timer[0] != INVALID_TIMER)
- iTimer->delete_timer(sd->spirit_timer[0],pc_spiritball_timer);
+ timer->delete(sd->spirit_timer[0],pc_spiritball_timer);
sd->spiritball--;
if( sd->spiritball != 0 )
memmove(sd->spirit_timer+0, sd->spirit_timer+1, (sd->spiritball)*sizeof(int));
sd->spirit_timer[sd->spiritball] = INVALID_TIMER;
}
- tid = iTimer->add_timer(iTimer->gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
- ARR_FIND(0, sd->spiritball, i, sd->spirit_timer[i] == INVALID_TIMER || DIFF_TICK(iTimer->get_timer(tid)->tick, iTimer->get_timer(sd->spirit_timer[i])->tick) < 0);
+ tid = timer->add(timer->gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
+ ARR_FIND(0, sd->spiritball, i, sd->spirit_timer[i] == INVALID_TIMER || DIFF_TICK(timer->get(tid)->tick, timer->get(sd->spirit_timer[i])->tick) < 0);
if( i != sd->spiritball )
memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int));
sd->spirit_timer[i] = tid;
@@ -282,7 +282,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type)
for(i=0;i<count;i++) {
if(sd->spirit_timer[i] != INVALID_TIMER) {
- iTimer->delete_timer(sd->spirit_timer[i],pc_spiritball_timer);
+ timer->delete(sd->spirit_timer[i],pc_spiritball_timer);
sd->spirit_timer[i] = INVALID_TIMER;
}
}
@@ -488,7 +488,7 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
{
if( sd->rental_timer != INVALID_TIMER )
{
- iTimer->delete_timer(sd->rental_timer, pc_inventory_rental_end);
+ timer->delete(sd->rental_timer, pc_inventory_rental_end);
sd->rental_timer = INVALID_TIMER;
}
@@ -523,7 +523,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
}
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 = iTimer->add_timer(iTimer->gettick() + min(next_tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
+ sd->rental_timer = timer->add(timer->gettick() + min(next_tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
else
sd->rental_timer = INVALID_TIMER;
}
@@ -538,15 +538,15 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds)
if( sd->rental_timer != INVALID_TIMER )
{
const struct TimerData * td;
- td = iTimer->get_timer(sd->rental_timer);
- if( DIFF_TICK(td->tick, iTimer->gettick()) > tick )
+ td = timer->get(sd->rental_timer);
+ if( DIFF_TICK(td->tick, timer->gettick()) > tick )
{ // Update Timer as this one ends first than the current one
pc->inventory_rental_clear(sd);
- sd->rental_timer = iTimer->add_timer(iTimer->gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
+ sd->rental_timer = timer->add(timer->gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
}
}
else
- sd->rental_timer = iTimer->add_timer(iTimer->gettick() + min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
+ sd->rental_timer = timer->add(timer->gettick() + min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
}
/**
@@ -637,7 +637,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->client_tick = client_tick;
sd->state.active = 0; //to be set to 1 after player is fully authed and loaded.
sd->bl.type = BL_PC;
- sd->canlog_tick = iTimer->gettick();
+ sd->canlog_tick = timer->gettick();
//Required to prevent homunculus copuing a base speed of 0.
sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
return 0;
@@ -978,7 +978,7 @@ int pc_isequip(struct map_session_data *sd,int n)
*------------------------------------------*/
bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers) {
int i;
- unsigned long tick = iTimer->gettick();
+ unsigned long tick = timer->gettick();
uint32 ip = session[sd->fd]->client_addr;
sd->login_id2 = login_id2;
@@ -1327,7 +1327,7 @@ int pc_reg_received(struct map_session_data *sd)
map[sd->bl.m].users_pvp--;
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {// unregister the player for ranking
- iTimer->delete_timer( sd->pvp_timer, pc->calc_pvprank_timer );
+ timer->delete( sd->pvp_timer, pc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
clif->changeoption(&sd->bl);
@@ -1991,7 +1991,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
}
else
{ // Logout / Unequipped an item with an activated bonus
- iTimer->delete_timer(autobonus[i].active,pc->endautobonus);
+ timer->delete(autobonus[i].active,pc->endautobonus);
autobonus[i].active = INVALID_TIMER;
}
}
@@ -2019,7 +2019,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
script->run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
}
- autobonus->active = iTimer->add_timer(iTimer->gettick()+autobonus->duration, pc->endautobonus, sd->bl.id, (intptr_t)autobonus);
+ autobonus->active = timer->add(timer->gettick()+autobonus->duration, pc->endautobonus, sd->bl.id, (intptr_t)autobonus);
sd->state.autobonus |= autobonus->pos;
status_calc_pc(sd,0);
@@ -4090,7 +4090,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
{
int flag=0;
- unsigned int tick = iTimer->gettick();
+ unsigned int tick = timer->gettick();
struct map_session_data *first_sd = NULL,*second_sd = NULL,*third_sd = NULL;
struct party_data *p=NULL;
@@ -4344,7 +4344,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
* 1 = success
*------------------------------------------*/
int pc_useitem(struct map_session_data *sd,int n) {
- unsigned int tick = iTimer->gettick();
+ unsigned int tick = timer->gettick();
int amount, nameid, i;
struct script_code *item_script;
@@ -4892,8 +4892,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if (sd->sc.data[SC_KNOWLEDGE]) {
struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE];
if (sce->timer != INVALID_TIMER)
- iTimer->delete_timer(sce->timer, iStatus->change_timer);
- sce->timer = iTimer->add_timer(iTimer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), iStatus->change_timer, sd->bl.id, SC_KNOWLEDGE);
+ timer->delete(sce->timer, iStatus->change_timer);
+ sce->timer = timer->add(timer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), iStatus->change_timer, sd->bl.id, SC_KNOWLEDGE);
}
status_change_end(&sd->bl, SC_PROPERTYWALK, INVALID_TIMER);
status_change_end(&sd->bl, SC_CLOAKING, INVALID_TIMER);
@@ -5736,7 +5736,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
} else
pc->setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
}
- sd->followtimer = iTimer->add_timer(
+ sd->followtimer = timer->add(
tick + 1000, // increase time a bit to loosen up map's load
pc_follow_timer, sd->bl.id, 0);
return 0;
@@ -5747,7 +5747,7 @@ int pc_stop_following (struct map_session_data *sd)
nullpo_ret(sd);
if (sd->followtimer != INVALID_TIMER) {
- iTimer->delete_timer(sd->followtimer,pc_follow_timer);
+ timer->delete(sd->followtimer,pc_follow_timer);
sd->followtimer = INVALID_TIMER;
}
sd->followtarget = -1;
@@ -5767,7 +5767,7 @@ int pc_follow(struct map_session_data *sd,int target_id)
pc->stop_following(sd);
sd->followtarget = target_id;
- pc_follow_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
+ pc_follow_timer(INVALID_TIMER, timer->gettick(), sd->bl.id, 0);
return 0;
}
@@ -6705,7 +6705,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
if( sd->status.ele_id > 0 )
elemental->set_target(sd,src);
- sd->canlog_tick = iTimer->gettick();
+ sd->canlog_tick = timer->gettick();
}
/*==========================================
@@ -6713,7 +6713,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
*------------------------------------------*/
int pc_dead(struct map_session_data *sd,struct block_list *src) {
int i=0,j=0,k=0;
- unsigned int tick = iTimer->gettick();
+ unsigned int tick = timer->gettick();
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
@@ -6910,7 +6910,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
pc->setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,iStatus->skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1));
if(map_flag_gvg2(sd->bl.m))
- pc_respawn_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
+ pc_respawn_timer(INVALID_TIMER, timer->gettick(), sd->bl.id, 0);
return 0;
}
}
@@ -7027,18 +7027,18 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
}
if( sd->pvp_point < 0 )
{
- iTimer->add_timer(tick+1, pc_respawn_timer,sd->bl.id,0);
+ timer->add(tick+1, pc_respawn_timer,sd->bl.id,0);
return 1|8;
}
}
//GvG
if( map_flag_gvg2(sd->bl.m) ) {
- iTimer->add_timer(tick+1, pc_respawn_timer, sd->bl.id, 0);
+ timer->add(tick+1, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
} else if( sd->bg_id ) {
struct battleground_data *bgd = bg->team_search(sd->bg_id);
if( bgd && bgd->mapindex > 0 ) { // Respawn by BG
- iTimer->add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
+ timer->add(tick+1000, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
}
}
@@ -7046,7 +7046,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
//Reset "can log out" tick.
if( battle_config.prevent_logout )
- sd->canlog_tick = iTimer->gettick() - battle_config.prevent_logout;
+ sd->canlog_tick = timer->gettick() - battle_config.prevent_logout;
return 1;
}
@@ -8352,7 +8352,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name)
if( i == MAX_EVENTTIMER )
return 0;
- sd->eventtimer[i] = iTimer->add_timer(iTimer->gettick()+tick, pc_eventtimer, sd->bl.id, (intptr_t)aStrdup(name));
+ sd->eventtimer[i] = timer->add(timer->gettick()+tick, pc_eventtimer, sd->bl.id, (intptr_t)aStrdup(name));
sd->eventcount++;
return 1;
@@ -8374,13 +8374,13 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name)
// find the named event timer
ARR_FIND( 0, MAX_EVENTTIMER, i,
sd->eventtimer[i] != INVALID_TIMER &&
- (p = (char *)(iTimer->get_timer(sd->eventtimer[i])->data)) != NULL &&
+ (p = (char *)(timer->get(sd->eventtimer[i])->data)) != NULL &&
strcmp(p, name) == 0
);
if( i == MAX_EVENTTIMER )
return 0; // not found
- iTimer->delete_timer(sd->eventtimer[i],pc_eventtimer);
+ timer->delete(sd->eventtimer[i],pc_eventtimer);
sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
aFree(p);
@@ -8399,8 +8399,8 @@ int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick)
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i] != INVALID_TIMER && strcmp(
- (char *)(iTimer->get_timer(sd->eventtimer[i])->data), name)==0 ){
- iTimer->addtick_timer(sd->eventtimer[i],tick);
+ (char *)(timer->get(sd->eventtimer[i])->data), name)==0 ){
+ timer->addtick(sd->eventtimer[i],tick);
break;
}
@@ -8421,8 +8421,8 @@ int pc_cleareventtimer(struct map_session_data *sd)
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i] != INVALID_TIMER ){
- char *p = (char *)(iTimer->get_timer(sd->eventtimer[i])->data);
- iTimer->delete_timer(sd->eventtimer[i],pc_eventtimer);
+ char *p = (char *)(timer->get(sd->eventtimer[i])->data);
+ timer->delete(sd->eventtimer[i],pc_eventtimer);
sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
if (p) aFree(p);
@@ -8599,7 +8599,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
return 0;
}
- if( DIFF_TICK(sd->canequip_tick,iTimer->gettick()) > 0 )
+ if( DIFF_TICK(sd->canequip_tick,timer->gettick()) > 0 )
{
clif->equipitemack(sd,n,0,0);
return 0;
@@ -9096,7 +9096,7 @@ int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
}
if( pc->calc_pvprank(sd) > 0 )
- sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+PVP_CALCRANK_INTERVAL,pc->calc_pvprank_timer,id,data);
+ sd->pvp_timer = timer->add(timer->gettick()+PVP_CALCRANK_INTERVAL,pc->calc_pvprank_timer,id,data);
return 0;
}
@@ -9337,7 +9337,7 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
interval = iMap->autosave_interval/(iMap->usercount()+1);
if(interval < iMap->minsave_interval)
interval = iMap->minsave_interval;
- iTimer->add_timer(iTimer->gettick()+interval,pc_autosave,0,0);
+ timer->add(timer->gettick()+interval,pc_autosave,0,0);
return 0;
}
@@ -9497,15 +9497,15 @@ int pc_add_charm(struct map_session_data *sd,int interval,int max,int type)
if( sd->charm[type] && sd->charm[type] >= max )
{
if(sd->charm_timer[type][0] != INVALID_TIMER)
- iTimer->delete_timer(sd->charm_timer[type][0],pc_charm_timer);
+ timer->delete(sd->charm_timer[type][0],pc_charm_timer);
sd->charm[type]--;
if( sd->charm[type] != 0 )
memmove(sd->charm_timer[type]+0, sd->charm_timer[type]+1, (sd->charm[type])*sizeof(int));
sd->charm_timer[type][sd->charm[type]] = INVALID_TIMER;
}
- tid = iTimer->add_timer(iTimer->gettick()+interval, pc_charm_timer, sd->bl.id, 0);
- ARR_FIND(0, sd->charm[type], i, sd->charm_timer[type][i] == INVALID_TIMER || DIFF_TICK(iTimer->get_timer(tid)->tick, iTimer->get_timer(sd->charm_timer[type][i])->tick) < 0);
+ tid = timer->add(timer->gettick()+interval, pc_charm_timer, sd->bl.id, 0);
+ ARR_FIND(0, sd->charm[type], i, sd->charm_timer[type][i] == INVALID_TIMER || DIFF_TICK(timer->get(tid)->tick, timer->get(sd->charm_timer[type][i])->tick) < 0);
if( i != sd->charm[type] )
memmove(sd->charm_timer[type]+i+1, sd->charm_timer[type]+i, (sd->charm[type]-i)*sizeof(int));
sd->charm_timer[type][i] = tid;
@@ -9536,7 +9536,7 @@ int pc_del_charm(struct map_session_data *sd,int count,int type)
for(i = 0; i < count; i++) {
if(sd->charm_timer[type][i] != INVALID_TIMER) {
- iTimer->delete_timer(sd->charm_timer[type][i],pc_charm_timer);
+ timer->delete(sd->charm_timer[type][i],pc_charm_timer);
sd->charm_timer[type][i] = INVALID_TIMER;
}
}
@@ -10143,7 +10143,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
return;
}
for(i = 0; i < MAX_ITEMDELAYS; i++) {
- if( cd->nameid[i] && DIFF_TICK(iTimer->gettick(),cd->tick[i]) < 0 ) {
+ if( cd->nameid[i] && DIFF_TICK(timer->gettick(),cd->tick[i]) < 0 ) {
sd->item_delay[cursor].tick = cd->tick[i];
sd->item_delay[cursor].nameid = cd->nameid[i];
cursor++;
@@ -10157,7 +10157,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
idb_put( itemcd_db, sd->status.char_id, cd );
}
for(i = 0; i < MAX_ITEMDELAYS; i++) {
- if( sd->item_delay[i].nameid && DIFF_TICK(iTimer->gettick(),sd->item_delay[i].tick) < 0 ) {
+ if( sd->item_delay[i].nameid && DIFF_TICK(timer->gettick(),sd->item_delay[i].tick) < 0 ) {
cd->tick[cursor] = sd->item_delay[i].tick;
cd->nameid[cursor] = sd->item_delay[i].nameid;
cursor++;
@@ -10186,17 +10186,17 @@ int do_init_pc(void) {
pc->readdb();
- iTimer->add_timer_func_list(pc_invincible_timer, "pc_invincible_timer");
- iTimer->add_timer_func_list(pc_eventtimer, "pc_eventtimer");
- iTimer->add_timer_func_list(pc_inventory_rental_end, "pc_inventory_rental_end");
- iTimer->add_timer_func_list(pc->calc_pvprank_timer, "pc->calc_pvprank_timer");
- iTimer->add_timer_func_list(pc_autosave, "pc_autosave");
- iTimer->add_timer_func_list(pc_spiritball_timer, "pc_spiritball_timer");
- iTimer->add_timer_func_list(pc_follow_timer, "pc_follow_timer");
- iTimer->add_timer_func_list(pc->endautobonus, "pc->endautobonus");
- iTimer->add_timer_func_list(pc_charm_timer, "pc_charm_timer");
+ timer->add_func_list(pc_invincible_timer, "pc_invincible_timer");
+ timer->add_func_list(pc_eventtimer, "pc_eventtimer");
+ timer->add_func_list(pc_inventory_rental_end, "pc_inventory_rental_end");
+ timer->add_func_list(pc->calc_pvprank_timer, "pc->calc_pvprank_timer");
+ timer->add_func_list(pc_autosave, "pc_autosave");
+ timer->add_func_list(pc_spiritball_timer, "pc_spiritball_timer");
+ timer->add_func_list(pc_follow_timer, "pc_follow_timer");
+ timer->add_func_list(pc->endautobonus, "pc->endautobonus");
+ timer->add_func_list(pc_charm_timer, "pc_charm_timer");
- iTimer->add_timer(iTimer->gettick() + iMap->autosave_interval, pc_autosave, 0, 0);
+ timer->add(timer->gettick() + iMap->autosave_interval, pc_autosave, 0, 0);
// 0=day, 1=night [Yor]
iMap->night_flag = battle_config.night_at_start ? 1 : 0;
@@ -10205,11 +10205,11 @@ int do_init_pc(void) {
int day_duration = battle_config.day_duration;
int night_duration = battle_config.night_duration;
// add night/day timer [Yor]
- iTimer->add_timer_func_list(pc->map_day_timer, "pc->map_day_timer");
- iTimer->add_timer_func_list(pc->map_night_timer, "pc->map_night_timer");
+ timer->add_func_list(pc->map_day_timer, "pc->map_day_timer");
+ timer->add_func_list(pc->map_night_timer, "pc->map_night_timer");
- pc->day_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, pc->map_day_timer, 0, 0, day_duration + night_duration);
- pc->night_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
+ pc->day_timer_tid = timer->add_interval(timer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, pc->map_day_timer, 0, 0, day_duration + night_duration);
+ pc->night_timer_tid = timer->add_interval(timer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), pc->map_night_timer, 0, 0, day_duration + night_duration);
}
do_init_pc_groups();