summaryrefslogtreecommitdiff
path: root/src/map/party.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-19 18:19:09 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-19 18:19:09 +0000
commit30c8d7704026aa450b64997c2996ee8d9d4f2cec (patch)
treedae267b2e016111da192de4dbf67679878e73409 /src/map/party.c
parent620ea0643c3bcbfed5dd7c84e8d65fc8941997a7 (diff)
downloadhercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.gz
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.bz2
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.xz
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.zip
- Applied the renewal client support patch from Diablo (eA forum topic 222623)
- Added support for strcharinfo(3) to retrieve the player's map - Added script command "searchitem" for name item searches. - Moved PACKETVER to src/common/mmo.h as it's needed by the char-server now - Changed the status valX from int to long so that it won't break for pointer-storage in other architectures. - Moved the change party leader code to party.c - A few bugfixes or packet field completions based on my past experience messing around with my server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14155 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/party.c')
-rw-r--r--src/map/party.c51
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