diff options
author | shennetsind <ind@henn.et> | 2013-06-08 22:43:11 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-06-08 22:43:11 -0300 |
commit | 4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72 (patch) | |
tree | 73fe91762e3115e2a8a01675c0235fb2567225b8 /src/map | |
parent | cab0a3a6bfb0c7c7e4d108beb18050854af98753 (diff) | |
download | hercules-4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72.tar.gz hercules-4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72.tar.bz2 hercules-4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72.tar.xz hercules-4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72.zip |
mkbu95's Party Recruit Update
There are still some features as blocklist and volunteer that were not worked on due to some lack of information.
Special Thanks to mkbu95, Spira and Yommy
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 337 | ||||
-rw-r--r-- | src/map/clif.h | 16 | ||||
-rw-r--r-- | src/map/packets.h | 41 | ||||
-rw-r--r-- | src/map/party.c | 48 | ||||
-rw-r--r-- | src/map/party.h | 23 |
5 files changed, 454 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 44311ed5a..6e4cae5c6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12115,7 +12115,7 @@ void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) party->changeleader(sd, iMap->id2sd(RFIFOL(fd,2))); } - +#ifndef PARTY_RECRUIT /// Party Booking in KRO [Spiria] /// @@ -12185,7 +12185,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, pb_ad = results[i]; WFIFOL(fd,i*size+5) = pb_ad->index; memcpy(WFIFOP(fd,i*size+9),pb_ad->charname,NAME_LENGTH); - WFIFOL(fd,i*size+33) = pb_ad->starttime; // FIXME: This is expire time + WFIFOL(fd,i*size+33) = pb_ad->expiretime; WFIFOW(fd,i*size+37) = pb_ad->p_detail.level; WFIFOW(fd,i*size+39) = pb_ad->p_detail.mapid; for(j=0; j<PARTY_BOOKING_JOBS; j++) @@ -12248,7 +12248,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo WBUFW(buf,0) = 0x809; WBUFL(buf,2) = pb_ad->index; memcpy(WBUFP(buf,6),pb_ad->charname,NAME_LENGTH); - WBUFL(buf,30) = pb_ad->starttime; // FIXME: This is expire time + WBUFL(buf,30) = pb_ad->expiretime; WBUFW(buf,34) = pb_ad->p_detail.level; WBUFW(buf,36) = pb_ad->p_detail.mapid; for(i=0; i<PARTY_BOOKING_JOBS; i++) @@ -12287,6 +12287,320 @@ void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) clif->send(buf, packet_len(0x80b), &sd->bl, ALL_CLIENT); // Now UPDATE all client. } +#else +/// Modified version of Party Booking System for 2012-04-10 or 2012-04-18 (RagexeRE). +/// Code written by mkbu95, Spiria, Yommy and Ind + +/// Request to register a party booking advertisment (CZ_PARTY_RECRUIT_REQ_REGISTER). +/// 08e5 <level>.W <notice>.37B +void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) +{ + short level = RFIFOW(fd,2); + const char *notice = (const char*)RFIFOP(fd, 4); + + party->booking_register(sd, level, notice); +} + +/// Party booking search results (ZC_PARTY_RECRUIT_ACK_SEARCH). +/// 08e8 <packet len>.W <more results>.B { <index>.L <char name>.24B <expire time>.L <level>.W <notice>.37B }* +/// more results: +/// 0 = no +/// 1 = yes +void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results, int count, bool more_result) +{ + int i; + int size = sizeof(struct party_booking_ad_info); + struct party_booking_ad_info *pb_ad; + + WFIFOHEAD(fd, (size * count) + 5); + WFIFOW(fd, 0) = 0x8e8; + WFIFOW(fd, 2) = (size * count) + 5; + WFIFOB(fd, 4) = more_result; + + for (i = 0; i < count; ++i) { + pb_ad = results[i]; + + WFIFOL(fd, (i * size) + 5) = pb_ad->index; + WFIFOL(fd, (i * size) + 9) = pb_ad->expiretime; + memcpy(WFIFOP(fd, (i * size) + 13), pb_ad->charname, NAME_LENGTH); + WFIFOW(fd, (i * size) + 13 + NAME_LENGTH) = pb_ad->p_detail.level; + memcpy(WFIFOP(fd, (i * size) + 13 + NAME_LENGTH + 2), pb_ad->p_detail.notice, PB_NOTICE_LENGTH); + } + + WFIFOSET(fd,WFIFOW(fd,2)); +} + +/// Result of request to register a party booking advertisment (ZC_PARTY_RECRUIT_ACK_REGISTER). +/// 08e6 <result>.W +/// result: +/// 0 = success +/// 1 = failure +/// 2 = already registered +void clif_PartyBookingRegisterAck(struct map_session_data *sd, int flag) +{ + int fd = sd->fd; + + WFIFOHEAD(fd, packet_len(0x8e6)); + WFIFOW(fd, 0) = 0x8e6; + WFIFOW(fd, 2) = flag; + WFIFOSET(fd, packet_len(0x8e6)); +} + +/// Request to search for party booking advertisments (CZ_PARTY_RECRUIT_REQ_SEARCH). +/// 08e7 <level>.W <map id>.W <last index>.L <result count>.W +void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd) +{ + short level = RFIFOW(fd, 2); + short mapid = RFIFOW(fd, 4); + unsigned long lastindex = RFIFOL(fd, 6); + short resultcount = RFIFOW(fd, 10); + + party->booking_search(sd, level, mapid, lastindex, resultcount); +} + +/// Request to delete own party booking advertisment (CZ_PARTY_RECRUIT_REQ_DELETE). +/// 08e9 +void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd) +{ + if(party->booking_delete(sd)) + clif->PartyBookingDeleteAck(sd, 0); +} + +/// Result of request to delete own party booking advertisment (ZC_PARTY_RECRUIT_ACK_DELETE). +/// 08ea <result>.W +/// result: +/// 0 = success +/// 1 = success (auto-removed expired ad) +/// 2 = failure +/// 3 = nothing registered +void clif_PartyBookingDeleteAck(struct map_session_data* sd, int flag) +{ + int fd = sd->fd; + + WFIFOHEAD(fd, packet_len(0x8ea)); + WFIFOW(fd, 0) = 0x8ea; + WFIFOW(fd, 2) = flag; + WFIFOSET(fd, packet_len(0x8ea)); +} + +/// Request to update party booking advertisment (CZ_PARTY_RECRUIT_REQ_UPDATE). +/// 08eb <notice>.37B +void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data *sd) +{ + const char *notice; + + notice = (const char*)RFIFOP(fd, 2); + + party->booking_update(sd, notice); +} + +/// Notification about new party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_INSERT). +/// 08ec <index>.L <expire time>.L <char name>.24B <level>.W <notice>.37B +void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_booking_ad_info* pb_ad) +{ + unsigned char buf[2+6+6+24+4+37+1]; + + if (pb_ad == NULL) + return; + + WBUFW(buf, 0) = 0x8ec; + WBUFL(buf, 2) = pb_ad->index; + WBUFL(buf, 6) = pb_ad->expiretime; + memcpy(WBUFP(buf, 10), pb_ad->charname, NAME_LENGTH); + WBUFW(buf,34) = pb_ad->p_detail.level; + memcpy(WBUFP(buf, 36), pb_ad->p_detail.notice, PB_NOTICE_LENGTH); + clif->send(buf, packet_len(0x8ec), &sd->bl, ALL_CLIENT); +} + +/// Notification about updated party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_UPDATE). +/// 08ed <index>.L <notice>.37B +void clif_PartyBookingUpdateNotify(struct map_session_data *sd, struct party_booking_ad_info* pb_ad) +{ + unsigned char buf[2+6+37+1]; + + WBUFW(buf, 0) = 0x8ed; + WBUFL(buf, 2) = pb_ad->index; + memcpy(WBUFP(buf, 6), pb_ad->p_detail.notice, PB_NOTICE_LENGTH); + + clif->send(buf, packet_len(0x8ed), &sd->bl, ALL_CLIENT); +} + +/// Notification about deleted party booking advertisment (ZC_PARTY_RECRUIT_NOTIFY_DELETE). +/// 08ee <index>.L +void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) +{ + unsigned char buf[2+6+1]; + + WBUFW(buf, 0) = 0x8ee; + WBUFL(buf, 2) = index; + + clif->send(buf, packet_len(0x8ee), &sd->bl, ALL_CLIENT); +} + +/// Request to add to filtering list (PARTY_RECRUIT_ADD_FILTERLINGLIST). +/// 08ef <index>.L +void clif_parse_PartyBookingAddFilteringList(int fd, struct map_session_data *sd) +{ + int index = RFIFOL(fd, 2); + + clif->PartyBookingAddFilteringList(index, sd); +} + +/// Request to remove from filtering list (PARTY_RECRUIT_SUB_FILTERLINGLIST). +/// 08f0 <GID>.L +void clif_parse_PartyBookingSubFilteringList(int fd, struct map_session_data *sd) +{ + int gid = RFIFOL(fd, 2); + + clif->PartyBookingSubFilteringList(gid, sd); +} + +/// Request to recruit volunteer (PARTY_RECRUIT_REQ_VOLUNTEER). +/// 08f1 <index>.L +void clif_parse_PartyBookingReqVolunteer(int fd, struct map_session_data *sd) +{ + int index = RFIFOL(fd, 2); + clif->PartyBookingVolunteerInfo(index, sd); +} + +/// Request volunteer information (PARTY_RECRUIT_VOLUNTEER_INFO). +/// 08f2 <AID>.L <job>.L <level>.W <char name>.24B +void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd) +{ + unsigned char buf[2+4+4+2+24+1]; + + //sd->pb_index = index; + + WBUFW(buf, 0) = 0x8f2; + WBUFL(buf, 2) = sd->status.account_id; + WBUFL(buf, 6) = sd->status.class_; + WBUFW(buf, 10) = sd->status.base_level; + memcpy(WBUFP(buf, 12), sd->status.name, NAME_LENGTH); + + clif->send(buf, packet_len(0x8f2), &sd->bl, ALL_CLIENT); +} + +#if 0 //Disabled for now. Needs more info. +/// 08f3 <packet type>.W <cost>.L +void clif_PartyBookingPersonalSetting(int fd, struct map_session_data *sd) +{ +} + +/// 08f4 <target GID>.L +void clif_parse_PartyBookingShowEquipment(int fd, struct map_session_data *sd) +{ +} + +/// 08f5 <packet len>.W +void clif_parse_PartyBookingReqRecall(int fd, struct map_session_data *sd) +{ +} + +/// 08f6 <money>.L <map name>.16B +void clif_PartyBookingRecallCost(int fd, struct map_session_data *sd) { +} + +/// 08f7 <result>.B +void clif_parse_PartyBookingAckRecall(int fd, struct map_session_data *sd) { +} + +/// 08f8 <caller AID>.L <reason>.B +/// <reason>: +/// REASON_PROHIBITION = 0x0 +/// REASON_MASTER_IN_PROHIBITION_MAP = 0x1 +/// REASON_REFUSE = 0x2 +/// REASON_NOT_PARTY_MEMBER = 0x3 +/// REASON_ETC = 0x4 +void clif_PartyBookingFailedRecall(int fd, struct map_session_data *sd) +{ +} +#endif //if 0 + +/// 08f9 <refuse AID>.L +void clif_parse_PartyBookingRefuseVolunteer(int fd, struct map_session_data *sd) +{ + unsigned long aid = RFIFOL(fd, 2); + + clif->PartyBookingRefuseVolunteer(aid, sd); +} + +/// 08fa <index>.L +void clif_PartyBookingRefuseVolunteer(unsigned long aid, struct map_session_data *sd) +{ + unsigned char buf[2+6]; + + //handle + //if (aid != sd->status.account_id) + // ; + + WBUFW(buf, 0) = 0x8fa; + WBUFL(buf, 2) = aid;//sd->pb_index; + + clif->send(buf, packet_len(0x8fa), &sd->bl, ALL_CLIENT); +} + +/// 08fb <index>.L +void clif_parse_PartyBookingCancelVolunteer(int fd, struct map_session_data *sd) +{ + int index = RFIFOL(fd, 2); + + clif->PartyBookingCancelVolunteer(index, sd); +} + +/// 0909 <index>.L +void clif_PartyBookingCancelVolunteer(int index, struct map_session_data *sd) +{ + unsigned char buf[2+6+1]; + + WBUFW(buf, 0) = 0x909; + WBUFL(buf, 2) = index; + + clif->send(buf, packet_len(0x909), &sd->bl, ALL_CLIENT); +} + +/// 090b <gid>.L <char name>.24B +void clif_PartyBookingAddFilteringList(int index, struct map_session_data *sd) +{ + unsigned char buf[2+6+24+1]; + + //sd->pb_index = index; + + WBUFW(buf, 0) = 0x90b; + WBUFL(buf, 2) = sd->bl.id; + memcpy(WBUFP(buf, 6), sd->status.name, NAME_LENGTH); + + clif->send(buf, packet_len(0x90b), &sd->bl, ALL_CLIENT); +} + +/// 090c <gid>.L <char name>.24B +void clif_PartyBookingSubFilteringList(int gid, struct map_session_data *sd) +{ + //struct map_session_data *ssd = mapid2sd(gid); + unsigned char buf[2+6+24+1]; + + WBUFW(buf, 0) = 0x90c; + WBUFL(buf, 2) = gid; + memcpy(WBUFP(buf, 6), sd->status.name, NAME_LENGTH); + + clif->send(buf, packet_len(0x90c), &sd->bl, ALL_CLIENT); +} + +#if 0 +/// 091c <aid>.L +void clif_PartyBookingCancelVolunteerToPM(struct map_session_data *sd) +{ + /* this+0x0 */ short PacketType; + /* this+0x2 */ unsigned long AID; +} + +/// 0971 <pm_aid>.L +void clif_PartyBookingRefuseVolunteerToPM(struct map_session_data *sd) +{ + /* this+0x0 */ short PacketType; + /* this+0x2 */ unsigned long PM_AID; +} +#endif //if 0 +#endif /// Request to close own vending (CZ_REQ_CLOSESTORE). /// 012e @@ -17131,6 +17445,7 @@ int clif_parse(int fd) { return 0; cmd = RFIFOW(fd,0); + // filter out invalid / unsupported packets if (cmd > MAX_PACKET_DB || packet_db[cmd].len == 0) { ShowWarning("clif_parse: Received unsupported packet (packet 0x%04x, %d bytes received), disconnecting session #%d.\n", cmd, RFIFOREST(fd), fd); @@ -17733,6 +18048,14 @@ void clif_defaults(void) { clif->PartyBookingUpdateNotify = clif_PartyBookingUpdateNotify; clif->PartyBookingDeleteNotify = clif_PartyBookingDeleteNotify; clif->PartyBookingInsertNotify = clif_PartyBookingInsertNotify; + /* Group Search System Update */ +#ifdef PARTY_RECRUIT + clif->PartyBookingVolunteerInfo = clif_PartyBookingVolunteerInfo; + clif->PartyBookingRefuseVolunteer = clif_PartyBookingRefuseVolunteer; + clif->PartyBookingCancelVolunteer = clif_PartyBookingCancelVolunteer; + clif->PartyBookingAddFilteringList = clif_PartyBookingAddFilteringList; + clif->PartyBookingSubFilteringList = clif_PartyBookingSubFilteringList; +#endif /* buying store-related */ clif->buyingstore_open = clif_buyingstore_open; clif->buyingstore_open_failed = clif_buyingstore_open_failed; @@ -17994,6 +18317,14 @@ void clif_defaults(void) { /* */ clif->pPartyTick = clif_parse_PartyTick; clif->pGuildInvite2 = clif_parse_GuildInvite2; + /* Group Search System Update */ +#ifdef PARTY_RECRUIT + clif->pPartyBookingAddFilter = clif_parse_PartyBookingAddFilteringList; + clif->pPartyBookingSubFilter = clif_parse_PartyBookingSubFilteringList; + clif->pPartyBookingReqVolunteer = clif_parse_PartyBookingReqVolunteer; + clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; + clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; +#endif /* dull */ clif->pDull = clif_parse_dull; } diff --git a/src/map/clif.h b/src/map/clif.h index 72466af81..5393ef5b7 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -867,6 +867,14 @@ struct clif_interface { void (*PartyBookingUpdateNotify) (struct map_session_data* sd, struct party_booking_ad_info* pb_ad); void (*PartyBookingDeleteNotify) (struct map_session_data* sd, int index); void (*PartyBookingInsertNotify) (struct map_session_data* sd, struct party_booking_ad_info* pb_ad); + /* Group Search System Update */ +#ifdef PARTY_RECRUIT + void (*PartyBookingVolunteerInfo) (int index, struct map_session_data *sd); + void (*PartyBookingRefuseVolunteer) (unsigned long aid, struct map_session_data *sd); + void (*PartyBookingCancelVolunteer) (int index, struct map_session_data *sd); + void (*PartyBookingAddFilteringList) (int index, struct map_session_data *sd); + void (*PartyBookingSubFilteringList) (int gid, struct map_session_data *sd); +#endif /* buying store-related */ void (*buyingstore_open) (struct map_session_data* sd); void (*buyingstore_open_failed) (struct map_session_data* sd, unsigned short result, unsigned int weight); @@ -1126,6 +1134,14 @@ struct clif_interface { void (*pCashShopBuy) (int fd, struct map_session_data *sd); void (*pPartyTick) (int fd, struct map_session_data *sd); void (*pGuildInvite2) (int fd, struct map_session_data *sd); + /* Group Search System Update */ +#ifdef PARTY_RECRUIT + void (*pPartyBookingAddFilter) (int fd, struct map_session_data *sd); + void (*pPartyBookingSubFilter) (int fd, struct map_session_data *sd); + void (*pPartyBookingReqVolunteer) (int fd, struct map_session_data *sd); + void (*pPartyBookingRefuseVolunteer) (int fd, struct map_session_data *sd); + void (*pPartyBookingCancelVolunteer) (int fd, struct map_session_data *sd); +#endif } clif_s; struct clif_interface *clif; diff --git a/src/map/packets.h b/src/map/packets.h index 5d07f7f9e..0c68a407b 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1922,7 +1922,7 @@ packet(0x020d,-1); packet(0x0885,7,clif->pActionRequest,2,6); packet(0x0889,10,clif->pUseSkillToId,2,4,6); packet(0x0870,-1,clif->pItemListWindowSelected,2,4,8); - packet(0x0926,18,clif->pPartyBookingRegisterReq,2,4,6); + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4,6); packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); packet(0x0817,2,clif->pReqCloseBuyingStore,0); packet(0x0360,6,clif->pReqClickBuyingStore,2); @@ -1974,9 +1974,11 @@ packet(0x020d,-1); packet(0x08EC,73); packet(0x08ED,43); packet(0x08EE,6); +#ifdef PARTY_RECRUIT packet(0x08EF,6,clif->pDull,2); //bookingignorereq - packet(0x08F0,6); + packet(0x08F0,6,clif->pDull,2); packet(0x08F1,6,clif->pDull,2); //bookingjoinpartyreq +#endif packet(0x08F2,36); packet(0x08F3,-1); packet(0x08F4,6); @@ -1985,6 +1987,9 @@ packet(0x020d,-1); packet(0x08F7,3); packet(0x08F8,7); packet(0x08F9,6); +#ifdef PARTY_RECRUIT + packet(0x08F9,6,clif->pDull,2); +#endif packet(0x08FA,6); packet(0x08FB,6,clif->pDull,2); //bookingcanceljoinparty packet(0x0907,5,clif->pMoveItem,2,4); @@ -2159,4 +2164,36 @@ packet(0x020d,-1); // Shuffle End #endif +#if PACKETVER >= 20130529 + packet(0x0890,7,clif->pActionRequest,2,6); + packet(0x0438,10,clif->pUseSkillToId,2,4,6); + packet(0x0876,5,clif->pWalkToXY,2); + packet(0x0897,6,clif->pTickSend,2); + packet(0x0951,5,clif->pChangeDir,2,4); + packet(0x0895,6,clif->pTakeItem,2); + packet(0x08A7,6,clif->pDropItem,2,4); + packet(0x0938,8,clif->pMoveToKafra,2,4); + packet(0x0957,8,clif->pMoveFromKafra,2,4); + packet(0x0917,10,clif->pUseSkillToPos,2,4,6,8); + packet(0x085E,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); + packet(0x0863,6,clif->pGetCharNameRequest,2); + packet(0x0937,6,clif->pSolveCharName,2); + packet(0x085A,12,clif->pSearchStoreInfoListItemClick,2,6,10); + packet(0x0941,2,clif->pSearchStoreInfoNextPage,0); + packet(0x0918,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); + packet(0x0936,-1,clif->pReqTradeBuyingStore,2,4,8,12); + packet(0x0892,6,clif->pReqClickBuyingStore,2); + packet(0x0964,2,clif->pReqCloseBuyingStore,0); + packet(0x0869,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); + packet(0x0874,41,clif->pPartyBookingRegisterReq,2,4); + // packet(0x088E,8); // CZ_JOIN_BATTLE_FIELD + packet(0x0958,-1,clif->pItemListWindowSelected,2,4,8); + packet(0x0919,19,clif->pWantToConnection,2,6,10,14,18); + packet(0x08A8,26,clif->pPartyInvite2,2); + // packet(0x0888,4); // CZ_GANGSI_RANK + packet(0x0877,26,clif->pFriendsListAdd,2); + packet(0x023B,5,clif->pHomMenu,2,4); + packet(0x0956,36,clif->pStoragePassword,0); +#endif + #endif /* _PACKETS_H_ */ diff --git a/src/map/party.c b/src/map/party.c index 91d6188a9..e30d16c07 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -1110,10 +1110,16 @@ static struct party_booking_ad_info* create_party_booking_data(void) return pb_ad; } +#ifndef PARTY_RECRUIT void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job) +#else +void party_booking_register(struct map_session_data *sd, short level, const char *notice) +#endif { struct party_booking_ad_info *pb_ad; - int i; +#ifndef PARTY_RECRUIT + int i; +#endif pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); @@ -1129,22 +1135,32 @@ void party_booking_register(struct map_session_data *sd, short level, short mapi } memcpy(pb_ad->charname,sd->status.name,NAME_LENGTH); - pb_ad->starttime = (int)time(NULL); - pb_ad->p_detail.level = level; + pb_ad->expiretime = (int)time(NULL); + pb_ad->p_detail.level = level; +#ifndef PARTY_RECRUIT pb_ad->p_detail.mapid = mapid; for(i=0;i<PARTY_BOOKING_JOBS;i++) if(job[i] != 0xFF) pb_ad->p_detail.job[i] = job[i]; else pb_ad->p_detail.job[i] = -1; +#else + safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH); +#endif clif->PartyBookingRegisterAck(sd, 0); clif->PartyBookingInsertNotify(sd, pb_ad); // Notice } +#ifndef PARTY_RECRUIT void party_booking_update(struct map_session_data *sd, short* job) +#else +void party_booking_update(struct map_session_data *sd, const char *notice) +#endif { +#ifndef PARTY_RECRUIT int i; +#endif struct party_booking_ad_info *pb_ad; pb_ad = (struct party_booking_ad_info*)idb_get(party_booking_db, sd->status.char_id); @@ -1152,20 +1168,33 @@ void party_booking_update(struct map_session_data *sd, short* job) if( pb_ad == NULL ) return; - pb_ad->starttime = (int)time(NULL);// Update time. + pb_ad->expiretime = (int)time(NULL);// Update time. +#ifndef PARTY_RECRUIT for(i=0;i<PARTY_BOOKING_JOBS;i++) if(job[i] != 0xFF) pb_ad->p_detail.job[i] = job[i]; else pb_ad->p_detail.job[i] = -1; +#else + if (notice != NULL) { + safestrncpy(pb_ad->p_detail.notice, notice, PB_NOTICE_LENGTH); + } +#endif clif->PartyBookingUpdateNotify(sd, pb_ad); } +#ifndef PARTY_RECRUIT void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount) +#else +void party_booking_search(struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount) +#endif { struct party_booking_ad_info *pb_ad; - int i, count=0; +#ifndef PARTY_RECRUIT + int i; +#endif + int count = 0; struct party_booking_ad_info* result_list[PARTY_BOOKING_RESULTS]; bool more_result = false; DBIterator* iter = db_iterator(party_booking_db); @@ -1174,12 +1203,18 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, for( pb_ad = dbi_first(iter); dbi_exists(iter); pb_ad = dbi_next(iter) ) { +#ifndef PARTY_RECRUIT if (pb_ad->index < lastindex || (level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level))) continue; +#else + if ((level && (pb_ad->p_detail.level < level-15 || pb_ad->p_detail.level > level))) + continue; +#endif if (count >= PARTY_BOOKING_RESULTS){ more_result = true; break; } +#ifndef PARTY_RECRUIT if (mapid == 0 && job == -1) result_list[count] = pb_ad; else if (mapid == 0) { @@ -1190,6 +1225,9 @@ void party_booking_search(struct map_session_data *sd, short level, short mapid, if (pb_ad->p_detail.mapid == mapid) result_list[count] = pb_ad; } +#else + result_list[count] = pb_ad; +#endif if( result_list[count] ) { count++; diff --git a/src/map/party.h b/src/map/party.h index 79d47105f..5ebf7b357 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -33,6 +33,7 @@ struct party_data { } state; }; +#ifndef PARTY_RECRUIT struct party_booking_detail { short level; short mapid; @@ -42,9 +43,23 @@ struct party_booking_detail { struct party_booking_ad_info { unsigned long index; char charname[NAME_LENGTH]; - long starttime; + long expiretime; struct party_booking_detail p_detail; }; +#else +#define PB_NOTICE_LENGTH (36 + 1) +struct party_booking_detail { + short level; + char notice[PB_NOTICE_LENGTH]; +}; + +struct party_booking_ad_info { + unsigned long index; + long expiretime; + char charname[NAME_LENGTH]; + struct party_booking_detail p_detail; +}; +#endif int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range,...); @@ -97,9 +112,15 @@ struct party_interface { int (*share_loot) (struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid); int (*send_dot_remove) (struct map_session_data *sd); int (*sub_count) (struct block_list *bl, va_list ap); +#ifndef PARTY_RECRUIT void (*booking_register) (struct map_session_data *sd, short level, short mapid, short* job); void (*booking_update) (struct map_session_data *sd, short* job); void (*booking_search) (struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount); +#else + void (*booking_register) (struct map_session_data *sd, short level, const char *notice); + void (*booking_update) (struct map_session_data *sd, const char *notice); + void (*booking_search) (struct map_session_data *sd, short level, short mapid, unsigned long lastindex, short resultcount); +#endif bool (*booking_delete) (struct map_session_data *sd); } party_s; |