Fixed party window for 2017 clients

Thanks to @mrdiablo for his help again!
This commit is contained in:
Lemongrass3110 2017-06-05 23:07:09 +02:00
parent b51617cb73
commit 816d8ab2d0
4 changed files with 116 additions and 28 deletions

View File

@ -2657,5 +2657,10 @@ packet_keys: 0x4C17382A,0x7ED174C9,0x29961E4F // [Winnie]
0x088D,5,hommenu,2:4
0x0940,36,storagepassword,2:4:20
// 2017-02-15aRagexeRE
0x0A43,85
0x0A44,-1
0x0ABD,10
//Add new packets here
//packet_ver: 56

View File

@ -3239,14 +3239,6 @@ void clif_updatestatus(struct map_session_data *sd,int type)
// On officials the HP never go below 1, even if you die [Lemongrass]
// On officials the HP Novice class never go below 50%, even if you die [Napster]
WFIFOL(fd,4)= sd->battle_status.hp ? sd->battle_status.hp : (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE ? 1 : sd->battle_status.max_hp/2;
// TODO: Won't these overwrite the current packet?
if( map[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;
@ -3392,6 +3384,36 @@ 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:
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);
}
}
}
break;
case SP_HP:
if( map[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;
}
}
@ -7303,6 +7325,7 @@ void clif_party_created(struct map_session_data *sd,int result)
/// Adds new member to a party.
/// 0104 <account id>.L <role>.L <x>.W <y>.W <state>.B <party name>.24B <char name>.24B <map name>.16B (ZC_ADD_MEMBER_TO_GROUP)
/// 01e9 <account id>.L <role>.L <x>.W <y>.W <state>.B <party name>.24B <char name>.24B <map name>.16B <item pickup rule>.B <item share rule>.B (ZC_ADD_MEMBER_TO_GROUP2)
/// 0a43 <account id>.L <role>.L <class>.W <base level>.W <x>.W <y>.W <state>.B <party name>.24B <char name>.24B <map name>.16B <item pickup rule>.B <item share rule>.B (ZC_ADD_MEMBER_TO_GROUP3)
/// role:
/// 0 = leader
/// 1 = normal
@ -7311,8 +7334,16 @@ void clif_party_created(struct map_session_data *sd,int result)
/// 1 = disconnected
void clif_party_member_info(struct party_data *p, struct map_session_data *sd)
{
unsigned char buf[81];
int i;
#if PACKETVER < 20170215
unsigned char buf[81];
int cmd = 0x1e9;
int offset = 0;
#else
unsigned char buf[85];
int cmd = 0xa43;
int offset = 4;
#endif
if (!sd) { //Pick any party member (this call is used when changing item share rules)
ARR_FIND( 0, MAX_PARTY, i, p->data[i].sd != 0 );
@ -7322,18 +7353,22 @@ void clif_party_member_info(struct party_data *p, struct map_session_data *sd)
if (i >= MAX_PARTY) return; //Should never happen...
sd = p->data[i].sd;
WBUFW(buf, 0) = 0x1e9;
WBUFW(buf, 0) = cmd;
WBUFL(buf, 2) = sd->status.account_id;
WBUFL(buf, 6) = (p->party.member[i].leader)?0:1;
WBUFW(buf,10) = sd->bl.x;
WBUFW(buf,12) = sd->bl.y;
WBUFB(buf,14) = (p->party.member[i].online)?0:1;
safestrncpy(WBUFCP(buf,15), p->party.name, NAME_LENGTH);
safestrncpy(WBUFCP(buf,39), sd->status.name, NAME_LENGTH);
mapindex_getmapname_ext(map_mapid2mapname(sd->bl.m), WBUFCP(buf,63));
WBUFB(buf,79) = (p->party.item&1)?1:0;
WBUFB(buf,80) = (p->party.item&2)?1:0;
clif_send(buf,packet_len(0x1e9),&sd->bl,PARTY);
#if PACKETVER >= 20170215
WBUFW(buf,10) = sd->status.class_;
WBUFW(buf,12) = sd->status.base_level;
#endif
WBUFW(buf,offset+10) = sd->bl.x;
WBUFW(buf,offset+12) = sd->bl.y;
WBUFB(buf,offset+14) = (p->party.member[i].online)?0:1;
safestrncpy(WBUFCP(buf,offset+15), p->party.name, NAME_LENGTH);
safestrncpy(WBUFCP(buf,offset+39), sd->status.name, NAME_LENGTH);
mapindex_getmapname_ext(map_mapid2mapname(sd->bl.m), WBUFCP(buf,offset+63));
WBUFB(buf,offset+79) = (p->party.item&1)?1:0;
WBUFB(buf,offset+80) = (p->party.item&2)?1:0;
clif_send(buf,packet_len(cmd),&sd->bl,PARTY);
}
@ -7345,15 +7380,23 @@ void clif_party_member_info(struct party_data *p, struct map_session_data *sd)
/// state:
/// 0 = connected
/// 1 = disconnected
/// 0a44 <packet len>.W <party name>.24B { <account id>.L <nick>.24B <map name>.16B <role>.B <state>.B <class>.W <base level>.W }* <item pickup rule>.B <item share rule>.B <unknown>.L
void clif_party_info(struct party_data* p, struct map_session_data *sd)
{
unsigned char buf[2+2+NAME_LENGTH+(4+NAME_LENGTH+MAP_NAME_LENGTH_EXT+1+1)*MAX_PARTY];
struct map_session_data* party_sd = NULL;
int i, c;
#if PACKETVER < 20170215
int cmd = 0xfb;
int size = 46;
#else
int cmd = 0xa44;
int size = 50;
#endif
nullpo_retv(p);
WBUFW(buf,0) = 0xfb;
WBUFW(buf,0) = cmd;
safestrncpy(WBUFCP(buf,4), p->party.name, NAME_LENGTH);
for(i = 0, c = 0; i < MAX_PARTY; i++)
{
@ -7362,14 +7405,25 @@ void clif_party_info(struct party_data* p, struct map_session_data *sd)
if(party_sd == NULL) party_sd = p->data[i].sd;
WBUFL(buf,28+c*46) = m->account_id;
safestrncpy(WBUFCP(buf,28+c*46+4), m->name, NAME_LENGTH);
mapindex_getmapname_ext(mapindex_id2name(m->map), WBUFCP(buf,28+c*46+28));
WBUFB(buf,28+c*46+44) = (m->leader) ? 0 : 1;
WBUFB(buf,28+c*46+45) = (m->online) ? 0 : 1;
WBUFL(buf,28+c*size) = m->account_id;
safestrncpy(WBUFCP(buf,28+c*size+4), m->name, NAME_LENGTH);
mapindex_getmapname_ext(mapindex_id2name(m->map), WBUFCP(buf,28+c*size+28));
WBUFB(buf,28+c*size+44) = (m->leader) ? 0 : 1;
WBUFB(buf,28+c*size+45) = (m->online) ? 0 : 1;
#if PACKETVER >= 20170215
WBUFW(buf,28+c*size+46) = m->class_;
WBUFW(buf,28+c*size+48) = m->lv;
#endif
c++;
}
WBUFW(buf,2) = 28+c*46;
#if PACKETVER < 20170215
WBUFW(buf,2) = 28+c*size;
#else
WBUFB(buf,28+c*size) = (p->party.item & 1) ? 1 : 0;
WBUFB(buf,28+c*size+1) = (p->party.item & 2) ? 1 : 0;
WBUFL(buf,28+c*size+2) = 0; // unknown
WBUFW(buf,2) = 28+c*size+6;
#endif
if(sd) { // send only to self
clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
@ -7612,6 +7666,22 @@ void clif_party_hp(struct map_session_data *sd)
clif_send(buf,packet_len(cmd),&sd->bl,PARTY_AREA_WOS);
}
/// 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){
#if PACKETVER >= 20170215
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
}
/*==========================================
* Sends HP bar to a single fd. [Skotlex]
@ -19596,7 +19666,7 @@ void packetdb_readdb(bool reload)
21, 3, 5, 0, 66, 0, 0, 8, 3, 0, 0, -1, 0, -1, 0, 0,
106, 0, 0, 0, 0, 4, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0,
//#0x0A40
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 85, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -19604,7 +19674,7 @@ void packetdb_readdb(bool reload)
0, 0, 0, 0, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
//#0x0AC0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@ -731,6 +731,7 @@ void clif_party_xy(struct map_session_data *sd);
void clif_party_xy_single(int fd, struct map_session_data *sd);
void clif_party_hp(struct map_session_data *sd);
void clif_hpmeter_single(int fd, int id, unsigned int hp, unsigned int maxhp);
void clif_party_job_and_level(struct map_session_data *sd);
// guild
void clif_guild_created(struct map_session_data *sd,int flag);

View File

@ -8611,6 +8611,18 @@ bool pc_jobchange(struct map_session_data *sd,int job, char upper)
pc_checkallowskill(sd);
pc_equiplookall(sd);
pc_show_questinfo(sd);
if( sd->status.party_id ){
struct party_data* p;
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].class_ = sd->status.class_;
clif_party_job_and_level(sd);
}
}
}
chrif_save(sd, CSAVE_NORMAL);
//if you were previously famous, not anymore.