summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-26 02:26:12 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-26 02:26:12 +0300
commit57c278053e43fbce8d2bdf285b5c381f653e2751 (patch)
tree3de34fe4d6a324394bfc543dfefa9eab296d3ec9
parent8d7121b69613e72e70acf0c272dcead070def769 (diff)
downloadevol-hercules-57c278053e43fbce8d2bdf285b5c381f653e2751.tar.gz
evol-hercules-57c278053e43fbce8d2bdf285b5c381f653e2751.tar.bz2
evol-hercules-57c278053e43fbce8d2bdf285b5c381f653e2751.tar.xz
evol-hercules-57c278053e43fbce8d2bdf285b5c381f653e2751.zip
add support for clients with version >= 20 for quests packets with extended info.
-rw-r--r--src/emap/clif.c101
1 files changed, 74 insertions, 27 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 8bff4c7..a62c47f 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -82,28 +82,56 @@ void eclif_quest_send_list_pre(TBL_PC **sdPtr)
return;
}
- int fd = sd->fd;
- int i;
- int info_len = 15;
- int len = sd->avail_quests * info_len + 8;
- WFIFOHEAD(fd,len);
- WFIFOW(fd, 0) = 0x97a;
- WFIFOW(fd, 2) = len;
- WFIFOL(fd, 4) = sd->avail_quests;
-
- for (i = 0; i < sd->avail_quests; i++ )
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return;
+ if (data->clientVersion < 20)
{
- struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
- if (!qi)
- continue;
- WFIFOL(fd, i * info_len + 8) = sd->quest_log[i].quest_id;
- WFIFOB(fd, i * info_len + 12) = sd->quest_log[i].count[0]; // was state
- 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) = 0;
+ int fd = sd->fd;
+ int i;
+ int info_len = 15;
+ int len = sd->avail_quests * info_len + 8;
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = 0x97a;
+ WFIFOW(fd, 2) = len;
+ WFIFOL(fd, 4) = sd->avail_quests;
+ for (i = 0; i < sd->avail_quests; i++ )
+ {
+ struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
+ if (!qi)
+ continue;
+ WFIFOL(fd, i * info_len + 8) = sd->quest_log[i].quest_id;
+ WFIFOB(fd, i * info_len + 12) = sd->quest_log[i].count[0]; // was state
+ 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) = 0;
+ }
+ WFIFOSET(fd, len);
+ }
+ else
+ { // data->clientVersion >= 20
+ int fd = sd->fd;
+ int info_len = 4 + 1 + 3 * 4 + 4;
+ int len = sd->avail_quests * info_len + 8;
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = 0xb23;
+ WFIFOW(fd, 2) = len;
+ WFIFOL(fd, 4) = sd->avail_quests;
+ for (int i = 0; i < sd->avail_quests; i++ )
+ {
+ struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
+ if (!qi)
+ continue;
+ WFIFOL(fd, i * info_len + 8) = sd->quest_log[i].quest_id;
+ WFIFOB(fd, i * info_len + 12) = sd->quest_log[i].state;
+ WFIFOL(fd, i * info_len + 13) = sd->quest_log[i].count[0];
+ WFIFOL(fd, i * info_len + 17) = sd->quest_log[i].count[1];
+ WFIFOL(fd, i * info_len + 21) = sd->quest_log[i].count[2];
+ WFIFOL(fd, i * info_len + 25) = sd->quest_log[i].time;
+ }
+ WFIFOSET(fd, len);
}
- WFIFOSET(fd, len);
hookStop();
}
@@ -116,6 +144,7 @@ void eclif_quest_add_pre(TBL_PC **sdPtr,
void eclif_quest_add(TBL_PC *sd,
struct quest *qd)
{
+ // for new client need send here: id, 3 counts, time
if (!sd || !qd)
{
hookStop();
@@ -130,14 +159,32 @@ void eclif_quest_add(TBL_PC *sd,
return;
}
- WFIFOHEAD(fd, 107);
- WFIFOW(fd, 0) = 0x2b3;
- WFIFOL(fd, 2) = qd->quest_id;
- WFIFOB(fd, 6) = qd->count[0]; // was state;
- WFIFOB(fd, 7) = qd->time - qi->time;
- WFIFOL(fd, 11) = qd->time;
- WFIFOW(fd, 15) = 0;
- WFIFOSET(fd, 107);
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return;
+ if (data->clientVersion < 20)
+ {
+ WFIFOHEAD(fd, 107);
+ WFIFOW(fd, 0) = 0x2b3;
+ WFIFOL(fd, 2) = qd->quest_id;
+ WFIFOB(fd, 6) = qd->count[0]; // was state;
+ WFIFOB(fd, 7) = qd->time - qi->time;
+ WFIFOL(fd, 11) = qd->time;
+ WFIFOW(fd, 15) = 0;
+ WFIFOSET(fd, 107);
+ }
+ else
+ { // data->clientVersion >= 20
+ WFIFOHEAD(fd, 23);
+ WFIFOW(fd, 0) = 0xb24;
+ WFIFOL(fd, 2) = qd->quest_id;
+ WFIFOB(fd, 6) = qd->state;
+ WFIFOL(fd, 7) = qd->count[0];
+ WFIFOL(fd, 11) = qd->count[1];
+ WFIFOL(fd, 15) = qd->count[2];
+ WFIFOL(fd, 19) = qd->time;
+ WFIFOSET(fd, 23);
+ }
hookStop();
}