summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2015-01-24 00:54:00 +0100
committerHaruna <haru@dotalux.com>2015-01-24 00:54:00 +0100
commit1ae4a7184bee7897a318adca6f0941c9c697b78a (patch)
tree00b612493d44b30e20afdaa049188e33f738df18 /src/map/clif.c
parent21e3b27ba67b74bc106eb83e26d23255a363ce59 (diff)
parent49df787e2c2faa2621b5490c6e88c86a4b7a813f (diff)
downloadhercules-1ae4a7184bee7897a318adca6f0941c9c697b78a.tar.gz
hercules-1ae4a7184bee7897a318adca6f0941c9c697b78a.tar.bz2
hercules-1ae4a7184bee7897a318adca6f0941c9c697b78a.tar.xz
hercules-1ae4a7184bee7897a318adca6f0941c9c697b78a.zip
Merge pull request #449 from HerculesWS/questdb
Converted the Quest DB to libconfig. Added support for quest-granted item drops
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 268066d1a..291b5cb46 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -15829,7 +15829,8 @@ void clif_parse_PartyTick(int fd, struct map_session_data* sd)
/// Sends list of all quest states (ZC_ALL_QUEST_LIST).
/// 02b1 <packet len>.W <num>.L { <quest id>.L <active>.B }*num
-void clif_quest_send_list(struct map_session_data *sd) {
+void clif_quest_send_list(struct map_session_data *sd)
+{
int fd = sd->fd;
int i;
#if PACKETVER >= 20141022
@@ -15846,7 +15847,7 @@ void clif_quest_send_list(struct map_session_data *sd) {
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = sd->avail_quests;
- for( i = 0; i < sd->avail_quests; i++ ) {
+ for (i = 0; i < sd->avail_quests; i++) {
#if PACKETVER >= 20141022
struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
#endif
@@ -15855,7 +15856,7 @@ void clif_quest_send_list(struct map_session_data *sd) {
#if PACKETVER >= 20141022
WFIFOL(fd, i*info_len+13) = sd->quest_log[i].time - qi->time;
WFIFOL(fd, i*info_len+17) = sd->quest_log[i].time;
- WFIFOW(fd, i*info_len+21) = qi->num_objectives;
+ WFIFOW(fd, i*info_len+21) = qi->objectives_count;
#endif
}
@@ -15865,7 +15866,8 @@ void clif_quest_send_list(struct map_session_data *sd) {
/// Sends list of all quest missions (ZC_ALL_QUEST_MISSION).
/// 02b2 <packet len>.W <num>.L { <quest id>.L <start time>.L <expire time>.L <mobs>.W { <mob id>.L <mob count>.W <mob name>.24B }*3 }*num
-void clif_quest_send_mission(struct map_session_data *sd) {
+void clif_quest_send_mission(struct map_session_data *sd)
+{
int fd = sd->fd;
int i, j;
int len = sd->avail_quests*104+8;
@@ -15876,17 +15878,17 @@ void clif_quest_send_mission(struct map_session_data *sd) {
WFIFOW(fd, 2) = len;
WFIFOL(fd, 4) = sd->avail_quests;
- for( i = 0; i < sd->avail_quests; i++ ) {
+ for (i = 0; i < sd->avail_quests; i++) {
struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id;
WFIFOL(fd, i*104+12) = sd->quest_log[i].time - qi->time;
WFIFOL(fd, i*104+16) = sd->quest_log[i].time;
- WFIFOW(fd, i*104+20) = qi->num_objectives;
+ WFIFOW(fd, i*104+20) = qi->objectives_count;
- for( j = 0 ; j < qi->num_objectives; j++ ) {
- WFIFOL(fd, i*104+22+j*30) = qi->mob[j];
+ for (j = 0 ; j < qi->objectives_count; j++) {
+ WFIFOL(fd, i*104+22+j*30) = qi->objectives[j].mob;
WFIFOW(fd, i*104+26+j*30) = sd->quest_log[i].count[j];
- monster = mob->db(qi->mob[j]);
+ monster = mob->db(qi->objectives[j].mob);
memcpy(WFIFOP(fd, i*104+28+j*30), monster->jname, NAME_LENGTH);
}
}
@@ -15897,7 +15899,8 @@ void clif_quest_send_mission(struct map_session_data *sd) {
/// Notification about a new quest (ZC_ADD_QUEST).
/// 02b3 <quest id>.L <active>.B <start time>.L <expire time>.L <mobs>.W { <mob id>.L <mob count>.W <mob name>.24B }*3
-void clif_quest_add(struct map_session_data *sd, struct quest *qd) {
+void clif_quest_add(struct map_session_data *sd, struct quest *qd)
+{
int fd = sd->fd;
int i;
struct quest_db *qi = quest->db(qd->quest_id);
@@ -15908,13 +15911,13 @@ void clif_quest_add(struct map_session_data *sd, struct quest *qd) {
WFIFOB(fd, 6) = qd->state;
WFIFOB(fd, 7) = qd->time - qi->time;
WFIFOL(fd, 11) = qd->time;
- WFIFOW(fd, 15) = qi->num_objectives;
+ WFIFOW(fd, 15) = qi->objectives_count;
- for( i = 0; i < qi->num_objectives; i++ ) {
+ for (i = 0; i < qi->objectives_count; i++) {
struct mob_db *monster;
- WFIFOL(fd, i*30+17) = qi->mob[i];
+ WFIFOL(fd, i*30+17) = qi->objectives[i].mob;
WFIFOW(fd, i*30+21) = qd->count[i];
- monster = mob->db(qi->mob[i]);
+ monster = mob->db(qi->objectives[i].count);
memcpy(WFIFOP(fd, i*30+23), monster->jname, NAME_LENGTH);
}
@@ -15936,21 +15939,22 @@ void clif_quest_delete(struct map_session_data *sd, int quest_id) {
/// Notification of an update to the hunting mission counter (ZC_UPDATE_MISSION_HUNT).
/// 02b5 <packet len>.W <mobs>.W { <quest id>.L <mob id>.L <total count>.W <current count>.W }*3
-void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd) {
+void clif_quest_update_objective(struct map_session_data *sd, struct quest *qd)
+{
int fd = sd->fd;
int i;
struct quest_db *qi = quest->db(qd->quest_id);
- int len = qi->num_objectives*12+6;
+ int len = qi->objectives_count*12+6;
WFIFOHEAD(fd, len);
WFIFOW(fd, 0) = 0x2b5;
WFIFOW(fd, 2) = len;
- WFIFOW(fd, 4) = qi->num_objectives;
+ WFIFOW(fd, 4) = qi->objectives_count;
- for( i = 0; i < qi->num_objectives; i++ ) {
+ for (i = 0; i < qi->objectives_count; i++) {
WFIFOL(fd, i*12+6) = qd->quest_id;
- WFIFOL(fd, i*12+10) = qi->mob[i];
- WFIFOW(fd, i*12+14) = qi->count[i];
+ WFIFOL(fd, i*12+10) = qi->objectives[i].mob;
+ WFIFOW(fd, i*12+14) = qi->objectives[i].count;
WFIFOW(fd, i*12+16) = qd->count[i];
}