diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-14 23:33:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-25 01:43:47 +0300 |
commit | 4d11bf44c8c481045ce496669830b1990deca464 (patch) | |
tree | 3c3219a8ddfead11b739dfe0f45f8c3a97bbde70 /src/map | |
parent | 4465180912d4757791b1365f7df0a8b889e9cafe (diff) | |
download | hercules-4d11bf44c8c481045ce496669830b1990deca464.tar.gz hercules-4d11bf44c8c481045ce496669830b1990deca464.tar.bz2 hercules-4d11bf44c8c481045ce496669830b1990deca464.tar.xz hercules-4d11bf44c8c481045ce496669830b1990deca464.zip |
Add packet 0xabd for send job and base levels to party members.
Also improve packets send on base level change.
Based on commit from rathena:
commit 816d8ab2d0934f823a1d26f7fcac244f8245f14b
Author: Lemongrass3110 <lemongrass@kstp.at>
Date: Mon Jun 5 23:07:09 2017 +0200
Fixed party window for 2017 clients
Thanks to @mrdiablo for his help again!
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 42 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/pc.c | 20 | ||||
-rw-r--r-- | src/map/pc.h | 1 |
4 files changed, 57 insertions, 7 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index f91e58b89..4791451fb 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2984,13 +2984,6 @@ void clif_updatestatus(struct map_session_data *sd,int type) break; case SP_HP: WFIFOL(fd,4)=sd->battle_status.hp; - // TODO: Won't these overwrite the current packet? - if( map->list[sd->bl.m].hpmeter_visible ) - clif->hpmeter(sd); - if( !battle_config.party_hp_mode && sd->status.party_id ) - clif->party_hp(sd); - if( sd->bg_id ) - clif->bg_hp(sd); break; case SP_SP: WFIFOL(fd,4)=sd->battle_status.sp; @@ -3140,6 +3133,21 @@ void clif_updatestatus(struct map_session_data *sd,int type) return; } WFIFOSET(fd,len); + + // Additional update packets that should be sent right after + switch (type) { + case SP_BASELEVEL: + pc->update_job_and_level(sd); + break; + case SP_HP: + if (map->list[sd->bl.m].hpmeter_visible) + clif->hpmeter(sd); + if (!battle_config.party_hp_mode && sd->status.party_id) + clif->party_hp(sd); + if (sd->bg_id) + clif->bg_hp(sd); + break; + } } /// Notifies client of a parameter change of an another player (ZC_PAR_CHANGE_USER). @@ -6639,6 +6647,25 @@ void clif_party_info(struct party_data* p, struct map_session_data *sd) } } +/// Updates the job and level of a party member +/// 0abd <account id>.L <job>.W <level>.W +void clif_party_job_and_level(struct map_session_data *sd) +{ +// [4144] packet 0xabd added in client in 2017-02-15 because this probably it can works for clients older than 20170524 +#if PACKETVER >= 20170524 + unsigned char buf[10]; + + nullpo_retv(sd); + + WBUFW(buf, 0) = 0xabd; + WBUFL(buf, 2) = sd->status.account_id; + WBUFW(buf, 6) = sd->status.class; + WBUFW(buf, 8) = sd->status.base_level; + + clif_send(buf, packet_len(0xabd), &sd->bl, PARTY); +#endif +} + /// The player's 'party invite' state, sent during login (ZC_PARTY_CONFIG). /// 02c9 <flag>.B /// flag: @@ -19778,6 +19805,7 @@ void clif_defaults(void) { clif->party_created = clif_party_created; clif->party_member_info = clif_party_member_info; clif->party_info = clif_party_info; + clif->party_job_and_level = clif_party_job_and_level; clif->party_invite = clif_party_invite; clif->party_inviteack = clif_party_inviteack; clif->party_option = clif_party_option; diff --git a/src/map/clif.h b/src/map/clif.h index ccb227267..b34be81a3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -917,6 +917,7 @@ struct clif_interface { void (*party_created) (struct map_session_data *sd,int result); void (*party_member_info) (struct party_data *p, struct map_session_data *sd); void (*party_info) (struct party_data* p, struct map_session_data *sd); + void (*party_job_and_level) (struct map_session_data *sd); void (*party_invite) (struct map_session_data *sd,struct map_session_data *tsd); void (*party_inviteack) (struct map_session_data* sd, const char* nick, int result); void (*party_option) (struct party_data *p,struct map_session_data *sd,int flag); diff --git a/src/map/pc.c b/src/map/pc.c index c52da3c14..aedb029b6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -8793,6 +8793,7 @@ int pc_jobchange(struct map_session_data *sd, int class, int upper) status_calc_pc(sd,SCO_FORCE); pc->checkallowskill(sd); pc->equiplookall(sd); + pc->update_job_and_level(sd); //if you were previously famous, not anymore. if (fame_flag != 0) { @@ -11951,6 +11952,24 @@ void pc_check_supernovice_call(struct map_session_data *sd, const char *message) } } +void pc_update_job_and_level(struct map_session_data *sd) +{ + nullpo_retv(sd); + + if (sd->status.party_id) { + struct party_data *p; + int i; + + if ((p = party->search(sd->status.party_id)) != NULL) { + ARR_FIND(0, MAX_PARTY, i, p->party.member[i].char_id == sd->status.char_id); + if (i < MAX_PARTY) { + p->party.member[i].lv = sd->status.base_level; + clif->party_job_and_level(sd); + } + } + } +} + void do_final_pc(void) { db_destroy(pc->itemcd_db); pc->at_db->destroy(pc->at_db,pc->autotrade_final); @@ -12293,6 +12312,7 @@ void pc_defaults(void) { pc->checkcombo = pc_checkcombo; pc->calcweapontype = pc_calcweapontype; pc->removecombo = pc_removecombo; + pc->update_job_and_level = pc_update_job_and_level; pc->bank_withdraw = pc_bank_withdraw; pc->bank_deposit = pc_bank_deposit; diff --git a/src/map/pc.h b/src/map/pc.h index 634814f07..04fd98b24 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1096,6 +1096,7 @@ END_ZEROED_BLOCK; /* End */ bool (*db_checkid) (int class); void (*validate_levels) (void); + void (*update_job_and_level) (struct map_session_data *sd); /** * Autotrade persistency [Ind/Hercules <3] |