summaryrefslogtreecommitdiff
path: root/src/map/guild.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-15 01:44:58 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-25 01:43:47 +0300
commitccf79c7d339dcfb1b95b1adbff5f26d80c013d16 (patch)
treeb47e25f3bcc5ed69048ffdfa744c2fd5fe5ca0c2 /src/map/guild.c
parent4d11bf44c8c481045ce496669830b1990deca464 (diff)
downloadhercules-ccf79c7d339dcfb1b95b1adbff5f26d80c013d16.tar.gz
hercules-ccf79c7d339dcfb1b95b1adbff5f26d80c013d16.tar.bz2
hercules-ccf79c7d339dcfb1b95b1adbff5f26d80c013d16.tar.xz
hercules-ccf79c7d339dcfb1b95b1adbff5f26d80c013d16.zip
fix guild leader change in 2017 clients. Based on rathena commit:
commit b51617cb730cdc6d91bc03df16c887a060323f3a Author: Lemongrass3110 <lemongrass@kstp.at> Date: Sat Jun 3 17:03:56 2017 +0200 Added support for 2017's guild leader change
Diffstat (limited to 'src/map/guild.c')
-rw-r--r--src/map/guild.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/map/guild.c b/src/map/guild.c
index 6e5b1c539..838df3943 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1814,23 +1814,28 @@ int guild_broken(int guild_id,int flag)
}
//Changes the Guild Master to the specified player. [Skotlex]
-int guild_gm_change(int guild_id, struct map_session_data *sd)
+int guild_gm_change(int guild_id, int char_id)
{
- struct guild *g;
- nullpo_ret(sd);
+ struct guild *g = guild->search(guild_id);
+ char *name;
+ int i;
- if (sd->status.guild_id != guild_id)
- return 0;
+ nullpo_ret(g);
- g=guild->search(guild_id);
+ ARR_FIND(0, MAX_GUILD, i, g->member[i].char_id == char_id);
+
+ if (i == MAX_GUILD ) {
+ // Not part of the guild
+ return 0;
+ }
- nullpo_ret(g);
+ name = g->member[i].name;
- if (strcmp(g->master, sd->status.name) == 0) //Nothing to change.
+ if (strcmp(g->master, name) == 0) //Nothing to change.
return 0;
//Notify servers that master has changed.
- intif->guild_change_gm(guild_id, sd->status.name, (int)strlen(sd->status.name)+1);
+ intif->guild_change_gm(guild_id, name, (int)strlen(name) + 1);
return 1;
}
@@ -1864,6 +1869,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
if (g->member[pos].sd && g->member[pos].sd->fd) {
clif->message(g->member[pos].sd->fd, msg_sd(g->member[pos].sd,878)); //"You no longer are the Guild Master."
g->member[pos].sd->state.gmaster_flag = 0;
+ clif->charnameack(0, &g->member[pos].sd->bl);
}
if (g->member[0].sd && g->member[0].sd->fd) {
@@ -1871,6 +1877,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
g->member[0].sd->state.gmaster_flag = 1;
//Block his skills for 5 minutes to prevent abuse.
guild->block_skill(g->member[0].sd, 300000);
+ clif->charnameack(0, &g->member[pos].sd->bl);
}
// announce the change to all guild members
@@ -1880,6 +1887,7 @@ int guild_gm_changed(int guild_id, int account_id, int char_id)
{
clif->guild_basicinfo(g->member[i].sd);
clif->guild_memberlist(g->member[i].sd);
+ clif->guild_belonginfo(g->member[i].sd, g); // Update clientside guildmaster flag
}
}