From 53e5fbb299a72bbdab9859e948aca3b355afeb1a Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Sat, 27 Apr 2013 19:11:33 -0300 Subject: Introduced support for /guildinvite (present in 2012+ clients). Also merged both guild invite functions. Signed-off-by: Matheus Macabu --- src/map/clif.c | 47 +++++++++++++++++++++++++++++++++-------------- src/map/clif.h | 1 + src/map/packets.h | 1 + 3 files changed, 35 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 10c1a0d47..50ac5f06d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6698,7 +6698,8 @@ void clif_party_withdraw(struct party_data* p, struct map_session_data* sd, int if(!sd && (flag&0xf0)==0) { int i; - for(i=0;idata[i].sd;i++); + for(i=0;idata[i].sd;i++) + ; if (i < MAX_PARTY) sd = p->data[i].sd; } @@ -12432,30 +12433,47 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) guild_change_notice(sd, guild_id, msg1, msg2); } +// Helper function for guild invite functions +int +clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + if (t_sd == NULL) {// not online or does not exist + return 1; + } + + if (map[sd->bl.m].flag.guildlock) { //Guild locked. + clif->message(fd, msg_txt(228)); + return 1; + } + + if (t_sd && t_sd->state.noask) {// @noask [LuzZza] + clif->noask_sub(sd, t_sd, 2); + return 1; + } + + guild_invite(sd,t_sd); + return 0; +} /// Guild invite request (CZ_REQ_JOIN_GUILD). /// 0168 .L .L .L void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { - struct map_session_data *t_sd; + struct map_session_data *t_sd = map_id2sd(RFIFOL(fd,2)); - if(map[sd->bl.m].flag.guildlock) { //Guild locked. - clif->message(fd, msg_txt(228)); + if (clif_sub_guild_invite(fd, sd, t_sd)) return; - } - - t_sd = map_id2sd(RFIFOL(fd,2)); +} - // @noask [LuzZza] - if(t_sd && t_sd->state.noask) { - clif->noask_sub(sd, t_sd, 2); +/// Guild invite request (/guildinvite) (CZ_REQ_JOIN_GUILD2). +/// 0916 .24B +void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd = map_nick2sd((char *)RFIFOP(fd, 2)); + + if (clif_sub_guild_invite(fd, sd, t_sd)) return; - } - - guild_invite(sd,t_sd); } - /// Answer to guild invitation (CZ_JOIN_GUILD). /// 016b .L .L /// answer: @@ -17707,6 +17725,7 @@ void clif_defaults(void) { clif->pCashShopBuy = clif_parse_CashShopBuy; /* */ clif->pPartyTick = clif_parse_PartyTick; + clif->pGuildInvite2 = clif_parse_GuildInvite2; /* dull */ clif->pDull = clif_parse_dull; } diff --git a/src/map/clif.h b/src/map/clif.h index ae3fb9cd4..9dfa83e00 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1079,6 +1079,7 @@ struct clif_interface { void (*pCashShopSchedule) (int fd, struct map_session_data *sd); 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); } clif_s; struct clif_interface *clif; diff --git a/src/map/packets.h b/src/map/packets.h index c91028c13..edfa40c37 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1994,6 +1994,7 @@ packet(0x020d,-1); packet(0x0368,6,clif->pSolveCharName,2); packet(0x08E5,41,clif->pPartyBookingRegisterReq,2,4); packet(0x08d2,10); + packet(0x0916,26,clif->pGuildInvite2,2); #endif //2012-06-18aRagexeRE -- cgit v1.2.3-70-g09d2