diff options
author | Andrei Karas <akaras@inbox.ru> | 2010-10-02 01:04:21 +0000 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-10-02 19:20:22 -0400 |
commit | ba5d9bec7ce5330062481643905a6fd60126002c (patch) | |
tree | 623f63fb42924818a29b699c959a626b4a7696e4 | |
parent | 6ccc96ebaf8b7daf141febcd1d6e5266191bb41b (diff) | |
download | tmwa-ba5d9bec7ce5330062481643905a6fd60126002c.tar.gz tmwa-ba5d9bec7ce5330062481643905a6fd60126002c.tar.bz2 tmwa-ba5d9bec7ce5330062481643905a6fd60126002c.tar.xz tmwa-ba5d9bec7ce5330062481643905a6fd60126002c.zip |
Limit most guild actions to Guild Master position.
Also allow change guild positions to guild owner even without Guild Master position.
Signed-off-by: Chuck Miller <shadowmil@gmail.com>
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/guild.c | 49 |
2 files changed, 71 insertions, 4 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 32340f9..205c222 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8647,7 +8647,19 @@ void clif_parse_GuildReqeustInfo (int fd, struct map_session_data *sd) */ void clif_parse_GuildChangePositionInfo (int fd, struct map_session_data *sd) { - int i; + struct guild *g; + int i, ps; + + nullpo_retv (sd); + + g = guild_search (sd->status.guild_id); + + if (g == NULL) + return; + + if ((ps = guild_getposition (sd, g)) < 0 + || (!(g->position[ps].mode & 0x0010) && strcmp (g->master, sd->status.name))) + return; for (i = 4; i < RFIFOW (fd, 2); i += 40) { @@ -8663,10 +8675,20 @@ void clif_parse_GuildChangePositionInfo (int fd, struct map_session_data *sd) void clif_parse_GuildChangeMemberPosition (int fd, struct map_session_data *sd) { - int i; + struct guild *g; + int i, ps; nullpo_retv (sd); + g = guild_search (sd->status.guild_id); + + if (g == NULL) + return; + + if ((ps = guild_getposition (sd, g)) < 0 + || (!(g->position[ps].mode & 0x0010) && strcmp (g->master, sd->status.name))) + return; + for (i = 4; i < RFIFOW (fd, 2); i += 12) { guild_change_memberposition (sd->status.guild_id, diff --git a/src/map/guild.c b/src/map/guild.c index 36b3e0f..63c94bf 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -966,10 +966,23 @@ int guild_position_changed (int guild_id, int idx, struct guild_position *p) int guild_change_notice (struct map_session_data *sd, int guild_id, const char *mes1, const char *mes2) { + struct guild *g; + int ps; + nullpo_retr (0, sd); + g = guild_search (sd->status.guild_id); + + if (g == NULL) + return 0; + + if ((ps = guild_getposition (sd, g)) < 0 + || !(g->position[ps].mode & 0x0010)) + return 0; + if (guild_id != sd->status.guild_id) return 0; + return intif_guild_notice (guild_id, mes1, mes2); } @@ -997,8 +1010,20 @@ int guild_notice_changed (int guild_id, const char *mes1, const char *mes2) int guild_change_emblem (struct map_session_data *sd, int len, const char *data) { + struct guild *g; + int ps; + nullpo_retr (0, sd); + g = guild_search (sd->status.guild_id); + + if (g == NULL) + return 0; + + if ((ps = guild_getposition (sd, g)) < 0 + || !(g->position[ps].mode & 0x0010)) + return 0; + return intif_guild_emblem (sd->status.guild_id, len, data); } @@ -1126,7 +1151,7 @@ int guild_reqalliance (struct map_session_data *sd, int account_id) { struct map_session_data *tsd = map_id2sd (account_id); struct guild *g[2]; - int i; + int i, ps; if (agit_flag) { // Disable alliance creation during woe [Valaris] @@ -1146,6 +1171,10 @@ int guild_reqalliance (struct map_session_data *sd, int account_id) if (g[0] == NULL || g[1] == NULL) return 0; + if ((ps = guild_getposition (sd, g[0])) < 0 + || !(g[0]->position[ps].mode & 0x0010)) + return 0; + if (guild_get_alliance_count (g[0], 0) > 3) // 同盟数確認 clif_guild_allianceack (sd, 4); if (guild_get_alliance_count (g[1], 0) > 3) @@ -1256,8 +1285,20 @@ int guild_delalliance (struct map_session_data *sd, int guild_id, int flag) return 0; } // end addition [Valaris] + struct guild *g; + int ps; + nullpo_retr (0, sd); + g = guild_search (sd->status.guild_id); + + if (g == NULL) + return 0; + + if ((ps = guild_getposition (sd, g)) < 0 + || !(g->position[ps].mode & 0x0010)) + return 0; + intif_guild_alliance (sd->status.guild_id, guild_id, sd->status.account_id, 0, flag | 8); return 0; @@ -1268,7 +1309,7 @@ int guild_opposition (struct map_session_data *sd, int char_id) { struct map_session_data *tsd = map_id2sd (char_id); struct guild *g; - int i; + int i, ps; nullpo_retr (0, sd); @@ -1276,6 +1317,10 @@ int guild_opposition (struct map_session_data *sd, int char_id) if (g == NULL || tsd == NULL) return 0; + if ((ps = guild_getposition (sd, g)) < 0 + || !(g->position[ps].mode & 0x0010)) + return 0; + if (guild_get_alliance_count (g, 1) > 3) // 敵対数確認 clif_guild_oppositionack (sd, 1); |