summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c300
1 files changed, 172 insertions, 128 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 4e8653783..3b7691ae4 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1649,7 +1649,9 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int
p.level = hd->homunculus.level;
p.hunger = hd->homunculus.hunger;
p.intimacy = hd->homunculus.intimacy / 100;
+#if !(PACKETVER_MAIN_NUM >= 20190619 || PACKETVER_RE_NUM >= 20190605 || PACKETVER_ZERO_NUM >= 20190626)
p.itemId = 0; // equip id
+#endif
#ifdef RENEWAL
p.atk2 = cap_value(hstatus->rhw.atk2, 0, INT16_MAX);
#else
@@ -3909,20 +3911,16 @@ static void clif_arrow_fail(struct map_session_data *sd, int type)
/// 01ad <packet len>.W { <name id>.W }*
static void clif_arrow_create_list(struct map_session_data *sd)
{
- int i, c;
- int fd;
- int len;
- struct PACKET_ZC_MAKINGARROW_LIST *p;
-
nullpo_retv(sd);
- fd = sd->fd;
- len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ int fd = sd->fd;
+ int len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
WFIFOHEAD(fd, len);
- p = WFIFOP(fd, 0);
- p->packetType = 0x1ad;
+ struct PACKET_ZC_MAKINGARROW_LIST *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_MAKINGARROW_LIST;
- for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) {
+ int c = 0;
+ for (int i = 0; i < MAX_SKILL_ARROW_DB; i++) {
int j;
if (skill->dbs->arrow_db[i].nameid > 0
&& (j = pc->search_inventory(sd, skill->dbs->arrow_db[i].nameid)) != INDEX_NOT_FOUND
@@ -3953,17 +3951,16 @@ static void clif_arrow_create_list(struct map_session_data *sd)
/// 1 = success
static void clif_statusupack(struct map_session_data *sd, int type, int ok, int val)
{
- int fd;
-
nullpo_retv(sd);
+ int fd = sd->fd;
- fd=sd->fd;
- WFIFOHEAD(fd,packet_len(0xbc));
- WFIFOW(fd,0)=0xbc;
- WFIFOW(fd,2)=type;
- WFIFOB(fd,4)=ok;
- WFIFOB(fd,5)=cap_value(val,0,UINT8_MAX);
- WFIFOSET(fd,packet_len(0xbc));
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_STATUS_CHANGE_ACK));
+ struct PACKET_ZC_STATUS_CHANGE_ACK *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_STATUS_CHANGE_ACK;
+ p->sp = type;
+ p->ok = ok;
+ p->value = cap_value(val, 0, UINT8_MAX);
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_STATUS_CHANGE_ACK));
}
/// Notifies the client about the result of a request to equip an item (ZC_REQ_WEAR_EQUIP_ACK).
@@ -9482,7 +9479,8 @@ static void clif_mobname_normal_ack(int fd, struct block_list *bl)
struct PACKET_ZC_ACK_REQNAME_TITLE packet = { 0 };
packet.packet_id = HEADER_ZC_ACK_REQNAME_TITLE;
packet.gid = bl->id;
- memcpy(packet.name, BL_UCCAST(BL_MOB, bl)->db->name, NAME_LENGTH);
+ const struct mob_data *md = BL_UCCAST(BL_MOB, bl);
+ memcpy(packet.name, md->name, NAME_LENGTH);
#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130
struct unit_data *ud = unit->bl2ud(bl);
if (ud != NULL) {
@@ -10825,7 +10823,7 @@ static void clif_hotkeysAll_send(struct map_session_data *sd)
{
#ifdef HOTKEY_SAVING
clif->hotkeys(sd, 0);
-#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508 || PACKETVER_ZERO_NUM >= 20190605
// send second tab only if data exists
for (int i = MAX_HOTKEYS; i < MAX_HOTKEYS * 2; i++) {
if (sd->status.hotkeys[i].type != 0 || sd->status.hotkeys[i].id != 0 || sd->status.hotkeys[i].lv != 0) {
@@ -10854,7 +10852,7 @@ static void clif_hotkeys_send(struct map_session_data *sd, int tab)
else
p.rotate = sd->status.hotkey_rowshift2;
#endif
-#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508 || PACKETVER_ZERO_NUM >= 20190605
p.tab = tab;
#endif
const int offset = tab * MAX_HOTKEYS;
@@ -10879,7 +10877,7 @@ static void clif_parse_HotkeyRowShift1(int fd, struct map_session_data *sd)
static void clif_parse_HotkeyRowShift2(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
static void clif_parse_HotkeyRowShift2(int fd, struct map_session_data *sd)
{
-#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508 || PACKETVER_ZERO_NUM >= 20190605
const struct PACKET_CZ_SHORTCUTKEYBAR_ROTATE2 *p = RFIFOP(fd, 0);
if (p->tab == 0)
sd->status.hotkey_rowshift = p->rowshift;
@@ -10911,7 +10909,7 @@ static void clif_parse_Hotkey2(int fd, struct map_session_data *sd) __attribute_
static void clif_parse_Hotkey2(int fd, struct map_session_data *sd)
{
#ifdef HOTKEY_SAVING
-#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508
+#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190508 || PACKETVER_ZERO_NUM >= 20190605
const struct PACKET_CZ_SHORTCUT_KEY_CHANGE2 *p = RFIFOP(fd, 0);
const unsigned short idx = p->index + p->tab * MAX_HOTKEYS;
Assert_retv(idx < MAX_HOTKEYS_DB);
@@ -15724,60 +15722,95 @@ static void clif_parse_PVPInfo(int fd, struct map_session_data *sd)
/// Ranking list
/// ranking pointlist { <name>.24B <point>.L }*10
-static void clif_ranklist_sub(unsigned char *buf, enum fame_list_type type)
+static void clif_ranklist_sub(struct PACKET_ZC_ACK_RANKING_sub *ranks, enum fame_list_type type)
{
- const char* name;
- struct fame_list* list;
- int i;
+#if !(PACKETVER_RE_NUM >= 20190703 || PACKETVER_ZERO_NUM >= 20190724)
+ nullpo_retv(ranks);
- nullpo_retv(buf);
- switch( type ) {
+ struct fame_list* list;
+ switch (type) {
case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break;
case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break;
case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break;
default: return; // Unsupported
}
+ int i;
// Packet size limits this list to 10 elements. [Skotlex]
- for( i = 0; i < 10 && i < MAX_FAME_LIST; i++ ) {
- if( list[i].id > 0 ) {
- if( strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != NULL ) {
- strncpy(WBUFP(buf, 24 * i), name, NAME_LENGTH);
+ for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
+ if (list[i].id > 0) {
+ const char* name;
+ if (strcmp(list[i].name, "-") == 0 && (name = map->charid2nick(list[i].id)) != NULL) {
+ strncpy(ranks[i].name, name, NAME_LENGTH);
} else {
- strncpy(WBUFP(buf, 24 * i), list[i].name, NAME_LENGTH);
+ strncpy(ranks[i].name, list[i].name, NAME_LENGTH);
}
} else {
- strncpy(WBUFP(buf, 24 * i), "None", 5);
+ strncpy(ranks[i].name, "None", 5);
}
- WBUFL(buf, 24 * 10 + i * 4) = list[i].fame; //points
+ ranks[i].points = list[i].fame; //points
}
- for( ;i < 10; i++ ) { // In case the MAX is less than 10.
- strncpy(WBUFP(buf, 24 * i), "Unavailable", 12);
- WBUFL(buf, 24 * 10 + i * 4) = 0;
+ for (;i < 10; i++) { // In case the MAX is less than 10.
+ strncpy(ranks[i].name, "Unavailable", 12);
+ ranks[i].points = 0;
}
+#endif
+}
+
+static void clif_ranklist_sub2(uint32 *chars, uint32 *points, enum fame_list_type type)
+{
+#if PACKETVER_RE_NUM >= 20190703 || PACKETVER_ZERO_NUM >= 20190724
+ nullpo_retv(chars);
+ nullpo_retv(points);
+
+ struct fame_list* list;
+ switch (type) {
+ case RANKTYPE_BLACKSMITH: list = pc->smith_fame_list; break;
+ case RANKTYPE_ALCHEMIST: list = pc->chemist_fame_list; break;
+ case RANKTYPE_TAEKWON: list = pc->taekwon_fame_list; break;
+ default: return; // Unsupported
+ }
+
+ int i;
+ // Packet size limits this list to 10 elements. [Skotlex]
+ for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
+ if (list[i].id > 0) {
+ chars[i] = list[i].id;
+ } else {
+ chars[i] = 0;
+ }
+ points[i] = list[i].fame; //points
+ }
+ for (;i < 10; i++) { // In case the MAX is less than 10.
+ chars[i] = 0;
+ points[i] = 0;
+ }
+#endif
}
/// 097d <RankingType>.W {<CharName>.24B <point>L}*10 <mypoint>L (ZC_ACK_RANKING)
static void clif_ranklist(struct map_session_data *sd, enum fame_list_type type)
{
-#if PACKETVER >= 20120502
- int fd;
- int len = packet_len(0x97d);
-
+#if PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO)
nullpo_retv(sd);
- fd = sd->fd;
- WFIFOHEAD(fd, len);
- WFIFOW(fd, 0) = 0x97d;
- WFIFOW(fd, 2) = type;
- clif_ranklist_sub(WFIFOP(fd,4), type);
+ int fd = sd->fd;
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_RANKING));
+ struct PACKET_ZC_ACK_RANKING *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_ACK_RANKING;
+ p->rankType = type;
+#if PACKETVER_RE_NUM >= 20190703 || PACKETVER_ZERO_NUM >= 20190724
+ clif->ranklist_sub2(p->chars, p->points, type);
+#else
+ clif->ranklist_sub(p->ranks, type);
+#endif
if (pc->famelist_type(sd->job) == type) {
- WFIFOL(fd, 284) = sd->status.fame; //mypoint
+ p->myPoints = sd->status.fame; //mypoint
} else {
- WFIFOL(fd, 284) = 0; //mypoint
+ p->myPoints = 0; //mypoint
}
- WFIFOSET(fd, len);
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_RANKING));
#endif
}
@@ -15827,14 +15860,16 @@ static void clif_update_rankingpoint(struct map_session_data *sd, enum fame_list
/// 0219 { <name>.24B }*10 { <point>.L }*10
static void clif_blacksmith(struct map_session_data *sd)
{
+#if !(PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO))
int fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x219));
WFIFOW(fd,0) = 0x219;
- clif_ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH);
+ clif->ranklist_sub(WFIFOP(fd, 2), RANKTYPE_BLACKSMITH);
WFIFOSET(fd, packet_len(0x219));
+#endif
}
static void clif_parse_Blacksmith(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -15864,14 +15899,16 @@ static void clif_fame_blacksmith(struct map_session_data *sd, int points)
/// 021a { <name>.24B }*10 { <point>.L }*10
static void clif_alchemist(struct map_session_data *sd)
{
+#if !(PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO))
int fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x21a));
WFIFOW(fd,0) = 0x21a;
- clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST);
+ clif->ranklist_sub(WFIFOP(fd,2), RANKTYPE_ALCHEMIST);
WFIFOSET(fd, packet_len(0x21a));
+#endif
}
static void clif_parse_Alchemist(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -15901,14 +15938,16 @@ static void clif_fame_alchemist(struct map_session_data *sd, int points)
/// 0226 { <name>.24B }*10 { <point>.L }*10
static void clif_taekwon(struct map_session_data *sd)
{
+#if !(PACKETVER_MAIN_NUM >= 20130605 || PACKETVER_RE_NUM >= 20130529 || defined(PACKETVER_ZERO))
int fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x226));
WFIFOW(fd,0) = 0x226;
- clif_ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON);
+ clif->ranklist_sub(WFIFOP(fd,2), RANKTYPE_TAEKWON);
WFIFOSET(fd, packet_len(0x226));
+#endif
}
static void clif_parse_Taekwon(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -19029,27 +19068,30 @@ static void clif_parse_debug(int fd, struct map_session_data *sd)
*------------------------------------------*/
static int clif_elementalconverter_list(struct map_session_data *sd)
{
- int i,c,view,fd;
-
nullpo_ret(sd);
/// Main client packet processing function
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_SKILL_PRODUCE_DB *2+4);
- WFIFOW(fd, 0)=0x1ad;
+ int fd = sd->fd;
+ int len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_MAKINGARROW_LIST *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_MAKINGARROW_LIST;
- for(i=0,c=0;i<MAX_SKILL_PRODUCE_DB;i++){
- if( skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ){
- if((view = itemdb_viewid(skill->dbs->produce_db[i].nameid)) > 0)
- WFIFOW(fd,c*2+ 4)= view;
+ int c = 0;
+ for (int i = 0; i < MAX_SKILL_PRODUCE_DB; i++) {
+ if (skill->can_produce_mix(sd,skill->dbs->produce_db[i].nameid,23, 1) ) {
+ int view = itemdb_viewid(skill->dbs->produce_db[i].nameid);
+ if (view > 0)
+ p->items[c].itemId = view;
else
- WFIFOW(fd,c*2+ 4)= skill->dbs->produce_db[i].nameid;
+ p->items[c].itemId = skill->dbs->produce_db[i].nameid;
c++;
}
}
- WFIFOW(fd,2) = c*2+4;
- WFIFOSET(fd, WFIFOW(fd,2));
if (c > 0) {
+ len = c * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
sd->menuskill_id = SA_CREATECON;
sd->menuskill_val = c;
}
@@ -19080,33 +19122,33 @@ static void clif_millenniumshield(struct block_list *bl, short shields)
*------------------------------------------*/
static int clif_spellbook_list(struct map_session_data *sd)
{
- int i, c;
- int fd;
-
nullpo_ret(sd);
- fd = sd->fd;
- WFIFOHEAD(fd, 8 * 8 + 8);
- WFIFOW(fd,0) = 0x1ad;
+ int fd = sd->fd;
+ int len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_MAKINGARROW_LIST *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_MAKINGARROW_LIST;
- for (i = 0, c = 0; i < sd->status.inventorySize; i ++ )
+ int c = 0;
+ for (int i = 0; i < sd->status.inventorySize; i ++ )
{
- if( itemdb_is_spellbook(sd->status.inventory[i].nameid) )
+ if (itemdb_is_spellbook(sd->status.inventory[i].nameid))
{
- WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid;
+ p->items[c].itemId = sd->status.inventory[i].nameid;
c++;
}
}
- if( c > 0 )
+ if (c > 0)
{
- WFIFOW(fd,2) = c * 2 + 4;
- WFIFOSET(fd, WFIFOW(fd, 2));
+ len = c * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
sd->menuskill_id = WL_READING_SB;
sd->menuskill_val = c;
- }
- else{
- status_change_end(&sd->bl,SC_STOP,INVALID_TIMER);
+ } else {
+ status_change_end(&sd->bl, SC_STOP, INVALID_TIMER);
clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0, 0);
}
@@ -19121,17 +19163,18 @@ static int clif_spellbook_list(struct map_session_data *sd)
static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y)
{
int i, c;
- int fd;
nullpo_ret(sd);
- fd = sd->fd;
- WFIFOHEAD(fd, 8 * 8 + 8);
- WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil]
+ int fd = sd->fd;
+ int len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_MAKINGARROW_LIST *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_MAKINGARROW_LIST;
for (i = 0, c = 0; i < sd->status.inventorySize; i ++) {
- if( itemdb_is_element(sd->status.inventory[i].nameid) ) {
- WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid;
+ if (itemdb_is_element(sd->status.inventory[i].nameid)) {
+ p->items[c].itemId = sd->status.inventory[i].nameid;
c ++;
}
}
@@ -19140,8 +19183,10 @@ static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, sh
sd->menuskill_val = skill_lv;
sd->sc.comet_x = x;
sd->sc.comet_y = y;
- WFIFOW(fd,2) = c * 2 + 4;
- WFIFOSET(fd, WFIFOW(fd, 2));
+
+ len = c * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
} else {
clif->skill_fail(sd, NC_MAGICDECOY, USESKILL_FAIL_LEVEL, 0, 0);
return 0;
@@ -19158,25 +19203,28 @@ static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, sh
static int clif_poison_list(struct map_session_data *sd, uint16 skill_lv)
{
int i, c;
- int fd;
nullpo_ret(sd);
- fd = sd->fd;
- WFIFOHEAD(fd, 8 * 8 + 8);
- WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil]
+ int fd = sd->fd;
+ int len = MAX_SKILL_ARROW_DB * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ WFIFOHEAD(fd, len);
+ struct PACKET_ZC_MAKINGARROW_LIST *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_MAKINGARROW_LIST;
for (i = 0, c = 0; i < sd->status.inventorySize; i ++) {
if( itemdb_is_poison(sd->status.inventory[i].nameid) ) {
- WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid;
+ p->items[c].itemId = sd->status.inventory[i].nameid;
c ++;
}
}
- if( c > 0 ) {
+ if (c > 0) {
sd->menuskill_id = GC_POISONINGWEAPON;
sd->menuskill_val = skill_lv;
- WFIFOW(fd,2) = c * 2 + 4;
- WFIFOSET(fd, WFIFOW(fd, 2));
+
+ len = c * sizeof(struct PACKET_ZC_MAKINGARROW_LIST_sub) + sizeof(struct PACKET_ZC_MAKINGARROW_LIST);
+ p->packetLength = len;
+ WFIFOSET(fd, len);
} else {
clif->skill_fail(sd, GC_POISONINGWEAPON, USESKILL_FAIL_GUILLONTINE_POISON, 0, 0);
return 0;
@@ -21935,53 +21983,47 @@ static void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, ui
/// 0A3B <Length>.W <AID>.L <Status>.B { <HatEffectId>.W }
static void clif_hat_effect(struct block_list *bl, struct block_list *tbl, enum send_target target)
{
-#if PACKETVER >= 20150422
- unsigned char *buf;
- int len, i;
- struct map_session_data *sd;
-
+#if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
nullpo_retv(bl);
-
- sd = BL_CAST(BL_PC, bl);
-
+ struct map_session_data *sd = BL_CAST(BL_PC, bl);
nullpo_retv(sd);
- len = 9 + VECTOR_LENGTH(sd->hatEffectId) * 2;
+ const int len = sizeof(struct PACKET_ZC_HAT_EFFECT) + VECTOR_LENGTH(sd->hatEffectId) * 2;
+ struct PACKET_ZC_HAT_EFFECT *p = aMalloc(len);
- buf = (unsigned char*)aMalloc(len);
-
- WBUFW(buf, 0) = 0xa3b;
- WBUFW(buf, 2) = len;
- WBUFL(buf, 4) = bl->id;
- WBUFB(buf, 8) = 1;
+ p->packetType = HEADER_ZC_HAT_EFFECT;
+ p->packetLength = len;
+ p->aid = bl->id;
+ p->status = 1;
- for( i = 0; i < VECTOR_LENGTH(sd->hatEffectId); i++ ){
- WBUFW(buf, 9 + i * 2) = VECTOR_INDEX(sd->hatEffectId, i);
+ for (int i = 0; i < VECTOR_LENGTH(sd->hatEffectId); i++) {
+ p->effects[i] = VECTOR_INDEX(sd->hatEffectId, i);
}
if (tbl != NULL) {
- clif->send(buf, len, tbl, target);
+ clif->send(p, len, tbl, target);
} else {
- clif->send(buf, len, bl, target);
+ clif->send(p, len, bl, target);
}
-
- aFree(buf);
+ aFree(p);
#endif
}
static void clif_hat_effect_single(struct block_list *bl, uint16 effectId, bool enable){
-#if PACKETVER >= 20150422
- unsigned char buf[13];
-
+#if PACKETVER_MAIN_NUM >= 20150507 || PACKETVER_RE_NUM >= 20150429 || defined(PACKETVER_ZERO)
nullpo_retv(bl);
- WBUFW(buf,0) = 0xa3b;
- WBUFW(buf,2) = 13;
- WBUFL(buf,4) = bl->id;
- WBUFB(buf,8) = enable;
- WBUFL(buf,9) = effectId;
+ const int len = sizeof(struct PACKET_ZC_HAT_EFFECT) + 2;
+ struct PACKET_ZC_HAT_EFFECT *p = aMalloc(len);
- clif->send(buf, 13, bl, AREA);
+ p->packetType = HEADER_ZC_HAT_EFFECT;
+ p->packetLength = len;
+ p->aid = bl->id;
+ p->status = enable;
+ p->effects[0] = effectId;
+
+ clif->send(p, len, bl, AREA);
+ aFree(p);
#endif
}
@@ -23119,6 +23161,8 @@ void clif_defaults(void)
clif->fame_alchemist = clif_fame_alchemist;
clif->fame_taekwon = clif_fame_taekwon;
clif->ranklist = clif_ranklist;
+ clif->ranklist_sub = clif_ranklist_sub;
+ clif->ranklist_sub2 = clif_ranklist_sub2;
clif->pRanklist = clif_parse_ranklist;
clif->update_rankingpoint = clif_update_rankingpoint;
clif->hotkeys = clif_hotkeys_send;