diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 356 |
1 files changed, 188 insertions, 168 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 74d827847..7bc808eed 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4631,31 +4631,32 @@ void clif_getareachar_item(struct map_session_data* sd,struct flooritem_data* fi /// 01c9 <id>.L <creator id>.L <x>.W <y>.W <unit id>.B <visible>.B <has msg>.B <msg>.80B (ZC_SKILL_ENTRY2) /// 08c7 <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.B <range>.W <visible>.B (ZC_SKILL_ENTRY3) /// 099f <lenght>.W <id> L <creator id>.L <x>.W <y>.W <unit id>.L <range>.W <visible>.B (ZC_SKILL_ENTRY4) -void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *unit) { +void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit *su) { int fd = sd->fd, header = 0x11f, pos=0; - if( unit->group->state.guildaura ) + if( su->group->state.guildaura ) return; #if PACKETVER >= 20130320 - if(unit->group->unit_id > UCHAR_MAX){ + if(su->group->unit_id > UCHAR_MAX) { header = 0x99f; pos = 2; } #endif #if PACKETVER >= 3 - if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris] + if(su->group->unit_id==UNT_GRAFFITI) { + // Graffiti [Valaris] WFIFOHEAD(fd,packet_len(0x1c9)); WFIFOW(fd, 0)=0x1c9; - WFIFOL(fd, 2)=unit->bl.id; - WFIFOL(fd, 6)=unit->group->src_id; - WFIFOW(fd,10)=unit->bl.x; - WFIFOW(fd,12)=unit->bl.y; - WFIFOB(fd,14)=unit->group->unit_id; + WFIFOL(fd, 2)=su->bl.id; + WFIFOL(fd, 6)=su->group->src_id; + WFIFOW(fd,10)=su->bl.x; + WFIFOW(fd,12)=su->bl.y; + WFIFOB(fd,14)=su->group->unit_id; WFIFOB(fd,15)=1; WFIFOB(fd,16)=1; - safestrncpy((char*)WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE); + safestrncpy((char*)WFIFOP(fd,17),su->group->valstr,MESSAGE_SIZE); WFIFOSET(fd,packet_len(0x1c9)); return; } @@ -4664,55 +4665,54 @@ void clif_getareachar_skillunit(struct map_session_data *sd, struct skill_unit * WFIFOW(fd, 0)=header; if(pos > 0) WFIFOL(fd, pos)=packet_len(header); - WFIFOL(fd, 2 + pos)=unit->bl.id; - WFIFOL(fd, 6 + pos)=unit->group->src_id; - WFIFOW(fd,10 + pos)=unit->bl.x; - WFIFOW(fd,12 + pos)=unit->bl.y; - if (battle_config.traps_setting&1 && skill->get_inf2(unit->group->skill_id)&INF2_TRAP) + WFIFOL(fd, 2 + pos)=su->bl.id; + WFIFOL(fd, 6 + pos)=su->group->src_id; + WFIFOW(fd,10 + pos)=su->bl.x; + WFIFOW(fd,12 + pos)=su->bl.y; + if (battle_config.traps_setting&1 && skill->get_inf2(su->group->skill_id)&INF2_TRAP) WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. - else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) + else if (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT)) WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. else if(pos > 0){ - WFIFOL(fd,16)=unit->group->unit_id; - WFIFOW(fd,20)=unit->range; + WFIFOL(fd,16)=su->group->unit_id; + WFIFOW(fd,20)=su->range; pos += 5; }else - WFIFOB(fd,14)=unit->group->unit_id; + WFIFOB(fd,14)=su->group->unit_id; WFIFOB(fd,15 + pos)=1; // ignored by client (always gets set to 1) WFIFOSET(fd,packet_len(header)); - if(unit->group->skill_id == WZ_ICEWALL) - clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5,SELF); + if(su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,5,SELF); } /*========================================== * Server tells client to remove unit of id 'unit->bl.id' *------------------------------------------*/ -void clif_clearchar_skillunit(struct skill_unit *unit, int fd) { - nullpo_retv(unit); +void clif_clearchar_skillunit(struct skill_unit *su, int fd) { + nullpo_retv(su); WFIFOHEAD(fd,packet_len(0x120)); WFIFOW(fd, 0)=0x120; - WFIFOL(fd, 2)=unit->bl.id; + WFIFOL(fd, 2)=su->bl.id; WFIFOSET(fd,packet_len(0x120)); - if(unit->group && unit->group->skill_id == WZ_ICEWALL) - clif->changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,SELF); + if(su->group && su->group->skill_id == WZ_ICEWALL) + clif->changemapcell(fd,su->bl.m,su->bl.x,su->bl.y,su->val2,SELF); } /// Removes a skill unit (ZC_SKILL_DISAPPEAR). /// 0120 <id>.L -void clif_skill_delunit(struct skill_unit *unit) -{ +void clif_skill_delunit(struct skill_unit *su) { unsigned char buf[16]; - nullpo_retv(unit); + nullpo_retv(su); WBUFW(buf, 0)=0x120; - WBUFL(buf, 2)=unit->bl.id; - clif->send(buf,packet_len(0x120),&unit->bl,AREA); + WBUFL(buf, 2)=su->bl.id; + clif->send(buf,packet_len(0x120),&su->bl,AREA); } @@ -5330,57 +5330,57 @@ void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,int x,i * Tells all client's nearby 'unit' sight range that it spawned *------------------------------------------*/ //FIXME: this is just an AREA version of clif_getareachar_skillunit() -void clif_skill_setunit(struct skill_unit *unit) -{ +void clif_skill_setunit(struct skill_unit *su) { unsigned char buf[128]; int header = 0x11f, pos = 0; - nullpo_retv(unit); + nullpo_retv(su); - if( unit->group->state.guildaura ) + if( su->group->state.guildaura ) return; #if PACKETVER >= 20130320 - if(unit->group->unit_id > UCHAR_MAX){ + if(su->group->unit_id > UCHAR_MAX) { header = 0x99f; pos = 2; } #endif #if PACKETVER >= 3 - if(unit->group->unit_id==UNT_GRAFFITI) { // Graffiti [Valaris] + if(su->group->unit_id==UNT_GRAFFITI) { + // Graffiti [Valaris] WBUFW(buf, 0)=0x1c9; - WBUFL(buf, 2)=unit->bl.id; - WBUFL(buf, 6)=unit->group->src_id; - WBUFW(buf,10)=unit->bl.x; - WBUFW(buf,12)=unit->bl.y; - WBUFB(buf,14)=unit->group->unit_id; + WBUFL(buf, 2)=su->bl.id; + WBUFL(buf, 6)=su->group->src_id; + WBUFW(buf,10)=su->bl.x; + WBUFW(buf,12)=su->bl.y; + WBUFB(buf,14)=su->group->unit_id; WBUFB(buf,15)=1; WBUFB(buf,16)=1; - safestrncpy((char*)WBUFP(buf,17),unit->group->valstr,MESSAGE_SIZE); - clif->send(buf,packet_len(0x1c9),&unit->bl,AREA); + safestrncpy((char*)WBUFP(buf,17),su->group->valstr,MESSAGE_SIZE); + clif->send(buf,packet_len(0x1c9),&su->bl,AREA); return; } #endif WBUFW(buf, 0)=header; if(pos > 0) WBUFW(buf, pos)=packet_len(header); - WBUFL(buf, 2 + pos)=unit->bl.id; - WBUFL(buf, 6 + pos)=unit->group->src_id; - WBUFW(buf,10 + pos)=unit->bl.x; - WBUFW(buf,12 + pos)=unit->bl.y; - if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) - WBUFB(buf,14)=unit->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE; - else if (skill->get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) - WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center. - else if(pos > 0){ - WBUFL(buf,16)=unit->group->unit_id; - WBUFW(buf,20)=unit->range; + WBUFL(buf, 2 + pos)=su->bl.id; + WBUFL(buf, 6 + pos)=su->group->src_id; + WBUFW(buf,10 + pos)=su->bl.x; + WBUFW(buf,12 + pos)=su->bl.y; + if (su->group->state.song_dance&0x1 && su->val2&UF_ENSEMBLE) + WBUFB(buf,14)=su->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE; + else if (skill->get_unit_flag(su->group->skill_id) & UF_RANGEDSINGLEUNIT && !(su->val2 & UF_RANGEDSINGLEUNIT)) + WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center. + else if(pos > 0) { + WBUFL(buf,16)=su->group->unit_id; + WBUFW(buf,20)=su->range; pos += 5; }else - WBUFB(buf,14)=unit->group->unit_id; + WBUFB(buf,14)=su->group->unit_id; WBUFB(buf,15 + pos)=1; // ignored by client (always gets set to 1) - clif->send(buf,packet_len(header),&unit->bl,AREA); + clif->send(buf,packet_len(header),&su->bl,AREA); } @@ -6370,8 +6370,7 @@ void clif_closevendingboard(struct block_list* bl, int fd) /// Sends a list of items in a shop. /// R 0133 <packet len>.W <owner id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC) /// R 0800 <packet len>.W <owner id>.L <unique id>.L { <price>.L <amount>.W <index>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* (ZC_PC_PURCHASE_ITEMLIST_FROMMC2) -void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending) -{ +void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_vending* vending_items) { int i,fd; int count; struct map_session_data* vsd; @@ -6384,7 +6383,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven #endif nullpo_retv(sd); - nullpo_retv(vending); + nullpo_retv(vending_items); nullpo_retv(vsd=iMap->id2sd(id)); fd = sd->fd; @@ -6398,13 +6397,12 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven WFIFOL(fd,8) = vsd->vender_id; #endif - for( i = 0; i < count; i++ ) - { - int index = vending[i].index; + for( i = 0; i < count; i++ ) { + int index = vending_items[i].index; struct item_data* data = itemdb->search(vsd->status.cart[index].nameid); - WFIFOL(fd,offset+ 0+i*22) = vending[i].value; - WFIFOW(fd,offset+ 4+i*22) = vending[i].amount; - WFIFOW(fd,offset+ 6+i*22) = vending[i].index + 2; + WFIFOL(fd,offset+ 0+i*22) = vending_items[i].value; + WFIFOW(fd,offset+ 4+i*22) = vending_items[i].amount; + WFIFOW(fd,offset+ 6+i*22) = vending_items[i].index + 2; WFIFOB(fd,offset+ 8+i*22) = itemtype(data->type); WFIFOW(fd,offset+ 9+i*22) = ( data->view_id > 0 ) ? data->view_id : vsd->status.cart[index].nameid; WFIFOB(fd,offset+11+i*22) = vsd->status.cart[index].identify; @@ -6444,8 +6442,7 @@ void clif_buyvending(struct map_session_data* sd, int index, int amount, int fai /// Shop creation success (ZC_PC_PURCHASE_MYITEMLIST). /// 0136 <packet len>.W <owner id>.L { <price>.L <index>.W <amount>.W <type>.B <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }* -void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending) -{ +void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending_items) { int i,fd; int count; @@ -6459,11 +6456,11 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven WFIFOW(fd,2) = 8+count*22; WFIFOL(fd,4) = id; for( i = 0; i < count; i++ ) { - int index = vending[i].index; + int index = vending_items[i].index; struct item_data* data = itemdb->search(sd->status.cart[index].nameid); - WFIFOL(fd, 8+i*22) = vending[i].value; - WFIFOW(fd,12+i*22) = vending[i].index + 2; - WFIFOW(fd,14+i*22) = vending[i].amount; + WFIFOL(fd, 8+i*22) = vending_items[i].value; + WFIFOW(fd,12+i*22) = vending_items[i].index + 2; + WFIFOW(fd,14+i*22) = vending_items[i].amount; WFIFOB(fd,16+i*22) = itemtype(data->type); WFIFOW(fd,17+i*22) = ( data->view_id > 0 ) ? data->view_id : sd->status.cart[index].nameid; WFIFOB(fd,19+i*22) = sd->status.cart[index].identify; @@ -7022,23 +7019,23 @@ void clif_send_petdata(struct map_session_data* sd, struct pet_data* pd, int typ void clif_send_petstatus(struct map_session_data *sd) { int fd; - struct s_pet *pet; + struct s_pet *p; nullpo_retv(sd); nullpo_retv(sd->pd); fd=sd->fd; - pet = &sd->pd->pet; + p = &sd->pd->pet; WFIFOHEAD(fd,packet_len(0x1a2)); WFIFOW(fd,0)=0x1a2; - memcpy(WFIFOP(fd,2),pet->name,NAME_LENGTH); - WFIFOB(fd,26)=battle_config.pet_rename?0:pet->rename_flag; - WFIFOW(fd,27)=pet->level; - WFIFOW(fd,29)=pet->hungry; - WFIFOW(fd,31)=pet->intimate; - WFIFOW(fd,33)=pet->equip; + memcpy(WFIFOP(fd,2),p->name,NAME_LENGTH); + WFIFOB(fd,26)=battle_config.pet_rename?0:p->rename_flag; + WFIFOW(fd,27)=p->level; + WFIFOW(fd,29)=p->hungry; + WFIFOW(fd,31)=p->intimate; + WFIFOW(fd,33)=p->equip; #if PACKETVER >= 20081126 - WFIFOW(fd,35)=pet->class_; + WFIFOW(fd,35)=p->class_; #endif WFIFOSET(fd,packet_len(0x1a2)); } @@ -14037,50 +14034,118 @@ void clif_parse_PVPInfo(int fd,struct map_session_data *sd) clif->PVPInfo(sd); } +/// Ranking list -/// /blacksmith list (ZC_BLACKSMITH_RANK). -/// 0219 { <name>.24B }*10 { <point>.L }*10 -void clif_blacksmith(struct map_session_data* sd) -{ - int i, fd = sd->fd; +/// ranking pointlist { <name>.24B <point>.L }*10 +void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type) { const char* name; + struct fame_list* list; + int i; - WFIFOHEAD(fd,packet_len(0x219)); - WFIFOW(fd,0) = 0x219; - //Packet size limits this list to 10 elements. [Skotlex] - 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 = iMap->charid2nick(smith_fame_list[i].id)) != NULL) - { - strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), name, NAME_LENGTH); - } else - strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), smith_fame_list[i].name, NAME_LENGTH); - } else - strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "None", 5); - WFIFOL(fd, 242 + i * 4) = smith_fame_list[i].fame; + switch( type ) { + case RANKTYPE_BLACKSMITH: list = smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = taekwon_fame_list; break; + default: return; // Unsupported } - for(;i < 10; i++) { //In case the MAX is less than 10. - strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), "Unavailable", 12); - WFIFOL(fd, 242 + i * 4) = 0; + + // Packet size limits this list to 10 elements. [Skotlex] + for( i = 0; i < 10 && i < MAX_FAME_LIST; i++ ) { + if( list[i].id > 0 ) { + if( strcmp(list[i].name, "-") == 0 && (name = iMap->charid2nick(list[i].id)) != NULL ) { + strncpy((char *)(WBUFP(buf, 24 * i)), name, NAME_LENGTH); + } else { + strncpy((char *)(WBUFP(buf, 24 * i)), list[i].name, NAME_LENGTH); + } + } else { + strncpy((char *)(WBUFP(buf, 24 * i)), "None", 5); + } + WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; //points + } + for( ;i < 10; i++ ) { // In case the MAX is less than 10. + strncpy((char *)(WBUFP(buf, 24 * i)), "Unavailable", 12); + WBUFL(buf, 24 * 10 + i * 4) = 0; } +} - WFIFOSET(fd, packet_len(0x219)); +/// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING) +void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) { + int fd = sd->fd; + int mypoint = 0; + int upperMask = sd->class_&MAPID_UPPERMASK; + + WFIFOHEAD(fd, 288); + WFIFOW(fd, 0) = 0x97d; + WFIFOW(fd, 2) = type; + clif_ranklist_sub(WFIFOP(fd,4), type); + + if( (upperMask == MAPID_BLACKSMITH && type == RANKTYPE_BLACKSMITH) + || (upperMask == MAPID_ALCHEMIST && type == RANKTYPE_ALCHEMIST) + || (upperMask == MAPID_TAEKWON && type == RANKTYPE_TAEKWON) + ) { + mypoint = sd->status.fame; + } else { + mypoint = 0; + } + + WFIFOL(fd, 284) = mypoint; //mypoint + WFIFOSET(fd, 288); +} + +/* + * 097c <type> (CZ_REQ_RANKING) + * */ +void clif_parse_ranklist(int fd, struct map_session_data *sd) { + int16 type = RFIFOW(fd, 2); //type + + switch( type ) { + case RANKTYPE_BLACKSMITH: + case RANKTYPE_ALCHEMIST: + case RANKTYPE_TAEKWON: + clif->ranklist(sd, type); // pk_list unsuported atm + break; + } +} + +// 097e <RankingType>.W <point>.L <TotalPoint>.L (ZC_UPDATE_RANKING_POINT) +void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list_type type, int points) { +#if PACKETVER < 20130710 + switch( type ) { + case RANKTYPE_BLACKSMITH: clif->fame_blacksmith(sd,points); break; + case RANKTYPE_ALCHEMIST: clif->fame_alchemist(sd,points); break; + case RANKTYPE_TAEKWON: clif->fame_taekwon(sd,points); break; + } +#else + int fd = sd->fd; + WFIFOHEAD(fd, 12); + WFIFOW(fd, 0) = 0x97e; + WFIFOW(fd, 2) = type; + WFIFOL(fd, 4) = points; + WFIFOL(fd, 8) = sd->status.fame; + WFIFOSET(fd, 12); +#endif } +/// /blacksmith list (ZC_BLACKSMITH_RANK). +/// 0219 { <name>.24B }*10 { <point>.L }*10 +void clif_blacksmith(struct map_session_data* sd) { + int fd = sd->fd; + + WFIFOHEAD(fd,packet_len(0x219)); + WFIFOW(fd,0) = 0x219; + clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH); + WFIFOSET(fd, packet_len(0x219)); +} /// /blacksmith (CZ_BLACKSMITH_RANK). /// 0217 -void clif_parse_Blacksmith(int fd,struct map_session_data *sd) -{ +void clif_parse_Blacksmith(int fd,struct map_session_data *sd) { clif->blacksmith(sd); } - /// Notification about backsmith points (ZC_BLACKSMITH_POINT). /// 021b <points>.L <total points>.L -void clif_fame_blacksmith(struct map_session_data *sd, int points) -{ +void clif_fame_blacksmith(struct map_session_data *sd, int points) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x21b)); @@ -14090,49 +14155,26 @@ void clif_fame_blacksmith(struct map_session_data *sd, int points) WFIFOSET(fd, packet_len(0x21b)); } - /// /alchemist list (ZC_ALCHEMIST_RANK). /// 021a { <name>.24B }*10 { <point>.L }*10 void clif_alchemist(struct map_session_data* sd) { - int i, fd = sd->fd; - const char* name; + int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x21a)); WFIFOW(fd,0) = 0x21a; - //Packet size limits this list to 10 elements. [Skotlex] - 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 = iMap->charid2nick(chemist_fame_list[i].id)) != NULL) - { - memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH); - } else - memcpy(WFIFOP(fd, 2 + 24 * i), chemist_fame_list[i].name, NAME_LENGTH); - } else - memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH); - WFIFOL(fd, 242 + i * 4) = chemist_fame_list[i].fame; - } - for(;i < 10; i++) { //In case the MAX is less than 10. - memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH); - WFIFOL(fd, 242 + i * 4) = 0; - } - + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST); WFIFOSET(fd, packet_len(0x21a)); } - /// /alchemist (CZ_ALCHEMIST_RANK). /// 0218 -void clif_parse_Alchemist(int fd,struct map_session_data *sd) -{ +void clif_parse_Alchemist(int fd,struct map_session_data *sd) { clif->alchemist(sd); } - /// Notification about alchemist points (ZC_ALCHEMIST_POINT). /// 021c <points>.L <total points>.L -void clif_fame_alchemist(struct map_session_data *sd, int points) -{ +void clif_fame_alchemist(struct map_session_data *sd, int points) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x21c)); @@ -14142,48 +14184,26 @@ void clif_fame_alchemist(struct map_session_data *sd, int points) WFIFOSET(fd, packet_len(0x21c)); } - /// /taekwon list (ZC_TAEKWON_RANK). /// 0226 { <name>.24B }*10 { <point>.L }*10 void clif_taekwon(struct map_session_data* sd) { - int i, fd = sd->fd; - const char* name; + int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x226)); WFIFOW(fd,0) = 0x226; - //Packet size limits this list to 10 elements. [Skotlex] - 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 = iMap->charid2nick(taekwon_fame_list[i].id)) != NULL) - { - memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH); - } else - memcpy(WFIFOP(fd, 2 + 24 * i), taekwon_fame_list[i].name, NAME_LENGTH); - } else - memcpy(WFIFOP(fd, 2 + 24 * i), "None", NAME_LENGTH); - WFIFOL(fd, 242 + i * 4) = taekwon_fame_list[i].fame; - } - for(;i < 10; i++) { //In case the MAX is less than 10. - memcpy(WFIFOP(fd, 2 + 24 * i), "Unavailable", NAME_LENGTH); - WFIFOL(fd, 242 + i * 4) = 0; - } + clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON); WFIFOSET(fd, packet_len(0x226)); } - /// /taekwon (CZ_TAEKWON_RANK). /// 0225 -void clif_parse_Taekwon(int fd,struct map_session_data *sd) -{ +void clif_parse_Taekwon(int fd,struct map_session_data *sd) { clif->taekwon(sd); } - /// Notification about taekwon points (ZC_TAEKWON_POINT). /// 0224 <points>.L <total points>.L -void clif_fame_taekwon(struct map_session_data *sd, int points) -{ +void clif_fame_taekwon(struct map_session_data *sd, int points) { int fd = sd->fd; WFIFOHEAD(fd,packet_len(0x224)); @@ -14193,7 +14213,6 @@ void clif_fame_taekwon(struct map_session_data *sd, int points) WFIFOSET(fd, packet_len(0x224)); } - /// /pk list (ZC_KILLER_RANK). /// 0238 { <name>.24B }*10 { <point>.L }*10 void clif_ranking_pk(struct map_session_data* sd) { @@ -14211,8 +14230,7 @@ void clif_ranking_pk(struct map_session_data* sd) { /// /pk (CZ_KILLER_RANK). /// 0237 -void clif_parse_RankingPk(int fd,struct map_session_data *sd) -{ +void clif_parse_RankingPk(int fd,struct map_session_data *sd) { clif->ranking_pk(sd); } @@ -16180,8 +16198,7 @@ void clif_party_show_picker(struct map_session_data * sd, struct item * item_dat /// exp type: /// 0 = normal exp gain/loss /// 1 = quest exp gain/loss -void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool quest) -{ +void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, bool is_quest) { int fd; nullpo_retv(sd); @@ -16193,7 +16210,7 @@ void clif_displayexp(struct map_session_data *sd, unsigned int exp, char type, b WFIFOL(fd,2) = sd->bl.id; WFIFOL(fd,6) = exp; WFIFOW(fd,10) = type; - WFIFOW(fd,12) = quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple. + WFIFOW(fd,12) = is_quest?1:0;// Normal exp is shown in yellow, quest exp is shown in purple. WFIFOSET(fd,packet_len(0x7f6)); } @@ -18068,6 +18085,9 @@ void clif_defaults(void) { clif->fame_blacksmith = clif_fame_blacksmith; clif->fame_alchemist = clif_fame_alchemist; clif->fame_taekwon = clif_fame_taekwon; + clif->ranklist = clif_ranklist; + clif->pRanklist = clif_parse_ranklist; + clif->update_rankingpoint = clif_update_rankingpoint; clif->hotkeys = clif_hotkeys_send; clif->insight = clif_insight; clif->outsight = clif_outsight; |