diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 31 | ||||
-rw-r--r-- | src/map/party.c | 23 | ||||
-rw-r--r-- | src/map/party.h | 2 |
3 files changed, 47 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 9eba9f4b4..c1e3750d4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7301,8 +7301,10 @@ static void clif_party_inviteack(struct map_session_data *sd, const char *nick, /// 2 = cannot change exp sharing /// /// flag: -/// 0 = send to party -/// 1 = send to sd +/// 0x01 = Cannot change EXP sharing. (Only set when tried to change options manually.) +/// 0x02 = Options changed manually. +/// 0x04 = Options changed automatically. +/// 0x20 = Character logged in. static void clif_party_option(struct party_data *p, struct map_session_data *sd, int flag) { unsigned char buf[16]; @@ -7314,7 +7316,7 @@ static void clif_party_option(struct party_data *p, struct map_session_data *sd, nullpo_retv(p); - if(!sd && flag==0){ + if (sd == NULL && (flag & 0x01) == 0) { int i; for(i=0;i<MAX_PARTY && !p->data[i].sd;i++) ; @@ -7328,10 +7330,13 @@ static void clif_party_option(struct party_data *p, struct map_session_data *sd, WBUFB(buf,6)=(p->party.item&1)?1:0; WBUFB(buf,7)=(p->party.item&2)?1:0; #endif - if(flag==0) + if ((flag & 0x01) == 0 && ((flag & 0x04) != 0 || (flag & 0x02) != 0)) clif->send(buf,packet_len(cmd),&sd->bl,PARTY); else clif->send(buf,packet_len(cmd),&sd->bl,SELF); + + if ((flag & 0x04) != 0) + p->state.option_auto_changed = 0; } /// 0105 <account id>.L <char name>.24B <result>.B (ZC_DELETE_MEMBER_FROM_GROUP). @@ -10764,9 +10769,16 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) map->addblock(&sd->bl); // Add the character to the map. clif->spawn(&sd->bl); // Spawn character client side. + struct party_data *p = NULL; + + if (sd->status.party_id != 0) + p = party->search(sd->status.party_id); + // Send character's party info to the client. Call this after clif->spawn() to show HP bars correctly. - if (sd->status.party_id != 0) { - party->send_movemap(sd); + if (p != NULL) { + if (sd->state.connect_new == 0) // Login is handled in party_member_joined(). + party->send_movemap(sd); + clif->party_hp(sd); // Show HP after displacement. [LuzZza] } @@ -11022,6 +11034,13 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) #endif } + if (p != NULL && first_time) { + if (p->state.option_auto_changed != 0) + clif->party_option(p, sd, 0x04); + else + clif->party_option(p, sd, 0x20); + } + if (((battle_config.display_rate_messages & 0x1) != 0 && first_time) || ((battle_config.display_rate_messages & 0x2) != 0 && !first_time && change_map) || (battle_config.display_rate_messages & 0x4) != 0) { diff --git a/src/map/party.c b/src/map/party.c index 8eeae2215..14e3df42f 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -349,7 +349,6 @@ static int party_recv_info(const struct party *sp, int char_id) continue;// not online clif->charnameupdate(sd); //Update other people's display. [Skotlex] clif->party_member_info(p,sd); - clif->party_option(p,sd,0x100); clif->party_info(p,NULL); for( j = 0; j < p->instances; j++ ) { if( p->instance[j] >= 0 ) { @@ -496,6 +495,8 @@ static void party_member_joined(struct map_session_data *sd) } } else sd->status.party_id = 0; //He does not belongs to the party really? + + party->send_movemap(sd); } /// Invoked (from char-server) when a new member is added to the party. @@ -733,6 +734,16 @@ static int party_optionchanged(int party_id, int account_id, int exp, int item, p->party.item=item; } + if (account_id == 0) { + flag |= 0x04; + p->state.option_auto_changed = 1; + + if (p->state.member_level_changed == 0) + return 0; // clif_party_option() is handled in clif_parse_LoadEndAck(). + } else { + flag |= 0x02; + } + clif->party_option(p,sd,flag); return 0; } @@ -811,7 +822,8 @@ static int party_recv_movemap(int party_id, int account_id, int char_id, unsigne ShowError("party_recv_movemap: char %d/%d not found in party %s (id:%d)",account_id,char_id,p->party.name,party_id); return 0; } - + + p->state.member_level_changed = 0; m = &p->party.member[i]; m->map = mapid; m->online = online; @@ -860,7 +872,12 @@ static void party_send_movemap(struct map_session_data *sd) static void party_send_levelup(struct map_session_data *sd) { - intif->party_changemap(sd,1); + struct party_data *p = party->search(sd->status.party_id); + + if (p != NULL) + p->state.member_level_changed = 1; + + intif->party_changemap(sd, 1); } static int party_send_logout(struct map_session_data *sd) diff --git a/src/map/party.h b/src/map/party.h index c2306b7a8..5f3458cd4 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -51,6 +51,8 @@ struct party_data { unsigned sg : 1; ///< There's at least one Star Gladiator in party? unsigned snovice :1; ///< There's a Super Novice unsigned tk : 1; ///< There's a taekwon + unsigned option_auto_changed : 1; ///< Party options were changed automatically. (inter_party_check_lv()) + unsigned member_level_changed : 1; ///< A party member's level has changed. } state; struct hplugin_data_store *hdata; ///< HPM Plugin Data Store }; |