From 1a4327551900db5e2ecbb754bef7c05f4edfc6dd Mon Sep 17 00:00:00 2001 From: Asheraf Date: Sun, 5 Nov 2017 00:51:34 +0000 Subject: Implement Homunculus autofeeding --- src/map/clif.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 1b7d94ca9..eb6b46bec 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9030,14 +9030,15 @@ void clif_feel_hate_reset(struct map_session_data *sd) clif->starskill(sd, "", 0, 0, 30); } -/// Equip window (un)tick ack (ZC_CONFIG). +/// Send configurations (ZC_CONFIG). /// 02d9 .L .L /// type: /// 0 = open equip window +/// 3 = homunculus autofeeding /// value: /// 0 = disabled /// 1 = enabled -void clif_equiptickack(struct map_session_data* sd, int flag) +void clif_zc_config(struct map_session_data* sd, int type, int flag) { int fd; nullpo_retv(sd); @@ -9045,7 +9046,7 @@ void clif_equiptickack(struct map_session_data* sd, int flag) WFIFOHEAD(fd, packet_len(0x2d9)); WFIFOW(fd, 0) = 0x2d9; - WFIFOL(fd, 2) = 0; + WFIFOL(fd, 2) = type; WFIFOL(fd, 6) = flag; WFIFOSET(fd, packet_len(0x2d9)); } @@ -15929,19 +15930,32 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC); } -void clif_parse_EquipTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); -/// Request to change equip window tick (CZ_CONFIG). +void clif_parse_cz_config(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +/// Receive configurations (CZ_CONFIG). /// 02d8 .L .L /// type: /// 0 = open equip window +/// 3 = homunculus autofeeding /// value: /// 0 = disabled /// 1 = enabled -void clif_parse_EquipTick(int fd, struct map_session_data* sd) -{ - bool flag = (RFIFOL(fd,6) != 0) ? true : false; - sd->status.show_equip = flag; - clif->equiptickack(sd, flag); +void clif_parse_cz_config(int fd, struct map_session_data *sd) +{ + int type = RFIFOL(fd, 2); + int flag = RFIFOL(fd, 6); + + if (type == CZ_CONFIG_OPEN_EQUIPMENT_WINDOW) { + sd->status.show_equip = flag; + } else if (type == CZ_CONFIG_HOMUNCULUS_AUTOFEEDING) { + struct homun_data *hd; + hd = sd->hd; + nullpo_retv(hd); + hd->homunculus.autofeed = flag; + } else { + ShowWarning("clif_parse_cz_config: Unsupported type has been received (%d).", type); + return; + } + clif->zc_config(sd, type, flag); } void clif_parse_PartyTick(int fd, struct map_session_data* sd) __attribute__((nonnull (2))); @@ -20305,7 +20319,7 @@ void clif_defaults(void) { clif->mission_info = clif_mission_info; clif->feel_hate_reset = clif_feel_hate_reset; clif->partytickack = clif_partytickack; - clif->equiptickack = clif_equiptickack; + clif->zc_config = clif_zc_config; clif->viewequip_ack = clif_viewequip_ack; clif->equpcheckbox = clif_equpcheckbox; clif->displayexp = clif_displayexp; @@ -20830,7 +20844,7 @@ void clif_defaults(void) { clif->pAdopt_request = clif_parse_Adopt_request; clif->pAdopt_reply = clif_parse_Adopt_reply; clif->pViewPlayerEquip = clif_parse_ViewPlayerEquip; - clif->pEquipTick = clif_parse_EquipTick; + clif->p_cz_config = clif_parse_cz_config; clif->pquestStateAck = clif_parse_questStateAck; clif->pmercenary_action = clif_parse_mercenary_action; clif->pBattleChat = clif_parse_BattleChat; -- cgit v1.2.3-70-g09d2