diff options
Diffstat (limited to 'src/map/party.c')
-rw-r--r-- | src/map/party.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/map/party.c b/src/map/party.c index 4a10036d3..be54455d7 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -606,6 +606,57 @@ int party_optionchanged(int party_id,int account_id,int exp,int item,int flag) return 0; } +bool party_changeleader(struct map_session_data *sd, struct map_session_data *tsd) +{ + struct party_data *p; + int mi, tmi; + + if (!sd || !sd->status.party_id) + return false; + + if (!tsd || tsd->status.party_id != sd->status.party_id) { + clif_displaymessage(sd->fd, msg_txt(283)); + return false; + } + + if( map[sd->bl.m].flag.partylock ) + { + clif_displaymessage(sd->fd, "You cannot change party leaders on this map."); + return false; + } + + if ((p = party_search(sd->status.party_id)) == NULL) + return false; + + ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd ); + if (mi == MAX_PARTY) + return false; //Shouldn't happen + + if (!p->party.member[mi].leader) + { //Need to be a party leader. + clif_displaymessage(sd->fd, msg_txt(282)); + return false; + } + + ARR_FIND( 0, MAX_PARTY, tmi, p->data[tmi].sd == tsd); + if (tmi == MAX_PARTY) + return false; //Shouldn't happen + + //Change leadership. + p->party.member[mi].leader = 0; + if (p->data[mi].sd->fd) + clif_displaymessage(p->data[mi].sd->fd, msg_txt(284)); + + p->party.member[tmi].leader = 1; + if (p->data[tmi].sd->fd) + clif_displaymessage(p->data[tmi].sd->fd, msg_txt(285)); + + //Update info. + intif_party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id); + clif_party_info(p,NULL); + return true; +} + /// Invoked (from char-server) when a party member /// - changes maps /// - logs in or out |