summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-09-21 01:14:59 -0300
committershennetsind <ind@henn.et>2014-09-21 01:14:59 -0300
commitff787408bcc523ebd4b7919db65423f741351664 (patch)
tree8aa90b3c7b025f463837f732a94c12990eb7662e
parent14475dc879bcd2cf1f9816fb9448831a9b33d295 (diff)
downloadhercules-ff787408bcc523ebd4b7919db65423f741351664.tar.gz
hercules-ff787408bcc523ebd4b7919db65423f741351664.tar.bz2
hercules-ff787408bcc523ebd4b7919db65423f741351664.tar.xz
hercules-ff787408bcc523ebd4b7919db65423f741351664.zip
Fixed Bug 8293
Implemented official party-leader-changed-packet Special Thanks to kyeme! http://hercules.ws/board/tracker/issue-8293-change-party-leader/ Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/map/clif.c15
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets_struct.h8
-rw-r--r--src/map/party.c8
4 files changed, 26 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index b8051697e..6838a8021 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12234,7 +12234,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) {
party->changeleader(sd, map->id2sd(RFIFOL(fd,2)));
}
-
+
/// Party Booking in KRO [Spiria]
///
@@ -18254,6 +18254,18 @@ void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) {
clif->npc_market_purchase_ack(sd,p,npc->market_buylist(sd,(p->PacketLength - 4) / sizeof(p->list[0]),p));
#endif
}
+
+void clif_PartyLeaderChanged(struct map_session_data *sd, int prev_leader_aid, int new_leader_aid) {
+ struct packet_party_leader_changed p;
+
+ p.PacketType = partyleaderchangedType;
+
+ p.prev_leader_aid = prev_leader_aid;
+ p.new_leader_aid = new_leader_aid;
+
+ clif->send(&p,sizeof(p),&sd->bl,PARTY);
+}
+
/* */
unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) {
if( sd ) {
@@ -18884,6 +18896,7 @@ void clif_defaults(void) {
clif->party_xy_remove = clif_party_xy_remove;
clif->party_show_picker = clif_party_show_picker;
clif->partyinvitationstate = clif_partyinvitationstate;
+ clif->PartyLeaderChanged = clif_PartyLeaderChanged;
/* guild-specific */
clif->guild_created = clif_guild_created;
clif->guild_belonginfo = clif_guild_belonginfo;
diff --git a/src/map/clif.h b/src/map/clif.h
index e4de51a83..bb71db5ae 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -866,6 +866,7 @@ struct clif_interface {
void (*party_xy_remove) (struct map_session_data *sd);
void (*party_show_picker) (struct map_session_data * sd, struct item * item_data);
void (*partyinvitationstate) (struct map_session_data* sd);
+ void (*PartyLeaderChanged) (struct map_session_data *sd, int prev_leader_aid, int new_leader_aid);
/* guild-specific */
void (*guild_created) (struct map_session_data *sd,int flag);
void (*guild_belonginfo) (struct map_session_data *sd, struct guild *g);
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index b32baf53a..9f9349b88 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -209,6 +209,7 @@ enum packet_headers {
#else
wisendType = 0x98,
#endif
+ partyleaderchangedType = 0x7fc,
};
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
@@ -959,6 +960,13 @@ struct packet_wis_end {
} __attribute__((packed));
+struct packet_party_leader_changed {
+ short PacketType;
+ unsigned int prev_leader_aid;
+ unsigned int new_leader_aid;
+} __attribute__((packed));
+
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris
diff --git a/src/map/party.c b/src/map/party.c
index 7cf340edb..f4a5c870a 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -686,12 +686,10 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
//Change leadership.
p->party.member[mi].leader = 0;
- if (p->data[mi].sd->fd)
- clif->message(p->data[mi].sd->fd, msg_txt(284));
-
p->party.member[tmi].leader = 1;
- if (p->data[tmi].sd->fd)
- clif->message(p->data[tmi].sd->fd, msg_txt(285));
+
+ /** update members **/
+ clif->PartyLeaderChanged(p->data[mi].sd, p->data[mi].sd->status.account_id, p->data[tmi].sd->status.account_id);
//Update info.
intif->party_leaderchange(p->party.party_id,p->party.member[tmi].account_id,p->party.member[tmi].char_id);