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 --- Changelog-Trunk.txt | 5 ++++ conf-tmpl/atcommand_athena.conf | 3 ++ conf-tmpl/msg_athena.conf | 6 ++++ doc/item_bonus.txt | 11 ++----- src/char/int_party.c | 7 ++--- src/char_sql/int_party.c | 6 ++-- src/map/atcommand.c | 65 ++++++++++++++++++++++++++++++++++++----- src/map/atcommand.h | 1 + src/map/clif.c | 12 +++++++- src/map/intif.c | 4 +-- src/map/party.c | 4 +-- 11 files changed, 96 insertions(+), 28 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 4cfb4291d..e6979922f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/07/18 + * 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. [Skotlex] + * Updated @changeleader and @partyoption to use msg_Athena entries. + [Skotlex] * Added character 013 (enter) to the list of characters that are always removed from new character names. [Skotlex] * Fixed a crash when trying to extend TK's infinite combo feature. [Skotlex] diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index c77691582..6a2472ddd 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -147,6 +147,9 @@ changegm: 10 // Change the leader of your party. changeleader: 10 +// Change the party item share rules. +partyoption: 10 + // Command what the player's pet will say. pettalk: 10 diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf index 14be0a2fc..e9f8b7cc5 100644 --- a/conf-tmpl/msg_athena.conf +++ b/conf-tmpl/msg_athena.conf @@ -291,6 +291,12 @@ 279: @request sent. 280: Invalid pet name. 281: You can't create chat rooms on this map +//Party-related +282: You need to be a party leader to use this command. +283: Target character must be online and be in your party. +284: Leadership transferred. +285: You've become the party leader. +286: There's been no change in the setting. // Guild Castles Number // -------------------- 299: ?? Castles diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index bcc416b85..b6a947646 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -147,9 +147,9 @@ bonus bDamageWhenUnequip,n; You lose n HP when the item is unequipped bonus2 bCriticalAddRace,n,r; Critical + n vs. enemies of race r r: 0=Formless, 1=Undead, 2=Brute, 3=Plant, 4=Insect, 5=Fish, 6=Demon, 7=Demi-Human, 8=Angel, 9=Dragon, 10=Boss monster, 11=Other than (normal monster) boss monster bonus2 bHPLossRate,n,x; Lose n HP every x milliseconds -bonus2 bAddEffWhenHit,e,n; n% chance to cause e state to the enemy when +bonus2 bAddEffWhenHit,n,x; n% chance to cause x state to the enemy when being hit by physical damage -bonus2 bAddEffWhenHitShort,e,n; n% chance to cause x state to the enemy when +bonus2 bAddEffWhenHitShort,n,x; n% chance to cause x state to the enemy when being hit by physical close range damage bonus2 bSkillAtk,n,x; Increase damage of skill n by x% bonus2 bAddDamageByClass,n,x; When being hit by monster of class n increase @@ -208,10 +208,3 @@ bonus3 bAddMonsterDropItemGroup,n,x,y; y% chance to get an item of group type n 0=Formless, 1=Undead, 2=Brute, 3=Plant, 4=Insect, 5=Fish, 6=Demon, 7=Demi-Human, 8=Angel, 9=Dragon, 10=Boss monster, 11=Other than (normal monster) boss monster if 'y' is negative value, then it's a part of formula chance = -y*(killed_mob_level/10)+1 - -bonus3 bAddEff,e,x,i; Adds a x/10000 chance to cause effect e on - physical attack. i signals target: - 0: Self, 1: Target, 2: Both. -bonus3 bAddEffWhenHit,e,x,i; Adds a x/10000 chance to cause effect e when - physically attacked. i signals target: - 0: Self, 1: Target, 2: Both diff --git a/src/char/int_party.c b/src/char/int_party.c index b0cedabe6..e7d2044a5 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -569,10 +569,9 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member } // パ?ティ?設定?更要求 -int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int flag) { +int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) { struct party_data *p; - //NOTE: No clue what that flag is about, in all observations so far it always comes as 0. [Skotlex] - flag = 0; + int flag = 0; p = idb_get(party_db, party_id); if (p == NULL) @@ -583,7 +582,7 @@ int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, flag |= 0x01; p->party.exp = 0; } - + p->party.item = item&0x3; mapif_party_optionchanged(fd, &p->party, account_id, flag); return 0; } diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index bfd0cef79..e3056f8d5 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -634,11 +634,10 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member return 0; } // パーティー設定変更要求 -int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int flag) +int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int item) { struct party_data *p; - //NOTE: No clue what that flag is about, in all observations so far it always comes as 0. [Skotlex] - flag = 0; + int flag = 0; p = inter_party_fromsql(party_id); if(!p) @@ -649,6 +648,7 @@ int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int flag|=0x01; p->party.exp=0; } + p->party.item = item&0x3; //Filter out invalid values. mapif_party_optionchanged(fd,&p->party,account_id,flag); inter_party_tosql(p, PS_BASIC, 0); return 0; 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 *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 11cf113f0..f6b256eff 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -256,6 +256,7 @@ enum AtCommandType { AtCommand_AutoTrade,//durf AtCommand_ChangeGM,//durf AtCommand_ChangeLeader, + AtCommand_PartyOption, AtCommand_Invite, // By LuzZza AtCommand_Duel, // By LuzZza diff --git a/src/map/clif.c b/src/map/clif.c index 81c43cb09..3953b356c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10346,8 +10346,18 @@ void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd) { *------------------------------------------ */ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) { + struct party_data *p; RFIFOHEAD(fd); - party_changeoption(sd, RFIFOW(fd,2), RFIFOW(fd,4)); + + if(!sd->status.party_id) + return; + + p = party_search(sd->status.party_id); + if (!p) return; + //The client no longer can change the item-field, therefore it always + //comes as zero. Here, resend the item data as it is. +// party_changeoption(sd, RFIFOW(fd,2), RFIFOW(fd,4)); + party_changeoption(sd, RFIFOW(fd,2), p->party.item); } /*========================================== diff --git a/src/map/intif.c b/src/map/intif.c index bb12fa673..5df6dd0ae 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -417,7 +417,7 @@ int intif_party_addmember(int party_id,struct party_member *member) return 1; } // パーティ設定変更 -int intif_party_changeoption(int party_id,int account_id,int exp,int flag) +int intif_party_changeoption(int party_id,int account_id,int exp,int item) { if (CheckForCharServer()) return 0; @@ -426,7 +426,7 @@ int intif_party_changeoption(int party_id,int account_id,int exp,int flag) WFIFOL(inter_fd,2)=party_id; WFIFOL(inter_fd,6)=account_id; WFIFOW(inter_fd,10)=exp; - WFIFOW(inter_fd,12)=flag; + WFIFOW(inter_fd,12)=item; WFIFOSET(inter_fd,14); return 0; } diff --git a/src/map/party.c b/src/map/party.c index 24f29a603..c6aebda4a 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -452,13 +452,13 @@ int party_broken(int party_id) return 0; } -int party_changeoption(struct map_session_data *sd,int exp,int flag) +int party_changeoption(struct map_session_data *sd,int exp,int item) { nullpo_retr(0, sd); if( sd->status.party_id==0) return 0; - intif_party_changeoption(sd->status.party_id,sd->status.account_id,exp,flag); + intif_party_changeoption(sd->status.party_id,sd->status.account_id,exp,item); return 0; } -- cgit v1.2.3-70-g09d2