diff options
author | Matheus Macabu <mkbu95@gmail.com> | 2013-04-27 19:11:33 -0300 |
---|---|---|
committer | Matheus Macabu <mkbu95@gmail.com> | 2013-04-27 19:11:36 -0300 |
commit | 53e5fbb299a72bbdab9859e948aca3b355afeb1a (patch) | |
tree | 5019039ed2bef50a2d9dc89eb647444bce7903f7 /src | |
parent | 219a4f5267b33349649f952266532a132a48c2a3 (diff) | |
download | hercules-53e5fbb299a72bbdab9859e948aca3b355afeb1a.tar.gz hercules-53e5fbb299a72bbdab9859e948aca3b355afeb1a.tar.bz2 hercules-53e5fbb299a72bbdab9859e948aca3b355afeb1a.tar.xz hercules-53e5fbb299a72bbdab9859e948aca3b355afeb1a.zip |
Introduced support for /guildinvite (present in 2012+ clients). Also merged both guild invite functions.
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 47 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/packets.h | 1 |
3 files changed, 35 insertions, 14 deletions
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;i<MAX_PARTY && !p->data[i].sd;i++); + for(i=0;i<MAX_PARTY && !p->data[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 <account id>.L <inviter account id>.L <inviter char id>.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 <char name>.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 <guild id>.L <answer>.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 |