summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-05-02 17:15:10 -0300
committershennetsind <ind@henn.et>2013-05-02 17:15:10 -0300
commit4dbe6ac4e8ae91249848777b2127049318107c4c (patch)
treec8d0a098bd3073ee3caeec69c0c0be9386e9274d /src/map/clif.c
parenta2c45a8db6d724b98ab41fe9e75e1f7ea7523d5d (diff)
parent58a035a53efcafea1623999832a764fabba1bf5f (diff)
downloadhercules-4dbe6ac4e8ae91249848777b2127049318107c4c.tar.gz
hercules-4dbe6ac4e8ae91249848777b2127049318107c4c.tar.bz2
hercules-4dbe6ac4e8ae91249848777b2127049318107c4c.tar.xz
hercules-4dbe6ac4e8ae91249848777b2127049318107c4c.zip
Merge branch 'master' of https://github.com/HerculesWS/Hercules
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 160de3adc..fcd63b2eb 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6687,7 +6687,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;
}
@@ -12421,30 +12422,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:
@@ -17697,6 +17715,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;
}