summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-06-08 22:43:11 -0300
committershennetsind <ind@henn.et>2013-06-08 22:43:11 -0300
commit4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72 (patch)
tree73fe91762e3115e2a8a01675c0235fb2567225b8 /src/map/clif.c
parentcab0a3a6bfb0c7c7e4d108beb18050854af98753 (diff)
downloadhercules-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/clif.c')
-rw-r--r--src/map/clif.c337
1 files changed, 334 insertions, 3 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;
}