From d73783f22b2bb881aab74524d153d89a5932a199 Mon Sep 17 00:00:00 2001 From: Susu Date: Fri, 7 Jun 2013 20:03:32 +0200 Subject: Hercules Renewal Phase One : pc, party, map, timer Added iPc, iParty, iMap, iTimer to HPM exported interfaces --- src/map/clif.c | 488 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 244 insertions(+), 244 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 42043c004..39ffdd23d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -361,11 +361,11 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target clif->send (buf, len, bl, SELF); case AREA_WOC: case AREA_WOS: - map_foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, + iMap->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, BL_PC, buf, len, bl, type); break; case AREA_CHAT_WOC: - map_foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), + iMap->foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5), bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC); break; @@ -374,7 +374,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target { struct chat_data *cd; if (sd) { - cd = (struct chat_data*)map_id2bl(sd->chatID); + cd = (struct chat_data*)iMap->id2bl(sd->chatID); } else if (bl->type == BL_CHAT) { cd = (struct chat_data*)bl; } else break; @@ -403,7 +403,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target case PARTY_SAMEMAP: case PARTY_SAMEMAP_WOS: if (sd && sd->status.party_id) - p = party_search(sd->status.party_id); + p = iParty->search(sd->status.party_id); if (p) { for(i=0;ienable_spy) //Skip unnecessary parsing. [Skotlex] break; iter = mapit_getallusers(); @@ -503,7 +503,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target WFIFOSET(fd,len); } } - if (!enable_spy) //Skip unnecessary parsing. [Skotlex] + if (!iMap->enable_spy) //Skip unnecessary parsing. [Skotlex] break; iter = mapit_getallusers(); @@ -561,7 +561,7 @@ void clif_authok(struct map_session_data *sd) struct packet_authok p; p.PacketType = authokType; - p.startTime = gettick(); + p.startTime = iTimer->gettick(); WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); /* do the stupid client math */ p.xSize = p.ySize = 5; /* not-used */ @@ -645,7 +645,7 @@ void clif_charselectok(int id, uint8 ok) struct map_session_data* sd; int fd; - if ((sd = map_id2sd(id)) == NULL || !sd->fd) + if ((sd = iMap->id2sd(id)) == NULL || !sd->fd) return; fd = sd->fd; @@ -763,7 +763,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int t { struct block_list *tbl = ers_alloc(clif->delay_clearunit_ers, struct block_list); memcpy (tbl, bl, sizeof (struct block_list)); - add_timer(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl); + iTimer->add_timer(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl); } void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand) @@ -1176,7 +1176,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; - p.moveStartTime = gettick(); + p.moveStartTime = iTimer->gettick(); #if PACKETVER < 7 p.shield = vd->shield; #endif @@ -1554,7 +1554,7 @@ void clif_walkok(struct map_session_data *sd) WFIFOHEAD(fd, packet_len(0x87)); WFIFOW(fd,0)=0x87; - WFIFOL(fd,2)=gettick(); + WFIFOL(fd,2)=iTimer->gettick(); WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8); WFIFOSET(fd,packet_len(0x87)); } @@ -1625,7 +1625,7 @@ void clif_move(struct unit_data *ud) WBUFW(buf,0)=0x86; WBUFL(buf,2)=bl->id; WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8); - WBUFL(buf,12)=gettick(); + WBUFL(buf,12)=iTimer->gettick(); clif->send(buf, packet_len(0x86), bl, AREA_WOS); if (disguised(bl)) { WBUFL(buf,2)=-bl->id; @@ -1635,14 +1635,14 @@ void clif_move(struct unit_data *ud) /*========================================== - * Delays the map_quit of a player after they are disconnected. [Skotlex] + * Delays the iMap->quit of a player after they are disconnected. [Skotlex] *------------------------------------------*/ int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data *sd = NULL; //Remove player from map server - if ((sd = map_id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player. - map_quit(sd); + if ((sd = iMap->id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player. + iMap->quit(sd); return 0; } @@ -1651,14 +1651,14 @@ int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) { *------------------------------------------*/ void clif_quitsave(int fd,struct map_session_data *sd) { if (!battle_config.prevent_logout || - DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) - map_quit(sd); + DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) + iMap->quit(sd); else if (sd->fd) { //Disassociate session from player (session is deleted after this function was called) //And set a timer to make him quit later. session[sd->fd]->session_data = NULL; sd->fd = 0; - add_timer(gettick() + 10000, clif->delayquit, sd->bl.id, 0); + iTimer->add_timer(iTimer->gettick() + 10000, clif->delayquit, sd->bl.id, 0); } } @@ -1763,7 +1763,7 @@ void clif_buylist(struct map_session_data *sd, struct npc_data *nd) if( id == NULL ) continue; WFIFOL(fd, 4+c*11) = val; - WFIFOL(fd, 8+c*11) = pc_modifybuyvalue(sd,val); + WFIFOL(fd, 8+c*11) = iPc->modifybuyvalue(sd,val); WFIFOB(fd,12+c*11) = itemtype(id->type); WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid; c++; @@ -1806,7 +1806,7 @@ void clif_selllist(struct map_session_data *sd) { if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) { - if( !itemdb_cansell(&sd->status.inventory[i], pc_get_group_level(sd)) ) + if( !itemdb_cansell(&sd->status.inventory[i], iPc->get_group_level(sd)) ) continue; if( sd->status.inventory[i].expire_time ) @@ -1817,7 +1817,7 @@ void clif_selllist(struct map_session_data *sd) continue; WFIFOW(fd,4+c*10)=i+2; WFIFOL(fd,6+c*10)=val; - WFIFOL(fd,10+c*10)=pc_modifysellvalue(sd,val); + WFIFOL(fd,10+c*10)=iPc->modifysellvalue(sd,val); c++; } } @@ -1952,7 +1952,7 @@ void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) int slen = strlen(mes) + 9; struct block_list *bl = NULL; - if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m || bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -1984,7 +1984,7 @@ void clif_scriptinput(struct map_session_data *sd, int npcid) nullpo_retv(sd); - if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m || bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -2015,7 +2015,7 @@ void clif_scriptinputstr(struct map_session_data *sd, int npcid) nullpo_retv(sd); - if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m || bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -2233,7 +2233,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { p.IsDamaged = sd->status.inventory[n].attribute; p.refiningLevel =sd->status.inventory[n].refine; clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); - p.location = pc_equippoint(sd,n); + p.location = iPc->equippoint(sd,n); p.type = itemtype(sd->inventory_data[n]->type); #if PACKETVER >= 20061218 p.HireExpireDate = sd->status.inventory[n].expire_time; @@ -2353,7 +2353,7 @@ void clif_inventorylist(struct map_session_data *sd) { if( !itemdb_isstackable2(sd->inventory_data[i]) ) { //Non-stackable (Equippable) WBUFW(bufe,ne*se+4)=i+2; - clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); + clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i)); clif->addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]); #if PACKETVER >= 20071002 WBUFL(bufe,ne*se+24)=sd->status.inventory[i].expire_time; @@ -2443,7 +2443,7 @@ void clif_equiplist(struct map_session_data *sd) continue; //Equippable WBUFW(buf,n*cmd+4)=i+2; - clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i)); + clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i)); clif->addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]); #if PACKETVER >= 20071002 WBUFL(buf,n*cmd+24)=sd->status.inventory[i].expire_time; @@ -2950,7 +2950,7 @@ int clif_hpmeter_sub(struct block_list *bl, va_list ap) { *------------------------------------------*/ int clif_hpmeter(struct map_session_data *sd) { nullpo_ret(sd); - map_foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd); + iMap->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd); return 0; } @@ -2980,9 +2980,9 @@ void clif_updatestatus(struct map_session_data *sd,int type) switch(type){ // 00b0 case SP_WEIGHT: - pc_updateweightstatus(sd); + iPc->updateweightstatus(sd); WFIFOHEAD(fd,14); - WFIFOW(fd,0)=0xb0; //Need to re-set as pc_updateweightstatus can alter the buffer. [Skotlex] + WFIFOW(fd,0)=0xb0; //Need to re-set as iPc->updateweightstatus can alter the buffer. [Skotlex] WFIFOW(fd,2)=type; WFIFOL(fd,4)=sd->weight; break; @@ -3092,11 +3092,11 @@ void clif_updatestatus(struct map_session_data *sd,int type) break; case SP_NEXTBASEEXP: WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc_nextbaseexp(sd); + WFIFOL(fd,4)=iPc->nextbaseexp(sd); break; case SP_NEXTJOBEXP: WFIFOW(fd,0)=0xb1; - WFIFOL(fd,4)=pc_nextjobexp(sd); + WFIFOL(fd,4)=iPc->nextjobexp(sd); break; /** @@ -3109,7 +3109,7 @@ void clif_updatestatus(struct map_session_data *sd,int type) case SP_UDEX: case SP_ULUK: WFIFOW(fd,0)=0xbe; - WFIFOB(fd,4)=pc_need_status_point(sd,type-SP_USTR+SP_STR,1); + WFIFOB(fd,4)=iPc->need_status_point(sd,type-SP_USTR+SP_STR,1); len=5; break; @@ -3406,17 +3406,17 @@ void clif_initialstatus(struct map_session_data *sd) { WBUFW(buf,0)=0xbd; WBUFW(buf,2)=min(sd->status.status_point, INT16_MAX); WBUFB(buf,4)=min(sd->status.str, UINT8_MAX); - WBUFB(buf,5)=pc_need_status_point(sd,SP_STR,1); + WBUFB(buf,5)=iPc->need_status_point(sd,SP_STR,1); WBUFB(buf,6)=min(sd->status.agi, UINT8_MAX); - WBUFB(buf,7)=pc_need_status_point(sd,SP_AGI,1); + WBUFB(buf,7)=iPc->need_status_point(sd,SP_AGI,1); WBUFB(buf,8)=min(sd->status.vit, UINT8_MAX); - WBUFB(buf,9)=pc_need_status_point(sd,SP_VIT,1); + WBUFB(buf,9)=iPc->need_status_point(sd,SP_VIT,1); WBUFB(buf,10)=min(sd->status.int_, UINT8_MAX); - WBUFB(buf,11)=pc_need_status_point(sd,SP_INT,1); + WBUFB(buf,11)=iPc->need_status_point(sd,SP_INT,1); WBUFB(buf,12)=min(sd->status.dex, UINT8_MAX); - WBUFB(buf,13)=pc_need_status_point(sd,SP_DEX,1); + WBUFB(buf,13)=iPc->need_status_point(sd,SP_DEX,1); WBUFB(buf,14)=min(sd->status.luk, UINT8_MAX); - WBUFB(buf,15)=pc_need_status_point(sd,SP_LUK,1); + WBUFB(buf,15)=iPc->need_status_point(sd,SP_LUK,1); WBUFW(buf,16) = pc_leftside_atk(sd); WBUFW(buf,18) = pc_rightside_atk(sd); @@ -3508,7 +3508,7 @@ void clif_arrow_create_list(struct map_session_data *sd) for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) { if (skill_arrow_db[i].nameid > 0 && - (j = pc_search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 && + (j = iPc->search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 && !sd->status.inventory[j].equip && sd->status.inventory[j].identify) { if ((j = itemdb_viewid(skill_arrow_db[i].nameid)) > 0) @@ -3748,7 +3748,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok) } void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) { - if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) { + if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), iTimer->gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) { clif->colormes(sd->fd,COLOR_RED,msg_txt(1455)); return; } else { @@ -3758,7 +3758,7 @@ void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data if( channel->type == hChSys_IRC ) ircbot->relay(sd->status.name,msg); if( channel->msg_delay != 0 ) - sd->hchsysch_tick = gettick(); + sd->hchsysch_tick = iTimer->gettick(); } } @@ -4011,7 +4011,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name) safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); WFIFOSET(fd,packet_len(0xe5)); #else - struct map_session_data* tsd = map_id2sd(sd->trade_partner); + struct map_session_data* tsd = iMap->id2sd(sd->trade_partner); if( !tsd ) return; WFIFOHEAD(fd,packet_len(0x1f4)); @@ -4037,7 +4037,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name) void clif_tradestart(struct map_session_data* sd, uint8 type) { int fd = sd->fd; - struct map_session_data* tsd = map_id2sd(sd->trade_partner); + struct map_session_data* tsd = iMap->id2sd(sd->trade_partner); if( PACKETVER < 6 || !tsd ) { WFIFOHEAD(fd,packet_len(0xe7)); WFIFOW(fd,0) = 0xe7; @@ -4299,7 +4299,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds if( dstsd->chatID ) { struct chat_data *cd = NULL; - if( (cd = (struct chat_data*)map_id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd) + if( (cd = (struct chat_data*)iMap->id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd) clif->dispchat(cd,sd->fd); } else if( dstsd->state.vending ) clif->showvendingboard(&dstsd->bl,dstsd->message,sd->fd); @@ -4328,7 +4328,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds ARR_FIND( 0, 5, i, dstsd->devotion[i] > 0 ); if( i < 5 ) clif->devotion(&dstsd->bl, sd); // display link (dstsd - crusader) to sd - if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map_id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL ) + if( dstsd->sc.data[SC_DEVOTION] && (d_bl = iMap->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL ) clif->devotion(d_bl, sd); } @@ -4376,7 +4376,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { { TBL_NPC* nd = (TBL_NPC*)bl; if( nd->chat_id ) - clif->dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd); + clif->dispchat((struct chat_data*)iMap->id2bl(nd->chat_id),sd->fd); if( nd->size == SZ_BIG ) clif->specialeffect_single(bl,423,sd->fd); else if( nd->size == SZ_MEDIUM ) @@ -4779,7 +4779,7 @@ int clif_outsight(struct block_list *bl,va_list ap) clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd); if(sd->chatID){ struct chat_data *cd; - cd=(struct chat_data*)map_id2bl(sd->chatID); + cd=(struct chat_data*)iMap->id2bl(sd->chatID); if(cd->usersd[0]==sd) clif->dispchat(cd,tsd->fd); } @@ -5932,7 +5932,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len) WFIFOW(fd,2) = mes_len + NAME_LENGTH + 8; safestrncpy((char*)WFIFOP(fd,4), nick, NAME_LENGTH); WFIFOL(fd,28) = 0; // isAdmin; if nonzero, also displays text above char - // TODO: WFIFOL(fd,28) = pc_get_group_level(ssd); + // TODO: WFIFOL(fd,28) = iPc->get_group_level(ssd); safestrncpy((char*)WFIFOP(fd,32), mes, mes_len); WFIFOSET(fd,WFIFOW(fd,2)); #endif @@ -6167,14 +6167,14 @@ void clif_item_refine_list(struct map_session_data *sd) nullpo_retv(sd); - skill_lv = pc_checkskill(sd,WS_WEAPONREFINE); + skill_lv = iPc->checkskill(sd,WS_WEAPONREFINE); fd=sd->fd; refine_item[0] = -1; - refine_item[1] = pc_search_inventory(sd,1010); - refine_item[2] = pc_search_inventory(sd,1011); - refine_item[3] = refine_item[4] = pc_search_inventory(sd,984); + refine_item[1] = iPc->search_inventory(sd,1010); + refine_item[2] = iPc->search_inventory(sd,1011); + refine_item[3] = refine_item[4] = iPc->search_inventory(sd,984); WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4); WFIFOW(fd,0)=0x221; @@ -6366,7 +6366,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven nullpo_retv(sd); nullpo_retv(vending); - nullpo_retv(vsd=map_id2sd(id)); + nullpo_retv(vsd=iMap->id2sd(id)); fd = sd->fd; count = vsd->vend_num; @@ -6610,7 +6610,7 @@ void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd) fd=tsd->fd; - if( (p=party_search(sd->status.party_id))==NULL ) + if( (p=iParty->search(sd->status.party_id))==NULL ) return; WFIFOHEAD(fd,packet_len(cmd)); @@ -7086,31 +7086,31 @@ void clif_autospell(struct map_session_data *sd,uint16 skill_lv) WFIFOHEAD(fd,packet_len(0x1cd)); WFIFOW(fd, 0)=0x1cd; - if(skill_lv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0) + if(skill_lv>0 && iPc->checkskill(sd,MG_NAPALMBEAT)>0) WFIFOL(fd,2)= MG_NAPALMBEAT; else WFIFOL(fd,2)= 0x00000000; - if(skill_lv>1 && pc_checkskill(sd,MG_COLDBOLT)>0) + if(skill_lv>1 && iPc->checkskill(sd,MG_COLDBOLT)>0) WFIFOL(fd,6)= MG_COLDBOLT; else WFIFOL(fd,6)= 0x00000000; - if(skill_lv>1 && pc_checkskill(sd,MG_FIREBOLT)>0) + if(skill_lv>1 && iPc->checkskill(sd,MG_FIREBOLT)>0) WFIFOL(fd,10)= MG_FIREBOLT; else WFIFOL(fd,10)= 0x00000000; - if(skill_lv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0) + if(skill_lv>1 && iPc->checkskill(sd,MG_LIGHTNINGBOLT)>0) WFIFOL(fd,14)= MG_LIGHTNINGBOLT; else WFIFOL(fd,14)= 0x00000000; - if(skill_lv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0) + if(skill_lv>4 && iPc->checkskill(sd,MG_SOULSTRIKE)>0) WFIFOL(fd,18)= MG_SOULSTRIKE; else WFIFOL(fd,18)= 0x00000000; - if(skill_lv>7 && pc_checkskill(sd,MG_FIREBALL)>0) + if(skill_lv>7 && iPc->checkskill(sd,MG_FIREBALL)>0) WFIFOL(fd,22)= MG_FIREBALL; else WFIFOL(fd,22)= 0x00000000; - if(skill_lv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0) + if(skill_lv>9 && iPc->checkskill(sd,MG_FROSTDIVER)>0) WFIFOL(fd,26)= MG_FROSTDIVER; else WFIFOL(fd,26)= 0x00000000; @@ -7149,7 +7149,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) for( i = 0; i < 5; i++ ) WBUFL(buf,6+4*i) = sd->devotion[i]; - WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc_checkskill(sd, CR_DEVOTION)); + WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, iPc->checkskill(sd, CR_DEVOTION)); } if( tsd ) @@ -8083,7 +8083,7 @@ void clif_callpartner(struct map_session_data *sd) if( sd->status.partner_id ) { const char *p; - if( ( p = map_charid2nick(sd->status.partner_id) ) != NULL ) + if( ( p = iMap->charid2nick(sd->status.partner_id) ) != NULL ) { memcpy(WBUFP(buf,2), p, NAME_LENGTH); } @@ -8206,7 +8206,7 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd) if( fd > 0 ) clif->authfail_fd(fd, 15); else - map_quit(tsd); + iMap->quit(tsd); if( sd ) clif->GM_kickack(sd,tsd->status.account_id); @@ -8511,7 +8511,7 @@ void clif_refresh(struct map_session_data *sd) } if( sd->ed ) clif->elemental_info(sd); - map_foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd); + iMap->foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd); clif->weather_check(sd); if( sd->chatID ) chat_leavechat(sd,0); @@ -8531,8 +8531,8 @@ void clif_refresh(struct map_session_data *sd) if( disguised(&sd->bl) ) {/* refresh-da */ short disguise = sd->disguise; - pc_disguise(sd, -1); - pc_disguise(sd, disguise); + iPc->disguise(sd, -1); + iPc->disguise(sd, disguise); } } @@ -8571,7 +8571,7 @@ void clif_charnameack (int fd, struct block_list *bl) memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); if( ssd->status.party_id ) { - p = party_search(ssd->status.party_id); + p = iParty->search(ssd->status.party_id); } if( ssd->status.guild_id ) { if( ( g = ssd->guild ) != NULL ) { @@ -8695,10 +8695,10 @@ void clif_charnameupdate (struct map_session_data *ssd) if (!battle_config.display_party_name) { if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != NULL) - p = party_search(ssd->status.party_id); + p = iParty->search(ssd->status.party_id); }else{ if (ssd->status.party_id > 0) - p = party_search(ssd->status.party_id); + p = iParty->search(ssd->status.party_id); } if( ssd->status.guild_id > 0 && (g = ssd->guild) != NULL ) @@ -8884,7 +8884,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type) { if( pcdb_checkid(class_) ) { - clif->starskill(sd, job_name(class_), class_, hate_level, type ? 10 : 11); + clif->starskill(sd, iPc->job_name(class_), class_, hate_level, type ? 10 : 11); } else if( mobdb_checkid(class_) ) { clif->starskill(sd, mob_db(class_)->jname, class_, hate_level, type ? 10 : 11); } else { @@ -8999,7 +8999,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts // Inventory position WBUFW(buf, n*s+43) = i + 2; // Add refine, identify flag, element, etc. - clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i)); + clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], iPc->equippoint(tsd, i)); // Add cards clif->addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]); // Expiration date stuff, if all of those are set to 0 then the client doesn't show anything related (6 bytes) @@ -9248,7 +9248,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { } //Check for double login. - bl = map_id2bl(account_id); + bl = iMap->id2bl(account_id); if(bl && bl->type != BL_PC) { ShowError("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n", account_id); WFIFOHEAD(fd,packet_len(0x6a)); @@ -9271,7 +9271,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { sd->fd = fd; session[fd]->session_data = sd; - pc_setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); + iPc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd); #if PACKETVER < 20070521 WFIFOHEAD(fd,4); @@ -9317,7 +9317,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) return; if (!sd->state.active) { //Character loading is not complete yet! - //Let pc_reg_received reinvoke this when ready. + //Let iPc->reg_received reinvoke this when ready. sd->state.connect_new = 0; return; } @@ -9342,8 +9342,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(sd->vd.cloth_color) clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); // item - clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc_checkitem show up as 'unknown item' - pc_checkitem(sd); + clif->inventorylist(sd); // inventory list first, otherwise deleted items in iPc->checkitem show up as 'unknown item' + iPc->checkitem(sd); // cart if(pc_iscarton(sd)) { @@ -9361,11 +9361,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) guild->send_memberinfoshort(sd,1); if(battle_config.pc_invincible_time > 0) { - pc_setinvincibletimer(sd,battle_config.pc_invincible_time); + iPc->setinvincibletimer(sd,battle_config.pc_invincible_time); } if( map[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs ) - map_spawnmobs(sd->bl.m); + iMap->spawnmobs(sd->bl.m); if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map map[sd->bl.m].users_pvp++; } @@ -9378,13 +9378,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // reset the callshop flag if the player changes map sd->state.callshop = 0; - map_addblock(&sd->bl); + iMap->addblock(&sd->bl); clif->spawn(&sd->bl); // Party // (needs to go after clif_spawn() to show hp bars correctly) if(sd->status.party_id) { - party_send_movemap(sd); + iParty->send_movemap(sd); clif->party_hp(sd); // Show hp after displacement [LuzZza] } @@ -9393,7 +9393,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(map[sd->bl.m].flag.pvp && !(sd->sc.option&OPTION_INVISIBLE)) { if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] if (!map[sd->bl.m].flag.pvp_nocalcrank) - sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200, iPc->calc_pvprank_timer, sd->bl.id, 0); sd->pvp_rank = 0; sd->pvp_lastusers = 0; sd->pvp_point = 5; @@ -9413,7 +9413,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->map_property(sd, MAPPROPERTY_AGITZONE); // info about nearby objects // must use foreachinarea (CIRCULAR_AREA interferes with foreachinrange) - map_foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd); + iMap->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd); // pet if( sd->pd ) { @@ -9421,7 +9421,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->message(sd->fd, msg_txt(666)); pet_menu(sd, 3); //Option 3 is return to egg. } else { - map_addblock(&sd->pd->bl); + iMap->addblock(&sd->pd->bl); clif->spawn(&sd->pd->bl); clif->send_petdata(sd,sd->pd,0,0); clif->send_petstatus(sd); @@ -9431,7 +9431,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) //homunculus [blackhole89] if( homun_alive(sd->hd) ) { - map_addblock(&sd->hd->bl); + iMap->addblock(&sd->hd->bl); clif->spawn(&sd->hd->bl); clif->send_homdata(sd,SP_ACK,0); clif->hominfo(sd,sd->hd,1); @@ -9440,11 +9440,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if( battle_config.hom_setting&0x8 ) status_calc_bl(&sd->hd->bl, SCB_SPEED); //Homunc mimic their master's speed on each map change if( !(battle_config.hom_setting&0x2) ) - skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately + skill->unit_move(&sd->hd->bl,iTimer->gettick(),1); // apply land skills immediately } if( sd->md ) { - map_addblock(&sd->md->bl); + iMap->addblock(&sd->md->bl); clif->spawn(&sd->md->bl); clif->mercenary_info(sd); clif->mercenary_skillblock(sd); @@ -9452,7 +9452,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) } if( sd->ed ) { - map_addblock(&sd->ed->bl); + iMap->addblock(&sd->ed->bl); clif->spawn(&sd->ed->bl); clif->elemental_info(sd); clif->elemental_updatestatus(sd,SP_HP); @@ -9484,7 +9484,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) sc_start(&sd->bl,SC_NOCHAT,100,0,0); //Auron reported that This skill only triggers when you logon on the map o.O [Skotlex] - if ((lv = pc_checkskill(sd,SG_KNOWLEDGE)) > 0) { + if ((lv = iPc->checkskill(sd,SG_KNOWLEDGE)) > 0) { if(sd->bl.m == sd->feel_map[0].m || sd->bl.m == sd->feel_map[1].m || sd->bl.m == sd->feel_map[2].m) @@ -9497,13 +9497,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(homun_alive(sd->hd)) homun->init_timers(sd->hd); - if (night_flag && map[sd->bl.m].flag.nightenabled) { + if (iMap->night_flag && map[sd->bl.m].flag.nightenabled) { sd->state.night = 1; clif->status_change(&sd->bl, SI_NIGHT, 1, 0, 0, 0, 0); } // Notify everyone that this char logged in [Skotlex]. - map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); + iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); //Login Event npc_script_event(sd, NPCE_LOGIN); @@ -9534,7 +9534,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) (map_flag_gvg(sd->state.pmap) || map_flag_gvg(sd->bl.m) || map[sd->state.pmap].flag.battleground || map[sd->bl.m].flag.battleground) ) status_calc_bl(&sd->bl, SCB_FLEE); //Refresh flee penalty - if( night_flag && map[sd->bl.m].flag.nightenabled ) { //Display night. + if( iMap->night_flag && map[sd->bl.m].flag.nightenabled ) { //Display night. if( !sd->state.night ) { sd->state.night = 1; clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_NIGHT); @@ -9556,7 +9556,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF); } - map_iwall_get(sd); // Updates Walls Info on this Map to Client + iMap->iwall_get(sd); // Updates Walls Info on this Map to Client status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */ sd->state.changemap = false; @@ -9585,7 +9585,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(map[sd->bl.m].flag.loadevent) // Lance npc_script_event(sd, NPCE_LOADMAP); - if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd)) //blindness [Komurka] + if (iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd)) //blindness [Komurka] clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL); if (sd->sc.opt2) //Client loses these on warp. @@ -9594,7 +9594,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif->weather_check(sd); // For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first) - if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) + if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); else sd->areanpc_id = 0; @@ -9613,7 +9613,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // Trigger skill effects if you appear standing on them if(!battle_config.pc_invincible_time) - skill->unit_move(&sd->bl,gettick(),1); + skill->unit_move(&sd->bl,iTimer->gettick(),1); } @@ -9637,7 +9637,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - clif->notify_time(sd, gettick()); + clif->notify_time(sd, iTimer->gettick()); } @@ -9717,7 +9717,7 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd) { int npc_id = sd->progressbar.npc_id; - if( gettick() < sd->progressbar.timeout && sd->st ) + if( iTimer->gettick() < sd->progressbar.timeout && sd->st ) sd->st->state = END; sd->progressbar.npc_id = sd->progressbar.timeout = 0; @@ -9748,7 +9748,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH]) return; - pc_delinvincibletimer(sd); + iPc->delinvincibletimer(sd); RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, NULL); @@ -9784,7 +9784,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) { /* Rovert's prevent logout option fixed [Valaris] */ if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && - (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) + (!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { set_eof(fd); clif->disconnect_ack(sd, 0); @@ -9807,7 +9807,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) if( id < 0 && -id == sd->bl.id ) // for disguises [Valaris] id = sd->bl.id; - bl = map_id2bl(id); + bl = iMap->id2bl(id); if( bl == NULL ) return; // Lagged clients could request names of already gone mobs/players. [Skotlex] @@ -9819,13 +9819,13 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) sc = status_get_sc(bl); if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl) && bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple - pc_get_group_level(sd) < battle_config.hack_info_GM_level + iPc->get_group_level(sd) < battle_config.hack_info_GM_level ) { char gm_msg[256]; sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id); ShowWarning(gm_msg); // information is sent to all online GMs - intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg); + intif_wis_message_to_gm(iMap->wisp_server_name, battle_config.hack_info_GM_level, gm_msg); return; } */ @@ -9834,10 +9834,10 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) } int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) { struct map_session_data * sd; - if( (sd = map_id2sd(id)) ) { + if( (sd = iMap->id2sd(id)) ) { sd->fontcolor_tid = INVALID_TIMER; if( sd->fontcolor && sd->disguise == sd->status.class_ ) - pc_disguise(sd,-1); + iPc->disguise(sd,-1); } return 0; } @@ -9866,9 +9866,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) return; if( battle_config.min_chat_delay ) { //[Skotlex] - if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) + if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0) return; - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; + sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay; } if( sd->gcbind ) { @@ -9879,16 +9879,16 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) unsigned char mylen = 1; if( sd->disguise == -1 ) { - sd->fontcolor_tid = add_timer(gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); - pc_disguise(sd,sd->status.class_); + sd->fontcolor_tid = iTimer->add_timer(iTimer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); + iPc->disguise(sd,sd->status.class_); if( pc_isdead(sd) ) clif_clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); if( unit_is_walking(&sd->bl) ) clif->move(&sd->ud); } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER ) { const struct TimerData *timer; - if( (timer = get_timer(sd->fontcolor_tid)) ) { - settick_timer(sd->fontcolor_tid, timer->tick+5000); + if( (timer = iTimer->get_timer(sd->fontcolor_tid)) ) { + iTimer->settick_timer(sd->fontcolor_tid, timer->tick+5000); } } @@ -9938,7 +9938,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) WFIFOSET(fd, WFIFOW(fd,2)); #ifdef PCRE_SUPPORT // trigger listening npcs - map_foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl); + iMap->foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl); #endif // Chat logging type 'O' / Global Chat @@ -10019,7 +10019,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd) { int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) { + if (battle_config.basic_skill_check == 0 || iPc->checkskill(sd, NV_BASIC) >= 2) { if (emoticon == E_MUTE) {// prevent use of the mute emote [Valaris] clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1); return; @@ -10059,7 +10059,7 @@ void clif_user_count(struct map_session_data* sd, int count) { /// 00c1 void clif_parse_HowManyConnections(int fd, struct map_session_data *sd) { - clif->user_count(sd, map_getusers()); + clif->user_count(sd, iMap->getusers()); } @@ -10098,19 +10098,19 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] ) return; - if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) { + if (!battle_config.sdelay_attack_enable && iPc->checkskill(sd, SA_FREECAST) <= 0) { if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) { clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0); return; } } - pc_delinvincibletimer(sd); + iPc->delinvincibletimer(sd); sd->idletime = last_tick; unit_attack(&sd->bl, target_id, action_type != 0); break; case 0x02: // sitdown - if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3) { + if (battle_config.basic_skill_check && iPc->checkskill(sd, NV_BASIC) < 3) { clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2); break; } @@ -10140,7 +10140,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, clif->standing(&sd->bl); return; } - pc_setstand(sd); + iPc->setstand(sd); skill->sit(sd,0); clif->standing(&sd->bl); break; @@ -10275,7 +10275,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) clif->pActionRequest_sub(sd, RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]), RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), - gettick() + iTimer->gettick() ); } @@ -10288,12 +10288,12 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) void clif_parse_Restart(int fd, struct map_session_data *sd) { switch(RFIFOB(fd,2)) { case 0x00: - pc_respawn(sd,CLR_RESPAWN); + iPc->respawn(sd,CLR_RESPAWN); break; case 0x01: /* Rovert's Prevent logout option - Fixed [Valaris] */ if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && - (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) + (!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { //Send to char-server for character selection. chrif_charselectreq(sd, session[fd]->client_addr); } else { @@ -10325,10 +10325,10 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) return; if (battle_config.min_chat_delay) { //[Skotlex] - if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) { + if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0) { return; } - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; + sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay; } // Chat logging type 'W' / Whisper @@ -10417,7 +10417,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) } // searching destination character - dstsd = map_nick2sd(target); + dstsd = iMap->nick2sd(target); if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) { // player is not on this map-server @@ -10431,7 +10431,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) // if player ignores everyone if (dstsd->state.ignoreAll) { - if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd)) + if (dstsd->sc.option & OPTION_INVISIBLE && iPc->get_group_level(sd) < iPc->get_group_level(dstsd)) clif->wis_end(fd, 1); // 1: target character is not loged in else clif->wis_end(fd, 3); // 3: everyone ignored by target @@ -10442,7 +10442,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) if( dstsd->state.autotrade == 1 ) { char output[256]; sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name); - clif->wis_message(fd, wisp_server_name, output, strlen(output) + 1); + clif->wis_message(fd, iMap->wisp_server_name, output, strlen(output) + 1); return; } @@ -10488,7 +10488,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - fitem = (struct flooritem_data*)map_id2bl(map_object_id); + fitem = (struct flooritem_data*)iMap->id2bl(map_object_id); do { if (pc_isdead(sd)) { @@ -10512,7 +10512,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) if (pc_cant_act(sd)) break; - if (!pc_takeitem(sd, fitem)) + if (!iPc->takeitem(sd, fitem)) break; return; @@ -10545,7 +10545,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) )) break; - if (!pc_dropitem(sd, item_index, item_amount)) + if (!iPc->dropitem(sd, item_index, item_amount)) break; return; @@ -10578,7 +10578,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) if(n <0 || n >= MAX_INVENTORY) return; - if (!pc_useitem(sd,n)) + if (!iPc->useitem(sd,n)) clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck. } @@ -10620,9 +10620,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) //Client doesn't send the position for ammo. if(sd->inventory_data[index]->type == IT_AMMO) - pc_equipitem(sd,index,EQP_AMMO); + iPc->equipitem(sd,index,EQP_AMMO); else - pc_equipitem(sd,index,RFIFOW(fd,4)); + iPc->equipitem(sd,index,RFIFOW(fd,4)); } void clif_hercules_chsys_delete(struct hChSysCh *channel) { @@ -10735,7 +10735,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd) index = RFIFOW(fd,2)-2; - pc_unequipitem(sd,index,1); + iPc->unequipitem(sd,index,1); } @@ -10755,12 +10755,12 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) if ( pc_cant_act2(sd) ) return; - bl = map_id2bl(RFIFOL(fd,2)); + bl = iMap->id2bl(RFIFOL(fd,2)); if (!bl) return; switch (bl->type) { case BL_MOB: case BL_PC: - clif->pActionRequest_sub(sd, 0x07, bl->id, gettick()); + clif->pActionRequest_sub(sd, 0x07, bl->id, iTimer->gettick()); break; case BL_NPC: if( bl->m != -1 )// the user can't click floating npcs directly (hack attempt) @@ -10872,7 +10872,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd) if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) return; - if(battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4) { + if(battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 4) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3); return; } @@ -10979,7 +10979,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { struct map_session_data *t_sd; - t_sd = map_id2sd(RFIFOL(fd,2)); + t_sd = iMap->id2sd(RFIFOL(fd,2)); if(!sd->chatID && pc_cant_act(sd)) return; //You can trade while in a chatroom. @@ -10990,7 +10990,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 1) { + if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 1) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,0); return; } @@ -11064,7 +11064,7 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd) return; if (!pc_iscarton(sd)) return; - pc_putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); + iPc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); } @@ -11074,7 +11074,7 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) { if (!pc_iscarton(sd)) return; - pc_getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); + iPc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4)); } @@ -11086,11 +11086,11 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd) * Attempts to remove these options when this function is called (will remove all available) **/ #ifdef NEW_CARTS - pc_setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + iPc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); if( sd->sc.data[SC_PUSH_CART] ) - pc_setcart(sd,0); + iPc->setcart(sd,0); #else - pc_setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); + iPc->setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); #endif } @@ -11101,7 +11101,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) {// TODO: State tracking? int type; - if( sd && pc_checkskill(sd, MC_CHANGECART) < 1 ) + if( sd && iPc->checkskill(sd, MC_CHANGECART) < 1 ) return; type = (int)RFIFOW(fd,2); @@ -11122,7 +11122,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) (type == 2 && sd->status.base_level > 40) || (type == 1)) #endif - pc_setcart(sd,type); + iPc->setcart(sd,type); } @@ -11135,7 +11135,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) /// the like void clif_parse_StatusUp(int fd,struct map_session_data *sd) { - pc_statusup(sd,RFIFOW(fd,2)); + iPc->statusup(sd,RFIFOW(fd,2)); } @@ -11143,7 +11143,7 @@ void clif_parse_StatusUp(int fd,struct map_session_data *sd) /// 0112 .W void clif_parse_SkillUp(int fd,struct map_session_data *sd) { - pc_skillup(sd,RFIFOW(fd,2)); + iPc->skillup(sd,RFIFOW(fd,2)); } void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id) @@ -11243,7 +11243,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { uint16 skill_id, skill_lv; int tmp, target_id; - unsigned int tick = gettick(); + unsigned int tick = iTimer->gettick(); skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); @@ -11314,7 +11314,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( skill_lv != sd->skillitemlv ) skill_lv = sd->skillitemlv; if( !(tmp&INF_SELF_SKILL) ) - pc_delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish] + iPc->delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish] unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv); return; } @@ -11327,12 +11327,12 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) else skill_lv = 0; } else { - tmp = pc_checkskill(sd, skill_id); + tmp = iPc->checkskill(sd, skill_id); if( skill_lv > tmp ) skill_lv = tmp; } - pc_delinvincibletimer(sd); + iPc->delinvincibletimer(sd); if( skill_lv ) unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv); @@ -11343,7 +11343,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) *------------------------------------------*/ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo) { - unsigned int tick = gettick(); + unsigned int tick = iTimer->gettick(); if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) ) return; //Using a target skill on the ground? WRONG. @@ -11395,7 +11395,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski return; //Can't use skills while a menu is open. } - pc_delinvincibletimer(sd); + iPc->delinvincibletimer(sd); if( sd->skillitem == skill_id ) { if( skill_lv != sd->skillitemlv ) @@ -11404,7 +11404,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski } else { int lv; sd->skillitem = sd->skillitemlv = 0; - if( (lv = pc_checkskill(sd, skill_id)) > 0 ) { + if( (lv = iPc->checkskill(sd, skill_id)) > 0 ) { if( skill_lv > lv ) skill_lv = lv; unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv); @@ -11471,7 +11471,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) return; } - pc_delinvincibletimer(sd); + iPc->delinvincibletimer(sd); skill->castend_map(sd,skill_id,map_name); } @@ -11481,7 +11481,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) void clif_parse_RequestMemo(int fd,struct map_session_data *sd) { if (!pc_isdead(sd)) - pc_memo(sd,-1); + iPc->memo(sd,-1); } @@ -11591,7 +11591,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd) #ifdef SECURE_NPCTIMEOUT if( sd->npc_idle_timer != INVALID_TIMER ) { #endif - TBL_NPC* nd = map_id2nd(npc_id); + TBL_NPC* nd = iMap->id2nd(npc_id); ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name); clif->GM_kick(NULL,sd); #ifdef SECURE_NPCTIMEOUT @@ -11729,7 +11729,7 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd) { if (sd->state.trading != 0) return; - pc_insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); + iPc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2); } @@ -11742,7 +11742,7 @@ void clif_parse_SolveCharName(int fd, struct map_session_data *sd) int charid; charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - map_reqnickdb(sd, charid); + iMap->reqnickdb(sd, charid); } @@ -11933,12 +11933,12 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd) clif->message(fd, msg_txt(227)); return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) { + if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } - party_create(sd,name,0,0); + iParty->create(sd,name,0,0); } void clif_parse_CreateParty2(int fd, struct map_session_data *sd) @@ -11952,12 +11952,12 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) clif->message(fd, msg_txt(227)); return; } - if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) { + if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) { clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4); return; } - party_create(sd,name,item1,item2); + iParty->create(sd,name,item1,item2); } @@ -11973,14 +11973,14 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) return; } - t_sd = map_id2sd(RFIFOL(fd,2)); + t_sd = iMap->id2sd(RFIFOL(fd,2)); if(t_sd && t_sd->state.noask) {// @noask [LuzZza] clif->noask_sub(sd, t_sd, 1); return; } - party_invite(sd, t_sd); + iParty->invite(sd, t_sd); } void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) @@ -11994,14 +11994,14 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) return; } - t_sd = map_nick2sd(name); + t_sd = iMap->nick2sd(name); if(t_sd && t_sd->state.noask) { // @noask [LuzZza] clif->noask_sub(sd, t_sd, 1); return; } - party_invite(sd, t_sd); + iParty->invite(sd, t_sd); } @@ -12013,12 +12013,12 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) /// 1 = accept void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) { - party_reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); + iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6)); } void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) { - party_reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); + iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); } @@ -12030,7 +12030,7 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd) clif->message(fd, msg_txt(227)); return; } - party_leave(sd); + iParty->leave(sd); } @@ -12042,7 +12042,7 @@ void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) clif->message(fd, msg_txt(227)); return; } - party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6)); + iParty->removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6)); } @@ -12057,7 +12057,7 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) if( !sd->status.party_id ) return; - p = party_search(sd->status.party_id); + p = iParty->search(sd->status.party_id); if( p == NULL ) return; @@ -12070,9 +12070,9 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) #if PACKETVER < 20090603 //Client can't change the item-field - party_changeoption(sd, RFIFOL(fd,2), p->party.item); + iParty->changeoption(sd, RFIFOL(fd,2), p->party.item); #else - party_changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); + iParty->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0))); #endif } @@ -12099,12 +12099,12 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) if( battle_config.min_chat_delay ) { //[Skotlex] - if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) + if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0) return; - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; + sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay; } - party_send_message(sd, text, textlen); + iParty->send_message(sd, text, textlen); } @@ -12112,7 +12112,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) /// 07da .L void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) { - party_changeleader(sd, map_id2sd(RFIFOL(fd,2))); + iParty->changeleader(sd, iMap->id2sd(RFIFOL(fd,2))); } @@ -12131,7 +12131,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) for(i=0; ibooking_register(sd, level, mapid, job); } @@ -12162,7 +12162,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) unsigned long lastindex = RFIFOL(fd,8); short resultcount = RFIFOW(fd,12); - party_booking_search(sd, level, mapid, job, lastindex, resultcount); + iParty->booking_search(sd, level, mapid, job, lastindex, resultcount); } @@ -12199,7 +12199,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, /// 0806 void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) { - if(party_booking_delete(sd)) + if(iParty->booking_delete(sd)) clif->PartyBookingDeleteAck(sd, 0); } @@ -12232,7 +12232,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) for(i=0; ibooking_update(sd, job); } @@ -12360,7 +12360,7 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd) clif->message (sd->fd, msg_txt(276)); // "You can't open a shop on this map" return; } - if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) { + if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) { clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." return; } @@ -12558,7 +12558,7 @@ clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_da /// 0168 .L .L .L void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { - struct map_session_data *t_sd = map_id2sd(RFIFOL(fd,2)); + struct map_session_data *t_sd = iMap->id2sd(RFIFOL(fd,2)); if (clif_sub_guild_invite(fd, sd, t_sd)) return; @@ -12568,7 +12568,7 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd) /// 0916 .24B void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) { - struct map_session_data *t_sd = map_nick2sd((char *)RFIFOP(fd, 2)); + struct map_session_data *t_sd = iMap->nick2sd((char *)RFIFOP(fd, 2)); if (clif_sub_guild_invite(fd, sd, t_sd)) return; @@ -12636,9 +12636,9 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) if( battle_config.min_chat_delay ) { //[Skotlex] - if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) + if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0) return; - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; + sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay; } if( sd->bg_id ) @@ -12662,7 +12662,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) return; } - t_sd = map_id2sd(RFIFOL(fd,2)); + t_sd = iMap->id2sd(RFIFOL(fd,2)); // @noask [LuzZza] if(t_sd && t_sd->state.noask) { @@ -12717,7 +12717,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) return; } - t_sd = map_id2sd(RFIFOL(fd,2)); + t_sd = iMap->id2sd(RFIFOL(fd,2)); // @noask [LuzZza] if(t_sd && t_sd->state.noask) { @@ -12832,7 +12832,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) int tid; tid = RFIFOL(fd,2); - target = map_id2bl(tid); + target = iMap->id2bl(tid); if (!target) { clif->GM_kickack(sd, 0); return; @@ -12853,7 +12853,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) case BL_MOB: { char command[100]; - if( !pc_can_use_command(sd, "@killmonster")) { + if( !iPc->can_use_command(sd, "@killmonster")) { clif->GM_kickack(sd, 0); return; } @@ -12916,7 +12916,7 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd) struct map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) { + if( (pl_sd = iMap->id2sd(account_id)) != NULL ) { char command[NAME_LENGTH+8]; sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name); atcommand->parse(fd, sd, command, 1); @@ -12953,7 +12953,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd) struct map_session_data* pl_sd; account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]); - if( (pl_sd = map_id2sd(account_id)) != NULL ) { + if( (pl_sd = iMap->id2sd(account_id)) != NULL ) { char command[NAME_LENGTH+8]; sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name); atcommand->parse(fd, sd, command, 1); @@ -13024,10 +13024,10 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) //If type is 2 and the ids don't match, this is a crafted hacked packet! //Disabled because clients keep self-muting when you give players public @ commands... [Skotlex] - if (type == 2 /* && (pc_get_group_level(sd) > 0 || sd->bl.id != id)*/) + if (type == 2 /* && (iPc->get_group_level(sd) > 0 || sd->bl.id != id)*/) return; - dstsd = map_id2sd(id); + dstsd = iMap->id2sd(id); if( dstsd == NULL ) return; @@ -13091,7 +13091,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd) y = RFIFOW(fd,4); type = RFIFOW(fd,6); - map_setgatcell(sd->bl.m,x,y,type); + iMap->setgatcell(sd->bl.m,x,y,type); clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP); //FIXME: once players leave the map, the client 'forgets' this information. } @@ -13114,7 +13114,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd) type = RFIFOB(fd,26); if( type == 0 ) { // Add name to ignore list (block) - if (strcmp(wisp_server_name, nick) == 0) { + if (strcmp(iMap->wisp_server_name, nick) == 0) { clif->wisexin(sd, type, 1); // fail return; } @@ -13241,8 +13241,8 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd) { if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) { - unsigned int next = pc_nextbaseexp(sd); - if( next == 0 ) next = pc_thisbaseexp(sd); + unsigned int next = iPc->nextbaseexp(sd); + if( next == 0 ) next = iPc->thisbaseexp(sd); if( next ) { int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. ); @@ -13315,7 +13315,7 @@ void clif_friendslist_send(struct map_session_data *sd) } for (n = 0; n < i; n++) { //Sending the online players - if (map_charid2sd(sd->status.friends[n].char_id)) + if (iMap->charid2sd(sd->status.friends[n].char_id)) clif->friendslist_toggle(sd, sd->status.friends[n].account_id, sd->status.friends[n].char_id, 1); } } @@ -13367,7 +13367,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd) struct map_session_data *f_sd; int i; - f_sd = map_nick2sd((char*)RFIFOP(fd,2)); + f_sd = iMap->nick2sd((char*)RFIFOP(fd,2)); // ensure that the request player's friend list is not full ARR_FIND(0, MAX_FRIENDS, i, sd->status.friends[i].char_id == 0); @@ -13432,7 +13432,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) return; } - f_sd = map_id2sd(account_id); //The account id is the same as the bl.id of players. + f_sd = iMap->id2sd(account_id); //The account id is the same as the bl.id of players. if (f_sd == NULL) return; @@ -13497,7 +13497,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) } //remove from friend's list first - if( (f_sd = map_id2sd(account_id)) && f_sd->status.char_id == char_id) { + if( (f_sd = iMap->id2sd(account_id)) && f_sd->status.char_id == char_id) { for (i = 0; i < MAX_FRIENDS && (f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++); @@ -13578,7 +13578,7 @@ void clif_blacksmith(struct map_session_data* sd) for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (smith_fame_list[i].id > 0) { if (strcmp(smith_fame_list[i].name, "-") == 0 && - (name = map_charid2nick(smith_fame_list[i].id)) != NULL) + (name = iMap->charid2nick(smith_fame_list[i].id)) != NULL) { strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), name, NAME_LENGTH); } else @@ -13630,7 +13630,7 @@ void clif_alchemist(struct map_session_data* sd) { for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (chemist_fame_list[i].id > 0) { if (strcmp(chemist_fame_list[i].name, "-") == 0 && - (name = map_charid2nick(chemist_fame_list[i].id)) != NULL) + (name = iMap->charid2nick(chemist_fame_list[i].id)) != NULL) { memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH); } else @@ -13682,7 +13682,7 @@ void clif_taekwon(struct map_session_data* sd) { for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { if (taekwon_fame_list[i].id > 0) { if (strcmp(taekwon_fame_list[i].name, "-") == 0 && - (name = map_charid2nick(taekwon_fame_list[i].id)) != NULL) + (name = iMap->charid2nick(taekwon_fame_list[i].id)) != NULL) { memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH); } else @@ -13882,7 +13882,7 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn] /// 0292 void clif_parse_AutoRevive(int fd, struct map_session_data *sd) { - int item_position = pc_search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); + int item_position = iPc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED); if (item_position < 0) return; @@ -13894,7 +13894,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) return; clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); - pc_delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); + iPc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); } @@ -13909,17 +13909,17 @@ void clif_check(int fd, struct map_session_data* pl_sd) { WFIFOHEAD(fd,packet_len(0x214)); WFIFOW(fd, 0) = 0x214; WFIFOB(fd, 2) = min(pl_sd->status.str, UINT8_MAX); - WFIFOB(fd, 3) = pc_need_status_point(pl_sd, SP_STR, 1); + WFIFOB(fd, 3) = iPc->need_status_point(pl_sd, SP_STR, 1); WFIFOB(fd, 4) = min(pl_sd->status.agi, UINT8_MAX); - WFIFOB(fd, 5) = pc_need_status_point(pl_sd, SP_AGI, 1); + WFIFOB(fd, 5) = iPc->need_status_point(pl_sd, SP_AGI, 1); WFIFOB(fd, 6) = min(pl_sd->status.vit, UINT8_MAX); - WFIFOB(fd, 7) = pc_need_status_point(pl_sd, SP_VIT, 1); + WFIFOB(fd, 7) = iPc->need_status_point(pl_sd, SP_VIT, 1); WFIFOB(fd, 8) = min(pl_sd->status.int_, UINT8_MAX); - WFIFOB(fd, 9) = pc_need_status_point(pl_sd, SP_INT, 1); + WFIFOB(fd, 9) = iPc->need_status_point(pl_sd, SP_INT, 1); WFIFOB(fd,10) = min(pl_sd->status.dex, UINT8_MAX); - WFIFOB(fd,11) = pc_need_status_point(pl_sd, SP_DEX, 1); + WFIFOB(fd,11) = iPc->need_status_point(pl_sd, SP_DEX, 1); WFIFOB(fd,12) = min(pl_sd->status.luk, UINT8_MAX); - WFIFOB(fd,13) = pc_need_status_point(pl_sd, SP_LUK, 1); + WFIFOB(fd,13) = iPc->need_status_point(pl_sd, SP_LUK, 1); WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk; WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2; WFIFOW(fd,18) = pl_sd->battle_status.matk_max; @@ -13951,7 +13951,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd) safestrncpy(charname, (const char*)RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname)); - if( ( pl_sd = map_nick2sd(charname) ) == NULL || pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) { + if( ( pl_sd = iMap->nick2sd(charname) ) == NULL || iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) ) { return; } @@ -14233,9 +14233,9 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) if ((data = itemdb_exists(sd->mail.inbox.msg[i].item.nameid)) == NULL) return; - switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { + switch( iPc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) { case ADDITEM_NEW: - fail = ( pc_inventoryblank(sd) == 0 ); + fail = ( iPc->inventoryblank(sd) == 0 ); break; case ADDITEM_OVERAMOUNT: fail = true; @@ -14361,7 +14361,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) return; } - if( DIFF_TICK(sd->cansendmail_tick, gettick()) > 0 ) { + if( DIFF_TICK(sd->cansendmail_tick, iTimer->gettick()) > 0 ) { clif->message(sd->fd,msg_txt(675)); //"Cannot send mails too fast!!." clif->mail_send(fd, true); // fail return; @@ -14399,7 +14399,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) if( !intif_Mail_send(sd->status.account_id, &msg) ) mail_deliveryfail(sd, &msg); - sd->cansendmail_tick = gettick() + 1000; // 1 Second flood Protection + sd->cansendmail_tick = iTimer->gettick() + 1000; // 1 Second flood Protection } @@ -14527,9 +14527,9 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) return; } - if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time || + if( !iPc->can_give_items(sd) || sd->status.inventory[idx].expire_time || !sd->status.inventory[idx].identify || - !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) ) { // Quest Item or something else + !itemdb_canauction(&sd->status.inventory[idx],iPc->get_group_level(sd)) ) { // Quest Item or something else clif->auction_setitem(sd->fd, idx, true); return; } @@ -14646,10 +14646,10 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) { int zeny = auction.hours*battle_config.auction_feeperhour; - pc_delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION); + iPc->delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION); sd->auction.amount = 0; - pc_payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL); + iPc->payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL); } } @@ -14681,7 +14681,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd) unsigned int auction_id = RFIFOL(fd,2); int bid = RFIFOL(fd,6); - if( !pc_can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish] + if( !iPc->can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish] clif->message(sd->fd, msg_txt(246)); return; } @@ -14693,7 +14693,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd) else if ( CheckForCharServer() ) // char server is down (bugreport:1138) clif->auction_message(fd, 0); // You have failed to bid into the auction else { - pc_payzeny(sd, bid, LOG_TYPE_AUCTION, NULL); + iPc->payzeny(sd, bid, LOG_TYPE_AUCTION, NULL); intif_Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid); } } @@ -14878,9 +14878,9 @@ void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *sr /// 01f9 .L void clif_parse_Adopt_request(int fd, struct map_session_data *sd) { - struct map_session_data *tsd = map_id2sd(RFIFOL(fd,2)), *p_sd = map_charid2sd(sd->status.partner_id); + struct map_session_data *tsd = iMap->id2sd(RFIFOL(fd,2)), *p_sd = iMap->charid2sd(sd->status.partner_id); - if( pc_can_Adopt(sd, p_sd, tsd) ) { + if( iPc->can_Adopt(sd, p_sd, tsd) ) { tsd->adopt_invite = sd->status.account_id; clif->adopt_request(tsd, sd, p_sd->status.account_id); } @@ -14897,8 +14897,8 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) int p1_id = RFIFOL(fd,2); int p2_id = RFIFOL(fd,6); int result = RFIFOL(fd,10); - struct map_session_data* p1_sd = map_id2sd(p1_id); - struct map_session_data* p2_sd = map_id2sd(p2_id); + struct map_session_data* p1_sd = iMap->id2sd(p1_id); + struct map_session_data* p2_sd = iMap->id2sd(p2_id); int pid = sd->adopt_invite; sd->adopt_invite = 0; @@ -14912,7 +14912,7 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd) if( result == 0 ) return; // Rejected - pc_adoption(p1_sd, p2_sd, sd); + iPc->adoption(p1_sd, p2_sd, sd); } @@ -14938,11 +14938,11 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag) } else WFIFOB(fd,2) = 2; // First Time } else if (md->spawn_timer != INVALID_TIMER) { // Boss is Dead - const struct TimerData * timer_data = get_timer(md->spawn_timer); + const struct TimerData * timer_data = iTimer->get_timer(md->spawn_timer); unsigned int seconds; int hours, minutes; - seconds = DIFF_TICK(timer_data->tick, gettick()) / 1000 + 60; + seconds = DIFF_TICK(timer_data->tick, iTimer->gettick()) / 1000 + 60; hours = seconds / (60 * 60); seconds = seconds - (60 * 60 * hours); minutes = seconds / 60; @@ -14963,7 +14963,7 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag) void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { int charid = RFIFOL(fd, 2); - struct map_session_data* tsd = map_id2sd(charid); + struct map_session_data* tsd = iMap->id2sd(charid); if (!tsd) return; @@ -15488,9 +15488,9 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) return; if( battle_config.min_chat_delay ) { - if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 ) + if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 ) return; - sd->cantalk_tick = gettick() + battle_config.min_chat_delay; + sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay; } bg_send_message(sd, text, textlen); @@ -15586,11 +15586,11 @@ int clif_instance(int instance_id, int type, int flag) { break; case IOT_PARTY: /* default is already PARTY */ - sd = party_getavailablesd(party_search(instances[instance_id].owner_id)); + sd = iParty->getavailablesd(iParty->search(instances[instance_id].owner_id)); break; case IOT_CHAR: target = SELF; - sd = map_id2sd(instances[instance_id].owner_id); + sd = iMap->id2sd(instances[instance_id].owner_id); break; } @@ -16836,14 +16836,14 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { if (!itemdb_isstackable2(data)) get_count = 1; - pc_paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki] + iPc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki] for (k = 0; k < qty; k += get_count) { if (!pet_create_egg(sd, data->nameid)) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = data->nameid; item_tmp.identify = 1; - switch (pc_additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { + switch (iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) { case 0: result = CSBR_SUCCESS; break; @@ -16865,7 +16865,7 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) { } if( result != CSBR_SUCCESS ) - pc_getcash(sd, clif->cs.data[tab][j]->price * get_count,0); + iPc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0); } } } @@ -17118,7 +17118,7 @@ int clif_parse(int fd) { } else { //Unusual logout (during log on/off/map-changer procedure) ShowInfo("Player AID:%d/CID:%d logged off.\n", sd->status.account_id, sd->status.char_id); - map_quit(sd); + iMap->quit(sd); } } else { ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", ip2str(session[fd]->client_addr, NULL)); @@ -17280,8 +17280,8 @@ int do_init_clif(void) { exit(EXIT_FAILURE); } - add_timer_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); - add_timer_func_list(clif->delayquit, "clif_delayquit"); + iTimer->add_timer_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub"); + iTimer->add_timer_func_list(clif->delayquit, "clif_delayquit"); clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); -- cgit v1.2.3-70-g09d2