From 9ef5e4e6ddc38609d7bc0f6f3befaae90600900b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Apr 2021 23:47:13 +0300 Subject: [PATCH] Add partial support for adventurer agency (incomplete) --- .gitignore | 1 + api-server.bat | 2 + run-server.bat | 1 + src/api/aclif.c | 2 +- src/char/int_adventurer_agency.c | 58 +++++++++++++++++++++++++++ src/char/int_adventurer_agency.h | 2 + src/char/inter.c | 16 ++++++++ src/char/mapif.c | 13 ++++++ src/char/mapif.h | 2 + src/common/Makefile.in | 3 +- src/common/charmappackets.h | 42 +++++++++++++++++++ src/common/mapcharpackets.h | 43 ++++++++++++++++++++ src/common/mmo.h | 19 +++++++++ src/map/clif.c | 45 +++++++++++++++++++++ src/map/clif.h | 3 ++ src/map/intif.c | 41 +++++++++++++++++++ src/map/intif.h | 3 ++ src/map/packets.h | 4 ++ src/map/packets_struct.h | 20 +++++++++ vcproj-16/api-server.vcxproj | 2 + vcproj-16/api-server.vcxproj.filters | 6 +++ vcproj-16/char-server.vcxproj | 2 + vcproj-16/char-server.vcxproj.filters | 6 +++ 23 files changed, 334 insertions(+), 2 deletions(-) create mode 100644 api-server.bat create mode 100644 src/common/charmappackets.h create mode 100644 src/common/mapcharpackets.h diff --git a/.gitignore b/.gitignore index c53bcdb5164..7e170a3a3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -136,6 +136,7 @@ Thumbs.db /vcproj-*/char-server /vcproj-*/login-server /vcproj-*/map-server +/vcproj-*/api-server /vcproj-*/mapcache /vcproj-*/plugin-*/ diff --git a/api-server.bat b/api-server.bat new file mode 100644 index 00000000000..80907812137 --- /dev/null +++ b/api-server.bat @@ -0,0 +1,2 @@ +@ECHO OFF +CALL serv.bat api-server.exe Api-Server diff --git a/run-server.bat b/run-server.bat index 3d09ba31890..152a9442a17 100644 --- a/run-server.bat +++ b/run-server.bat @@ -6,3 +6,4 @@ rem Writen by Jbain start cmd /k login-server.bat start cmd /k char-server.bat start cmd /k map-server.bat +start cmd /k api-server.bat diff --git a/src/api/aclif.c b/src/api/aclif.c index d11d91967ec..233cf7d7bdb 100644 --- a/src/api/aclif.c +++ b/src/api/aclif.c @@ -598,7 +598,7 @@ static void aclif_check_headers(int fd, struct api_session_data *sd) const char *size_str = strdb_get(sd->headers_db, "Content-Length"); if (size_str != NULL) { - const size_t sz = atoll(size_str); + const size_t sz = (size_t)atoll(size_str); if (sz > MAX_BODY_SIZE) { ShowError("Body size too big: %d\n", fd); sockt->eof(fd); diff --git a/src/char/int_adventurer_agency.c b/src/char/int_adventurer_agency.c index 2124534e4a4..c6e4ddc8b79 100644 --- a/src/char/int_adventurer_agency.c +++ b/src/char/int_adventurer_agency.c @@ -25,7 +25,9 @@ #include "char/char.h" #include "char/int_party.h" #include "char/inter.h" +#include "char/mapif.h" #include "common/cbasetypes.h" +#include "common/mapcharpackets.h" #include "common/apipackets.h" #include "common/db.h" #include "common/memmgr.h" @@ -43,6 +45,60 @@ static struct inter_adventurer_agency_interface inter_adventurer_agency_s; struct inter_adventurer_agency_interface *inter_adventurer_agency; +static int inter_adventurer_agency_parse_frommap(int fd) +{ + RFIFOHEAD(fd); + + switch (RFIFOW(fd, 0)) { + case 0x3084: + inter_adventurer_agency->pJoinParty(fd); + break; + default: + return 0; + } + + return 1; +} + +static void inter_adventurer_agency_parse_joinParty(int fd) +{ + const struct PACKET_MAPCHAR_AGENCY_JOIN_PARTY_REQ *p = RFIFOP(fd, 0); + const int char_id = p->char_id; + const int party_id = p->party_id; + const int map_index = p->map_index; + + struct mmo_charstatus *cp = (struct mmo_charstatus*)idb_get(chr->char_db_, char_id); + nullpo_retv(cp); + if (cp->party_id != 0) { + mapif->agency_joinPartyResult(fd, char_id, AGENCY_PLAYER_ALREADY_IN_PARTY); + return; + } + + struct party_data* party = (struct party_data*)idb_get(inter_party->db, party_id); + if (party == NULL) { + mapif->agency_joinPartyResult(fd, char_id, AGENCY_PARTY_NOT_FOUND); + return; + } + + struct party_member member = { 0 }; + member.account_id = cp->account_id; + member.char_id = cp->char_id; + safestrncpy(member.name, cp->name, NAME_LENGTH); + member.class = cp->class; + member.map = map_index; + member.lv = cp->base_level; + member.online = 1; + member.leader = 0; + + if (!inter_party->add_member(party_id, &member)) { + // for avoid another request to db, considerer only error + // from inter_party->add_member is too much members already + mapif->agency_joinPartyResult(fd, char_id, AGENCY_PARTY_NUMBER_EXCEEDED); + return; + } + mapif->agency_joinPartyResult(fd, char_id, AGENCY_JOIN_ACCEPTED); +} + static bool inter_adventurer_agency_entry_check_existing(int char_id, int party_id) { if (SQL_ERROR == SQL->Query(inter->sql_handle, @@ -265,6 +321,8 @@ void inter_adventurer_agency_defaults(void) { inter_adventurer_agency = &inter_adventurer_agency_s; + inter_adventurer_agency->pJoinParty = inter_adventurer_agency_parse_joinParty; + inter_adventurer_agency->parse_frommap = inter_adventurer_agency_parse_frommap; inter_adventurer_agency->entry_add = inter_adventurer_agency_entry_add; inter_adventurer_agency->entry_check_existing = inter_adventurer_agency_entry_check_existing; inter_adventurer_agency->entry_delete_existing = inter_adventurer_agency_entry_delete_existing; diff --git a/src/char/int_adventurer_agency.h b/src/char/int_adventurer_agency.h index c18ab9329a9..0ad11d0dc2f 100644 --- a/src/char/int_adventurer_agency.h +++ b/src/char/int_adventurer_agency.h @@ -31,6 +31,8 @@ struct adventuter_agency_page; * inter_adventurer_agency_interface interface **/ struct inter_adventurer_agency_interface { + int (*parse_frommap) (int fd); + void (*pJoinParty) (int fd); bool (*entry_add) (int char_id, const struct party_add_data *entry); bool (*entry_check_existing) (int char_id, int party_id); void (*entry_delete_existing) (int char_id, int party_id); diff --git a/src/char/inter.c b/src/char/inter.c index 49b5230a91d..32ea529b000 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -24,6 +24,7 @@ #include "char/char.h" #include "char/geoip.h" +#include "char/int_adventurer_agency.h" #include "char/int_auction.h" #include "char/int_clan.h" #include "char/int_elemental.h" @@ -66,6 +67,20 @@ static char default_codepage[32] = ""; //Feature by irmin. int party_share_level = 10; +// recv. packet list +static int inter_recv_packet_length[] = { + 0, 0, 0, 0, -1,13,36, (2 + 4 + 4 + 4 + NAME_LENGTH), 0, 0, 0, 0, 0, 0, 0, 0, // 3000- + 6,-1, 6,-1, 0, 0, 0, 0, 10,-1, 0, 0, 0, 0, 0, 0, // 3010- Account Storage, Achievements [Smokexyz] + -1,10,-1,14, 14,19, 6, 0, 14,14, 0, 0, 0, 0, 0, 0, // 3020- Party + -1, 6,-1,-1, 55,23, 6, 0, 14,-1,-1,-1, 18,19,186,-1, // 3030- + -1, 9, 0, 0, 10,10, 0, 0, 7, 6,10,10, 10,-1, 0, 0, // 3040- Clan System(3044-3045) + -1,-1,10,10, 0,-1,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus], Item Bound [Mhalicot] + 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3060- Quest system [Kevin] [Inkfish] + -1,10, 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, -1,10, 6,-1, // 3070- Mercenary packets [Zephyrus], Elemental packets [pakpil] + 56,14,-1, 6, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080- + -1,10,-1, 6, 0, 20,10,20, -1,6 + NAME_LENGTH, 0, 0, 0, 0, 0, 0, // 3090- Homunculus packets [albator], RoDEX packets +}; + #define MAX_JOB_NAMES 150 static char *msg_table[MAX_JOB_NAMES]; // messages 550 ~ 699 are job names @@ -1043,6 +1058,7 @@ static int inter_parse_frommap(int fd) || inter_rodex->parse_frommap(fd) || inter_clan->parse_frommap(fd) || inter_achievement->parse_frommap(fd) + || inter_adventurer_agency->parse_frommap(fd) ) break; else diff --git a/src/char/mapif.c b/src/char/mapif.c index 46c31fe19d7..a244139be42 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -39,6 +39,7 @@ #include "char/int_storage.h" #include "char/inter.h" #include "common/cbasetypes.h" +#include "common/charmappackets.h" #include "common/memmgr.h" #include "common/mmo.h" #include "common/nullpo.h" @@ -2297,6 +2298,17 @@ static void mapif_rodex_getitemsack(int char_id, int64 mail_id, uint8 opentype, mapif->send(buf, 16 + sizeof(struct rodex_item) * RODEX_MAX_ITEM); } +static void mapif_agency_joinPartyResult(int fd, int char_id, enum adventurer_agency_result result) +{ + WFIFOHEAD(fd, sizeof(struct PACKET_CHARMAP_AGENCY_JOIN_PARTY)); + struct PACKET_CHARMAP_AGENCY_JOIN_PARTY *p = WFIFOP(fd, 0); + + p->packetType = 0x389b; + p->char_id = char_id; + p->result = result; + WFIFOSET(fd, sizeof(struct PACKET_CHARMAP_AGENCY_JOIN_PARTY)); +} + void mapif_defaults(void) { mapif = &mapif_s; @@ -2457,4 +2469,5 @@ void mapif_defaults(void) /* Clan System */ mapif->parse_ClanMemberKick = mapif_parse_ClanMemberKick; mapif->parse_ClanMemberCount = mapif_parse_ClanMemberCount; + mapif->agency_joinPartyResult = mapif_agency_joinPartyResult; } diff --git a/src/char/mapif.h b/src/char/mapif.h index 76c23a660df..b382dced8bc 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -24,6 +24,7 @@ #include "common/mmo.h" struct rodex_item; +enum adventurer_agency_result; /** * mapif interface @@ -184,6 +185,7 @@ struct mapif_interface { // Clan System int (*parse_ClanMemberKick) (int fd, int clan_id, int kick_interval); int (*parse_ClanMemberCount) (int fd, int clan_id, int kick_interval); + void (*agency_joinPartyResult) (int fd, int char_id, enum adventurer_agency_result result); }; #ifdef HERCULES_CORE diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 27095a90028..ccab34f043f 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -62,7 +62,8 @@ COMMON_H = atomic.h cbasetypes.h conf.h console.h core.h db.h des.h ers.h \ grfio.h hercules.h HPM.h HPMi.h memmgr.h memmgr_inc.h mapindex.h \ md5calc.h mmo.h mutex.h nullpo.h packets.h packets_len.h packets_struct.h random.h \ showmsg.h socket.h spinlock.h sql.h strlib.h sysinfo.h thread.h \ - timer.h utils.h winapi.h api.h ../plugins/HPMHooking.h + timer.h utils.h winapi.h api.h charmappackets.h mapcharpackets.h \ + ../plugins/HPMHooking.h COMMON_PH = COMMON_SQL_OBJ = obj_sql/sql.o diff --git a/src/common/charmappackets.h b/src/common/charmappackets.h new file mode 100644 index 00000000000..8418fa762ad --- /dev/null +++ b/src/common/charmappackets.h @@ -0,0 +1,42 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2012-2020 Hercules Dev Team + * Copyright (C) 2020-2021 Andrei Karas (4144) + * Copyright (C) Athena Dev Teams + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef COMMON_CHARMAPPACKETS_H +#define COMMON_CHARMAPPACKETS_H + +#include "common/hercules.h" + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +struct PACKET_CHARMAP_AGENCY_JOIN_PARTY { + int16 packetType; + int char_id; + int result; +} __attribute__((packed)); + +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(pop) +#endif // not NetBSD < 6 / Solaris + +#endif /* COMMON_CHARMAPPACKETS_H */ diff --git a/src/common/mapcharpackets.h b/src/common/mapcharpackets.h new file mode 100644 index 00000000000..3550104b99d --- /dev/null +++ b/src/common/mapcharpackets.h @@ -0,0 +1,43 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2012-2020 Hercules Dev Team + * Copyright (C) 2020-2021 Andrei Karas (4144) + * Copyright (C) Athena Dev Teams + * + * Hercules is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef COMMON_MAPCHARPACKETS_H +#define COMMON_MAPCHARPACKETS_H + +#include "common/hercules.h" + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +struct PACKET_MAPCHAR_AGENCY_JOIN_PARTY_REQ { + int16 packetType; + int char_id; + int party_id; + int map_index; +} __attribute__((packed)); + +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(pop) +#endif // not NetBSD < 6 / Solaris + +#endif /* COMMON_MAPCHARPACKETS_H */ diff --git a/src/common/mmo.h b/src/common/mmo.h index 38bdc8a553d..1986f60b66c 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -1351,6 +1351,25 @@ enum e_pet_intimacy_level { PET_INTIMACY_MAX = 1000 }; + +// enum from packet ZC_ADVENTURER_AGENCY_JOIN_RESULT (0x0afa) +enum adventurer_agency_result { + AGENCY_JOIN_ACCEPTED = 0, + AGENCY_JOIN_REJECTED = 1, + AGENCY_PARTY_NUMBER_EXCEEDED = 2, + AGENCY_MASTER_UNABLE_ACCEPT_REQUEST = 3, + AGENCY_PARTY_JOIN_BLOCKED_BY_MAP = 4, + AGENCY_CHAR_CANT_BE_FOUND = 5, + AGENCY_CHAR_CANT_BE_FOUND2 = 6, + AGENCY_PLAYER_ALREADY_IN_PARTY = 7, + AGENCY_REQUEST_CANT_BE_RECEIVED = 8, + AGENCY_CANT_FIND_PARTY_LEADER_DELAYED = 9, + AGENCY_PARTY_NOT_FOUND = 10, + AGENCY_JOB_LEVEL_TOO_LOW = 11, + AGENCY_CHAR_IN_SAME_ACCOUNT_ALREADY_JOINED = 12, + AGENCY_UNKNOWN_ERROR = 13 +}; + /* packet size constant for itemlist */ #if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART #define MAX_ITEMLIST MAX_INVENTORY diff --git a/src/map/clif.c b/src/map/clif.c index 6c4dc26afe7..701419b4e06 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -25838,6 +25838,48 @@ static void clif_goldpc_info(struct map_session_data *sd) #endif // 20140611 } +static void clif_parse_adventuterAgencyJoinReq(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_adventuterAgencyJoinReq(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171214 + const struct PACKET_CZ_ADVENTURER_AGENCY_JOIN_REQ *p = RP2PTR(fd); + if (sd->status.party_id != 0) { + clif->adventurerAgencyResult(sd, AGENCY_PLAYER_ALREADY_IN_PARTY, sd->status.name, ""); + return; + } + if (sd->party_invite_account != 0) { + clif->adventurerAgencyResult(sd, AGENCY_UNKNOWN_ERROR, "", ""); + return; + } + struct map_session_data *tsd = map->charid2sd(p->GID); + if (tsd == NULL) { + clif->adventurerAgencyResult(sd, AGENCY_MASTER_UNABLE_ACCEPT_REQUEST, "", ""); + return; + } + if (tsd->status.party_id == 0) { + clif->adventurerAgencyResult(sd, AGENCY_PARTY_NOT_FOUND, "", ""); + return; + } + + intif->request_agency_join_party(sd->status.char_id, tsd->status.party_id, sd->mapindex); +#endif +} + +static void clif_adventurerAgencyResult(struct map_session_data *sd, enum adventurer_agency_result result, const char *player_name, const char *party_name) +{ +#if PACKETVER_MAIN_NUM >= 20191218 || PACKETVER_RE_NUM >= 20191211 || PACKETVER_ZERO_NUM >= 20191224 + nullpo_retv(sd); + nullpo_retv(player_name); + nullpo_retv(party_name); + struct PACKET_ZC_ADVENTURER_AGENCY_JOIN_RESULT p = {}; + p.packetType = HEADER_ZC_ADVENTURER_AGENCY_JOIN_RESULT; + p.result = result; + safestrncpy(p.player_name, player_name, NAME_LENGTH); + safestrncpy(p.party_name, party_name, NAME_LENGTH); + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -27192,4 +27234,7 @@ void clif_defaults(void) clif->dynamicnpc_create_result = clif_dynamicnpc_create_result; clif->goldpc_info = clif_goldpc_info; + + clif->pAdventuterAgencyJoinReq = clif_parse_adventuterAgencyJoinReq; + clif->adventurerAgencyResult = clif_adventurerAgencyResult; } diff --git a/src/map/clif.h b/src/map/clif.h index c58b5233269..7f95078260a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1972,6 +1972,9 @@ struct clif_interface { void (*pDynamicnpcCreateRequest) (int fd, struct map_session_data *sd); void (*dynamicnpc_create_result) (struct map_session_data *sd, enum dynamicnpc_create_result result); void (*goldpc_info) (struct map_session_data *sd); + + void (*pAdventuterAgencyJoinReq) (int fd, struct map_session_data *sd); + void (*adventurerAgencyResult) (struct map_session_data *sd, enum adventurer_agency_result result, const char *player_name, const char *party_name); }; #ifdef HERCULES_CORE diff --git a/src/map/intif.c b/src/map/intif.c index 61b9fb7e804..229cbe52fdb 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -43,6 +43,8 @@ #include "map/storage.h" #include "map/achievement.h" +#include "common/charmappackets.h" +#include "common/mapcharpackets.h" #include "common/memmgr.h" #include "common/nullpo.h" #include "common/packets_struct.h" @@ -2678,6 +2680,27 @@ static void intif_parse_GetItemsAck(int fd) rodex->getItemsAck(sd, mail_id, opentype, count, &items[0]); } +static void intif_request_agency_join_party(int char_id, int party_id, int map_index) +{ + WFIFOHEAD(inter_fd, sizeof(struct PACKET_MAPCHAR_AGENCY_JOIN_PARTY_REQ)); + struct PACKET_MAPCHAR_AGENCY_JOIN_PARTY_REQ *p = WFIFOP(inter_fd, 0); + p->packetType = 0x3084; + p->char_id = char_id; + p->party_id = party_id; + p->map_index = map_index; + WFIFOSET(inter_fd, sizeof(struct PACKET_MAPCHAR_AGENCY_JOIN_PARTY_REQ)); +} + +static void intif_parse_agency_joinResult(int fd) +{ + const struct PACKET_CHARMAP_AGENCY_JOIN_PARTY *p = RFIFOP(fd, 0); + const int char_id = p->char_id; + const int result = p->result; + struct map_session_data *sd = map->charid2sd(char_id); + if (sd != NULL) + clif->adventurerAgencyResult(sd, result, "", ""); +} + //----------------------------------------------------------------- // Communication from the inter server // Return a 0 (false) if there were any errors. @@ -2785,6 +2808,8 @@ static int intif_parse(int fd) case 0x3899: intif->pGetZenyAck(fd); break; case 0x389a: intif->pGetItemsAck(fd); break; + case 0x389b: intif->pAgencyJoinResult(fd); break; + // Clan System case 0x3858: intif->pRecvClanMemberAction(fd); break; default: @@ -2803,6 +2828,19 @@ static int intif_parse(int fd) *-------------------------------------*/ void intif_defaults(void) { + const int packet_len_table [INTIF_PACKET_LEN_TABLE_SIZE] = { + 0, 0, 0, 0, -1,-1,37,-1, 7, 0, 0, 0, 0, 0, 0, 0, //0x3800-0x380f + -1, 0, 0, 0, 0, 0, 0, 0, -1,11, 0, 0, 0, 0, 0, 0, //0x3810 Achievements [Smokexyz/Hercules] + 39,-1,15,15, 14,19, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3820 + 10,-1,15, 0, 79,25, 7, 0, 0,-1,-1,-1, 14,67,186,-1, //0x3830 + -1, 0, 0,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840 + -1,-1, 7, 7, 7,11, 8, 0, 10, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] itembound[Akinari] Clan System[Murilo BiO] + -1, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] [Inkfish] + -1, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 3, 3, 0, //0x3870 Mercenaries [Zephyrus] / Elemental [pakpil] + 14,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880 + -1,-1, 7, 3, 0,-1, 7, 15,18 + NAME_LENGTH, 23, 16 + sizeof(struct rodex_item) * RODEX_MAX_ITEM, 10, 0, 0, 0, 0, //0x3890 Homunculus [albator] / RoDEX [KirieZ] + }; + intif = &intif_s; /* funcs */ @@ -2960,4 +2998,7 @@ void intif_defaults(void) intif->pRecvClanMemberAction = intif_parse_RecvClanMemberAction; /* Achievement System */ intif->pAchievementsLoad = intif_parse_achievements_load; + intif->request_agency_join_party = intif_request_agency_join_party; + + intif->pAgencyJoinResult = intif_parse_agency_joinResult; } diff --git a/src/map/intif.h b/src/map/intif.h index d7e5fc556ec..008b5efb941 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -207,6 +207,9 @@ struct intif_interface { void (*pRecvClanMemberAction) (int fd); /* Achievements */ void (*pAchievementsLoad) (int fd); + void (*request_agency_join_party) (int char_id, int party_id, int map_index); + + void (*pAgencyJoinResult) (int fd); }; #ifdef HERCULES_CORE diff --git a/src/map/packets.h b/src/map/packets.h index d75efbf3edb..6b3ec0e8b01 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2015,6 +2015,10 @@ packet(0x96e,clif->ackmergeitems); packet(0x0a6c,clif->pMacroReporterSelect); #endif +#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171214 + packet(0x0ae6,clif->pAdventuterAgencyJoinReq); +#endif + #if PACKETVER >= 20191224 packet(0x0b66,clif->pRepairItem2); #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 174b854877b..896ea2141ec 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -5932,6 +5932,26 @@ struct PACKET_ZC_GUILD_EMBLEM_IMG { DEFINE_PACKET_HEADER(ZC_GUILD_EMBLEM_IMG, 0x0152); #endif // PACKETVER_MAIN_NUM >= 20190821 || PACKETVER_RE_NUM >= 20190807 || PACKETVER_ZERO_NUM >= 20190710 +#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171214 +struct PACKET_CZ_ADVENTURER_AGENCY_JOIN_REQ { + int16 packetType; + int GID; + int AID; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_ADVENTURER_AGENCY_JOIN_REQ, 0x0ae6); +#endif // PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171214 + +#if PACKETVER_MAIN_NUM >= 20191218 || PACKETVER_RE_NUM >= 20191211 || PACKETVER_ZERO_NUM >= 20191224 +struct PACKET_ZC_ADVENTURER_AGENCY_JOIN_RESULT { + int16 packetType; + char player_name[NAME_LENGTH]; + char party_name[NAME_LENGTH]; + int AID; + int result; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ADVENTURER_AGENCY_JOIN_RESULT, 0x0afa); +#endif // PACKETVER_MAIN_NUM >= 20191218 || PACKETVER_RE_NUM >= 20191211 || PACKETVER_ZERO_NUM >= 20191224 + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/vcproj-16/api-server.vcxproj b/vcproj-16/api-server.vcxproj index da104d6c6cb..de011366092 100644 --- a/vcproj-16/api-server.vcxproj +++ b/vcproj-16/api-server.vcxproj @@ -160,6 +160,7 @@ + @@ -218,6 +219,7 @@ + diff --git a/vcproj-16/api-server.vcxproj.filters b/vcproj-16/api-server.vcxproj.filters index b5c1fc9c9ee..b06443f91a3 100644 --- a/vcproj-16/api-server.vcxproj.filters +++ b/vcproj-16/api-server.vcxproj.filters @@ -105,6 +105,9 @@ api + + + api 3rdparty\cJSON @@ -315,6 +318,9 @@ commom + + api + diff --git a/vcproj-16/char-server.vcxproj b/vcproj-16/char-server.vcxproj index cc0384604ac..da3b49fa9bf 100644 --- a/vcproj-16/char-server.vcxproj +++ b/vcproj-16/char-server.vcxproj @@ -139,6 +139,7 @@ + @@ -207,6 +208,7 @@ + diff --git a/vcproj-16/char-server.vcxproj.filters b/vcproj-16/char-server.vcxproj.filters index a5b933129cc..3b16fe892ab 100644 --- a/vcproj-16/char-server.vcxproj.filters +++ b/vcproj-16/char-server.vcxproj.filters @@ -154,6 +154,9 @@ char + + char + @@ -360,6 +363,9 @@ char + + char +