From 74e339cf16f44296ea4318c06cf8a736f1994861 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 18 Jul 2006 21:12:35 +0000 Subject: - Added atcommand @partyoption, lets you alter the party item-distribution type on the go. Usage is "@partyoption ", where both arguments can be 0/1, yes/no, etc. - Updated @changeleader and @partyoption to use msg_Athena entries. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7737 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 7 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 29b055687..d22483f8a 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -281,6 +281,7 @@ ACMD_FUNC(showzeny); ACMD_FUNC(showdelay); //moved from charcommand [Kevin] ACMD_FUNC(autotrade);// durf ACMD_FUNC(changeleader);// [Skotlex] +ACMD_FUNC(partyoption);// [Skotlex] ACMD_FUNC(changegm);// durf // Duel [LuzZza] @@ -608,6 +609,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_AutoTrade, "@at", 10, atcommand_autotrade }, { AtCommand_ChangeGM, "@changegm", 10, atcommand_changegm }, // durf { AtCommand_ChangeLeader, "@changeleader", 10, atcommand_changeleader }, // durf + { AtCommand_PartyOption, "@partyoption", 10, atcommand_partyoption}, // durf { AtCommand_Invite, "@invite", 1, atcommand_invite }, // By LuzZza { AtCommand_Duel, "@duel", 1, atcommand_duel }, // By LuzZza { AtCommand_Leave, "@leave", 1, atcommand_leave }, // By LuzZza @@ -7667,8 +7669,8 @@ atcommand_changeleader( nullpo_retr(-1, sd); if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL) - { - clif_displaymessage(fd, "You need to be a party's leader to use this command."); + { //Need to be a party leader. + clif_displaymessage(fd, msg_txt(282)); return -1; } @@ -7678,8 +7680,8 @@ atcommand_changeleader( return -1; //Shouldn't happen if (!p->party.member[mi].leader) - { - clif_displaymessage(fd, "You need to be the party's leader to use this command."); + { //Need to be a party leader. + clif_displaymessage(fd, msg_txt(282)); return -1; } @@ -7690,7 +7692,7 @@ atcommand_changeleader( } if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.party_id != sd->status.party_id) { - clif_displaymessage(fd, "Target character must be online and be in your party."); + clif_displaymessage(fd, msg_txt(283)); return -1; } @@ -7702,10 +7704,10 @@ atcommand_changeleader( //Change leadership. p->party.member[mi].leader = 0; if (p->data[mi].sd->fd) - clif_displaymessage(p->data[mi].sd->fd, "Leadership transferred."); + clif_displaymessage(p->data[mi].sd->fd, msg_txt(284)); p->party.member[pl_mi].leader = 1; if (p->data[pl_mi].sd->fd) - clif_displaymessage(p->data[pl_mi].sd->fd, "You've become the party leader."); + clif_displaymessage(p->data[pl_mi].sd->fd, msg_txt(285)); intif_party_leaderchange(p->party.party_id,p->party.member[pl_mi].account_id,p->party.member[pl_mi].char_id); //Update info. @@ -7715,6 +7717,55 @@ atcommand_changeleader( return 0; } +/*========================================== + * Used to change the item share setting of a party. + *------------------------------------------ + *by Skotlex + */ +int +atcommand_partyoption( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct party_data *p; + int mi, option; + char w1[15], w2[15]; + nullpo_retr(-1, sd); + + if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL) + { + clif_displaymessage(fd, msg_txt(282)); + return -1; + } + + for (mi = 0; mi < MAX_PARTY && p->data[mi].sd != sd; mi++); + + if (mi == MAX_PARTY) + return -1; //Shouldn't happen + + if (!p->party.member[mi].leader) + { + clif_displaymessage(fd, msg_txt(282)); + return -1; + } + + if(!message || !*message || sscanf(message, "%15s %15s", w1, w2) < 2) + { + clif_displaymessage(fd, "Command usage: @changeoption "); + return -1; + } + w1[14] = w2[14] = '\0'; //Assure a proper string terminator. + option = (battle_config_switch(w1)?1:0)|(battle_config_switch(w2)?2:0); + + //Change item share type. + if (option != p->party.item) + party_changeoption(sd, p->party.exp, option); + else + clif_displaymessage(fd, msg_txt(286)); + + return 0; +} + /*========================================== *Turns on/off AutoLoot for a specific player *------------------------------------------ -- cgit v1.2.3-60-g2f50