summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-04-16 02:09:18 +0300
committerAndrei Karas <akaras@inbox.ru>2019-05-05 22:22:05 +0300
commitd4408049c3764f3fccef3fb25b3032bebcad2f59 (patch)
treea3cb5506d141f741871ee9f3bcf641c99b92a146 /src/map/clif.c
parent91b6b9d0d35e244dacb03d34a89754bed3934946 (diff)
downloadhercules-d4408049c3764f3fccef3fb25b3032bebcad2f59.tar.gz
hercules-d4408049c3764f3fccef3fb25b3032bebcad2f59.tar.bz2
hercules-d4408049c3764f3fccef3fb25b3032bebcad2f59.tar.xz
hercules-d4408049c3764f3fccef3fb25b3032bebcad2f59.zip
Imporve packet ZC_ROLE_CHANGE usage
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c7157f891..43407af10 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4311,22 +4311,25 @@ static void clif_addchat(struct chat_data *cd, struct map_session_data *sd)
/// role:
/// 0 = owner (menu)
/// 1 = normal
-static void clif_changechatowner(struct chat_data *cd, struct map_session_data *sd)
+static void clif_chatRoleChange(struct chat_data *cd, struct map_session_data *sd, struct block_list* bl, int isNotOwner)
{
- unsigned char buf[64];
-
nullpo_retv(sd);
- nullpo_retv(cd);
+ nullpo_retv(bl);
+ struct PACKET_ZC_ROLE_CHANGE p;
- WBUFW(buf, 0) = 0xe1;
- WBUFL(buf, 2) = 1;
- memcpy(WBUFP(buf,6),cd->usersd[0]->status.name,NAME_LENGTH);
+ p.packetType = HEADER_ZC_ROLE_CHANGE;
+ p.flag = isNotOwner;
+ memcpy(&p.name, sd->status.name, NAME_LENGTH);
+ clif->send(&p, sizeof(struct PACKET_ZC_ROLE_CHANGE), bl, CHAT);
+}
- WBUFW(buf,30) = 0xe1;
- WBUFL(buf,32) = 0;
- memcpy(WBUFP(buf,36),sd->status.name,NAME_LENGTH);
+static void clif_changechatowner(struct chat_data *cd, struct map_session_data *sd)
+{
+ nullpo_retv(sd);
+ nullpo_retv(cd);
- clif->send(buf,packet_len(0xe1)*2,&sd->bl,CHAT);
+ clif->chatRoleChange(cd, cd->usersd[0], &sd->bl, 1);
+ clif->chatRoleChange(cd, sd, &sd->bl, 0);
}
/// Notify about user leaving the chatroom (ZC_MEMBER_EXIT).
@@ -23051,6 +23054,7 @@ void clif_defaults(void)
clif->joinchatok = clif_joinchatok;
clif->addchat = clif_addchat;
clif->changechatowner = clif_changechatowner;
+ clif->chatRoleChange = clif_chatRoleChange;
clif->clearchat = clif_clearchat;
clif->leavechat = clif_leavechat;
clif->changechatstatus = clif_changechatstatus;