summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/init.c1
-rw-r--r--src/map/parse.c45
-rw-r--r--src/map/parse.h1
3 files changed, 45 insertions, 2 deletions
diff --git a/src/map/init.c b/src/map/init.c
index fa2371a..f1e7004 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -99,6 +99,7 @@ HPExport void plugin_init (void)
addPacket(0x7530, 22, map_parse_version, hpClif_Parse);
addPacket(0xb07, 26, map_parse_join_channel, hpClif_Parse);
+ addPacket(0xb09, 26, map_parse_part_channel, hpClif_Parse);
addHookPre("pc->readparam", epc_readparam_pre);
addHookPre("pc->setregistry", epc_setregistry);
addHookPre("pc->equipitem_pos", epc_equipitem_pos);
diff --git a/src/map/parse.c b/src/map/parse.c
index 7b7fbe7..a3fdc07 100644
--- a/src/map/parse.c
+++ b/src/map/parse.c
@@ -74,11 +74,11 @@ void map_parse_join_channel(int fd)
if (g->alliance[k].opposition == 0 && g->alliance[k].guild_id && (sg = guild->search(g->alliance[k].guild_id)))
{
if (!(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id)))
- clif->chsys_join(sg->channel,sd);
+ clif->chsys_join(sg->channel, sd);
}
}
}
- clif->chsys_join(channel,sd);
+ clif->chsys_join(channel, sd);
res = 1;
}
else
@@ -90,3 +90,44 @@ void map_parse_join_channel(int fd)
send_join_ack(fd, name, res);
}
+void map_parse_part_channel(int fd)
+{
+ char name[24];
+ char *p;
+ struct map_session_data* sd = (struct map_session_data*)session[fd]->session_data;
+ int k;
+ if (!sd)
+ return;
+
+ safestrncpy(name, RFIFOP(fd, 2), 24);
+ if (name[0] == '#')
+ p = name + 1;
+ else
+ p = name;
+
+ for (k = 0; k < sd->channel_count; k ++)
+ {
+ if (strcmpi(p, sd->channels[k]->name) == 0)
+ break;
+ }
+
+ if (sd->channels[k]->type == hChSys_ALLY)
+ {
+ do
+ {
+ for (k = 0; k < sd->channel_count; k++)
+ {
+ if (sd->channels[k]->type == hChSys_ALLY)
+ {
+ clif->chsys_left(sd->channels[k],sd);
+ break;
+ }
+ }
+ }
+ while (k != sd->channel_count);
+ }
+ else
+ {
+ clif->chsys_left(sd->channels[k],sd);
+ }
+}
diff --git a/src/map/parse.h b/src/map/parse.h
index 8d28c6a..dc5f020 100644
--- a/src/map/parse.h
+++ b/src/map/parse.h
@@ -6,5 +6,6 @@
void map_parse_version(int fd);
void map_parse_join_channel(int fd);
+void map_parse_part_channel(int fd);
#endif // EVOL_MAP_PARSE