diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-07-04 05:52:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-07-24 20:34:46 +0300 |
commit | c42b4140c6f336ef6d4aa7d59031eb339bedbf14 (patch) | |
tree | ccc570f8f9d96c2a0244011590cca4850d18c5be /src/map | |
parent | 29b9e526fc961fad2248f6452e0b5af41bdce1ed (diff) | |
download | hercules-c42b4140c6f336ef6d4aa7d59031eb339bedbf14.tar.gz hercules-c42b4140c6f336ef6d4aa7d59031eb339bedbf14.tar.bz2 hercules-c42b4140c6f336ef6d4aa7d59031eb339bedbf14.tar.xz hercules-c42b4140c6f336ef6d4aa7d59031eb339bedbf14.zip |
Update ZC_ACK_RANKING for new clients
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 38 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/packets_struct.h | 21 |
3 files changed, 59 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 2f88fbcd6..988f60417 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -15725,6 +15725,7 @@ static void clif_parse_PVPInfo(int fd, struct map_session_data *sd) /// ranking pointlist { <name>.24B <point>.L }*10 static void clif_ranklist_sub(struct PACKET_ZC_ACK_RANKING_sub *ranks, enum fame_list_type type) { +#if !(PACKETVER_RE_NUM >= 20190703) nullpo_retv(ranks); struct fame_list* list; @@ -15754,6 +15755,38 @@ static void clif_ranklist_sub(struct PACKET_ZC_ACK_RANKING_sub *ranks, enum fame strncpy(ranks[i].name, "Unavailable", 12); ranks[i].points = 0; } +#endif +} + +static void clif_ranklist_sub2(uint32 *chars, uint32 *points, enum fame_list_type type) +{ +#if PACKETVER_RE_NUM >= 20190703 + nullpo_retv(chars); + nullpo_retv(points); + + struct fame_list* list; + switch (type) { + case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break; + case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break; + case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break; + default: return; // Unsupported + } + + int i; + // Packet size limits this list to 10 elements. [Skotlex] + for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) { + if (list[i].id > 0) { + chars[i] = list[i].id; + } else { + chars[i] = 0; + } + points[i] = list[i].fame; //points + } + for (;i < 10; i++) { // In case the MAX is less than 10. + chars[i] = 0; + points[i] = 0; + } +#endif } /// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING) @@ -15766,7 +15799,11 @@ static void clif_ranklist(struct map_session_data *sd, enum fame_list_type type) struct PACKET_ZC_ACK_RANKING *p = WFIFOP(fd, 0); p->packetType = HEADER_ZC_ACK_RANKING; p->rankType = type; +#if PACKETVER_RE_NUM >= 20190703 + clif->ranklist_sub2(p->chars, p->points, type); +#else clif->ranklist_sub(p->ranks, type); +#endif if (pc->famelist_type(sd->job) == type) { p->myPoints = sd->status.fame; //mypoint @@ -23132,6 +23169,7 @@ void clif_defaults(void) clif->fame_taekwon = clif_fame_taekwon; clif->ranklist = clif_ranklist; clif->ranklist_sub = clif_ranklist_sub; + clif->ranklist_sub2 = clif_ranklist_sub2; clif->pRanklist = clif_parse_ranklist; clif->update_rankingpoint = clif_update_rankingpoint; clif->hotkeys = clif_hotkeys_send; diff --git a/src/map/clif.h b/src/map/clif.h index 5afc50742..ca7ae35b0 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -851,6 +851,7 @@ struct clif_interface { void (*fame_taekwon) (struct map_session_data *sd, int points); void (*ranklist) (struct map_session_data *sd, enum fame_list_type type); void (*ranklist_sub) (struct PACKET_ZC_ACK_RANKING_sub *ranks, enum fame_list_type type); + void (*ranklist_sub2) (uint32 *chars, uint32 *points, enum fame_list_type type); void (*update_rankingpoint) (struct map_session_data *sd, enum fame_list_type type, int points); void (*pRanklist) (int fd, struct map_session_data *sd); void (*hotkeys) (struct map_session_data *sd, int tab); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 8415be8ca..5566b5581 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3480,12 +3480,26 @@ struct PACKET_ZC_REFINE_STATUS { DEFINE_PACKET_HEADER(ZC_REFINE_STATUS, 0x0ada); #endif +#if PACKETVER_RE_NUM >= 20190703 +struct PACKET_ZC_ACK_RANKING_sub { + char name[NAME_LENGTH]; + uint32 points; +} __attribute__((packed)); + +struct PACKET_ZC_ACK_RANKING { + int16 packetType; + int16 rankType; + uint32 chars[10]; + uint32 points[10]; + uint32 myPoints; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_RANKING, 0x0af6); +#elif PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO) struct PACKET_ZC_ACK_RANKING_sub { char name[NAME_LENGTH]; uint32 points; } __attribute__((packed)); -#if PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO) struct PACKET_ZC_ACK_RANKING { int16 packetType; int16 rankType; @@ -3493,6 +3507,11 @@ struct PACKET_ZC_ACK_RANKING { uint32 myPoints; } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_ACK_RANKING, 0x097d); +#else +struct PACKET_ZC_ACK_RANKING_sub { + char name[NAME_LENGTH]; + uint32 points; +} __attribute__((packed)); #endif #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute |