summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorDastgir <dastgirpojee@rocketmail.com>2016-01-18 17:36:25 +0530
committerAsheraf <acheraf1998@gmail.com>2018-03-13 07:52:57 +0000
commitd02ebf0532fe251bfac6c6aec78e72eb64156bd7 (patch)
tree44f4b87e9a429a97008386026a04beee7bb786a5 /src/map/clif.c
parent974c7f982484341b58bf85c517bc81ab3b0e5ebe (diff)
downloadhercules-d02ebf0532fe251bfac6c6aec78e72eb64156bd7.tar.gz
hercules-d02ebf0532fe251bfac6c6aec78e72eb64156bd7.tar.bz2
hercules-d02ebf0532fe251bfac6c6aec78e72eb64156bd7.tar.xz
hercules-d02ebf0532fe251bfac6c6aec78e72eb64156bd7.zip
Added quest_notify_objective and its packet
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 8adb24450..60300db37 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -16327,6 +16327,43 @@ void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd)
aFree(buf);
}
+/// Notification of an hunting mission counter just after quest is added (ZC_HUNTING_QUEST_INFO).
+/// 08fe <packet len>.W { <quest id>.L <mob id>.L <total count>.W <current count>.W }*3
+void clif_quest_notify_objective(struct map_session_data *sd, struct quest *qd)
+{
+ int i, len, real_len;
+ uint8 *buf = NULL;
+ struct packet_quest_hunt_info *packet = NULL;
+ struct quest_db *qi;
+
+ nullpo_retv(sd);
+ nullpo_retv(qd);
+
+ qi = quest->db(qd->quest_id);
+ Assert_retv(qi->objectives_count < MAX_QUEST_OBJECTIVES);
+
+ len = sizeof(struct packet_quest_hunt_info)
+ + MAX_QUEST_OBJECTIVES * sizeof(struct packet_quest_hunt_info_sub); // >= than the actual length
+
+ buf = aCalloc(1, len);
+ packet = (struct packet_quest_hunt_info *)WBUFP(buf, 0);
+ real_len = sizeof(*packet);
+
+ packet->PacketType = questUpdateType2;
+
+ for (i = 0; i < qi->objectives_count; i++) {
+ real_len += sizeof(packet->info[i]);
+
+ packet->info[i].questID = qd->quest_id;
+ packet->info[i].mob_id = qi->objectives[i].mob;
+ packet->info[i].maxCount = qi->objectives[i].count;
+ packet->info[i].count = qd->count[i];
+ }
+ packet->PacketLength = real_len;
+ clif->send(buf, real_len, &sd->bl, SELF);
+ aFree(buf);
+}
+
void clif_parse_questStateAck(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
/// Request to change the state of a quest (CZ_ACTIVE_QUEST).
/// 02b6 <quest id>.L <active>.B
@@ -20966,6 +21003,7 @@ void clif_defaults(void) {
clif->quest_delete = clif_quest_delete;
clif->quest_update_status = clif_quest_update_status;
clif->quest_update_objective = clif_quest_update_objective;
+ clif->quest_notify_objective = clif_quest_notify_objective;
clif->quest_show_event = clif_quest_show_event;
/* mail-related */
clif->mail_window = clif_Mail_window;