diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 115 |
1 files changed, 87 insertions, 28 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 847bca096..3bdea3f7f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -41,6 +41,7 @@ #include "map/mail.h" #include "map/map.h" #include "map/mercenary.h" +#include "map/messages.h" #include "map/mob.h" #include "map/npc.h" #include "map/party.h" @@ -5638,8 +5639,8 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id clif_menuskill_clear(sd); if( skill_id != AM_PHARMACY ) { // AM_PHARMACY is used to Cooking. // It fails. -#if PACKETVER >= 20090922 - clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL); +#if PACKETVER >= 20091013 + clif->msgtable_skill(sd, skill_id, MSG_SKILL_MATERIAL_FAIL); #else WFIFOW(fd,2) = 6 + 2 * c; WFIFOSET(fd,WFIFOW(fd,2)); @@ -9171,7 +9172,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts * @param sd The target character. * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) */ -void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) +void clif_msgtable(struct map_session_data* sd, enum clif_messages msg_id) { int fd; nullpo_retv(sd); @@ -9192,7 +9193,7 @@ void clif_msgtable(struct map_session_data* sd, unsigned short msg_id) * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) * @param value The value to fill %d. */ -void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value) +void clif_msgtable_num(struct map_session_data *sd, enum clif_messages msg_id, int value) { #if PACKETVER >= 20090805 int fd; @@ -9219,7 +9220,7 @@ void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int v * @param skill_id ID of the skill to display. * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) */ -void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id) +void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, enum clif_messages msg_id) { int fd; @@ -9240,7 +9241,7 @@ void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_i * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) * @param value The value to fill %s. */ -void clif_msgtable_str(struct map_session_data *sd, uint16 msg_id, const char *value) +void clif_msgtable_str(struct map_session_data *sd, enum clif_messages msg_id, const char *value) { int message_len; int len; @@ -9270,7 +9271,7 @@ void clif_msgtable_str(struct map_session_data *sd, uint16 msg_id, const char *v * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages) * @param color The color to use */ -void clif_msgtable_color(struct map_session_data *sd, uint16 msg_id, uint32 color) +void clif_msgtable_color(struct map_session_data *sd, enum clif_messages msg_id, uint32 color) { struct PACKET_ZC_MSG_COLOR p; @@ -10922,8 +10923,8 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) return; } if (sd->npc_id || sd->state.workinprogress & 2) { -#if PACKETVER >= 20110309 - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); #else clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif @@ -10939,8 +10940,8 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) break; case BL_NPC: if (sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != INVALID_TIMER) { // TODO: should only work with none 3rd job skills -#if PACKETVER >= 20110309 - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); #else clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif @@ -11336,8 +11337,8 @@ void clif_parse_ChangeCart(int fd, struct map_session_data *sd) return; if (sd->npc_id || sd->state.workinprogress & 1) { -#if PACKETVER >= 20110309 - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); #else clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif @@ -11547,8 +11548,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) pc->update_idle_time(sd, BCIDLE_USESKILLTOID); if (sd->npc_id || sd->state.workinprogress & 1) { -#if PACKETVER >= 20110309 - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); #else clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif @@ -11646,8 +11647,8 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski } if (sd->state.workinprogress & 1) { -#if PACKETVER >= 20110309 - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#if PACKETVER >= 20110308 + clif->msgtable(sd, MSG_BUSY); #else clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif @@ -16139,10 +16140,13 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { if (!tsd) return; - if( tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT) ) + if (tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT)) { clif->viewequip_ack(sd, tsd); - else - clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); + } else { +#if PACKETVER >= 20070918 + clif->msgtable(sd, MSG_OPEN_EQUIPEDITEM_REFUSED); +#endif + } } void clif_parse_cz_config(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -16667,7 +16671,9 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd) /// 3 = Your mercenary soldier has ran away. void clif_mercenary_message(struct map_session_data* sd, int message) { - clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message); +#if PACKETVER >= 20070227 + clif->msgtable(sd, MSG_MER_FINISH + message); +#endif } /// Notification about the remaining time of a rental item (ZC_CASH_TIME_COUNTER). @@ -19996,9 +20002,9 @@ void clif_rodex_send_maillist(int fd, struct map_session_data *sd, int8 open_typ } inner->Titlelength = (int16)strlen(msg->title) + 1; if (open_type != RODEX_OPENTYPE_RETURN) { - strncpy(inner->SenderName, msg->sender_name, sizeof(msg->sender_name)); + strncpy(inner->SenderName, msg->sender_name, sizeof(inner->SenderName)); } else { - strncpy(inner->SenderName, msg->receiver_name, sizeof(msg->receiver_name)); + strncpy(inner->SenderName, msg->receiver_name, sizeof(inner->SenderName)); } strncpy(inner->title, msg->title, inner->Titlelength); size += sizeof(*inner) + inner->Titlelength; @@ -20057,9 +20063,9 @@ void clif_rodex_send_mails_all(int fd, struct map_session_data *sd, int64 mail_i } inner->Titlelength = (int16)strlen(msg->title) + 1; if (msg->opentype != RODEX_OPENTYPE_RETURN) { - strncpy(inner->SenderName, msg->sender_name, sizeof(msg->sender_name)); + strncpy(inner->SenderName, msg->sender_name, sizeof(inner->SenderName)); } else { - strncpy(inner->SenderName, msg->receiver_name, sizeof(msg->receiver_name)); + strncpy(inner->SenderName, msg->receiver_name, sizeof(inner->SenderName)); } strncpy(inner->title, msg->title, inner->Titlelength); size += sizeof(*inner) + inner->Titlelength; @@ -20128,9 +20134,9 @@ void clif_rodex_send_refresh(int fd, struct map_session_data *sd, int8 open_type } inner->Titlelength = (int16)strlen(msg->title) + 1; if (open_type != RODEX_OPENTYPE_RETURN) { - strncpy(inner->SenderName, msg->sender_name, sizeof(msg->sender_name)); + strncpy(inner->SenderName, msg->sender_name, sizeof(inner->SenderName)); } else { - strncpy(inner->SenderName, msg->receiver_name, sizeof(msg->receiver_name)); + strncpy(inner->SenderName, msg->receiver_name, sizeof(inner->SenderName)); } strncpy(inner->title, msg->title, inner->Titlelength); size += sizeof(*inner) + inner->Titlelength; @@ -20513,7 +20519,9 @@ void clif_parse_open_ui_request(int fd, struct map_session_data *sd) const struct PACKET_CZ_OPEN_UI *p = RP2PTR(fd); if (clif->attendance_getendtime() < time(NULL)) { +#if PACKETVER >= 20180207 clif->msgtable_color(sd, MSG_ATTENDANCE_UNAVAILABLE, COLOR_RED); +#endif return; } @@ -20603,6 +20611,11 @@ void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) #endif } +void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +void clif_parse_cz_blocking_play_cancel(int fd, struct map_session_data *sd) +{ +} + void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) { @@ -20616,6 +20629,49 @@ void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data) clif->send(&p, sizeof(p), &sd->bl, SELF); } + +void clif_parse_private_airship_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +void clif_parse_private_airship_request(int fd, struct map_session_data *sd) +{ +#if defined(PACKETVER_RE) && PACKETVER >= 20180321 + char evname[EVENT_NAME_LENGTH]; + struct event_data *ev = NULL; + const struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST *p = RP2PTR(fd); + + safestrncpy(evname, "private_airship::OnAirShipRequest", EVENT_NAME_LENGTH); + if ((ev = strdb_get(npc->ev_db, evname))) { + pc->setregstr(sd, script->add_str("@mapname$"), p->mapName); + pc->setreg(sd, script->add_str("@itemid"), p->ItemID); + script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); + } else { + ShowError("clif_parse_private_airship_request: event '%s' not found, operation failed\n", evname); + } +#else + ShowWarning("clif_parse_private_airship_request: private airship is not supported in this client version, possible packet manipulation."); +#endif +} + +void clif_private_airship_response(struct map_session_data *sd, uint32 flag) +{ +#if defined(PACKETVER_RE) && PACKETVER >= 20180321 + struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE p; + + nullpo_retv(sd); + + if (flag > P_AIRSHIP_ITEM_INVALID) { + ShowError("clif_private_airship_response: invalid flag given '%d', defaulting to 0.\n", flag); + flag = 0; + } + + p.PacketType = 0xA4A; + p.flag = flag; + + clif->send(&p, sizeof(p), &sd->bl, SELF); +#else + ShowWarning("clif_private_airship_response: private airship works only for clients >= 20180321."); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -21629,6 +21685,7 @@ void clif_defaults(void) { clif->pDebug = clif_parse_debug; clif->pSkillSelectMenu = clif_parse_SkillSelectMenu; clif->pMoveItem = clif_parse_MoveItem; + clif->p_cz_blocking_play_cancel = clif_parse_cz_blocking_play_cancel; /* dull */ clif->pDull = clif_parse_dull; /* BGQueue */ @@ -21721,4 +21778,6 @@ void clif_defaults(void) { clif->open_ui = clif_open_ui; clif->pAttendanceRewardRequest = clif_parse_attendance_reward_request; clif->ui_action = clif_ui_action; + clif->pPrivateAirshipRequest = clif_parse_private_airship_request; + clif->PrivateAirshipResponse = clif_private_airship_response; } |