From 02a755111f9a707cc7fdef81772c74b1d10242b1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 14 Apr 2008 02:32:24 +0000 Subject: Some more updates to the quest log system. It has been completely moved to the inter server instead of the char server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12584 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chrif.c | 1 - src/map/intif.c | 43 ++++++++++++++++++++++++++++++++++++------- src/map/intif.h | 1 + src/map/pc.c | 6 ++---- src/map/quest.c | 17 ----------------- 5 files changed, 39 insertions(+), 29 deletions(-) (limited to 'src/map') diff --git a/src/map/chrif.c b/src/map/chrif.c index 7fbff78e4..2ce7dcf4a 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -600,7 +600,6 @@ void chrif_authok(int fd) { //Auth Ok if (pc_authok(sd, login_id2, expiration_time, status)) { - chrif_char_online(sd); return; } } else { //Auth Failed diff --git a/src/map/intif.c b/src/map/intif.c index 0ce0aa8c1..2d9b1894c 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -37,7 +37,7 @@ static const int packet_len_table[]={ 10,-1,15, 0, 79,19, 7,-1, 0,-1,-1,-1, 14,67,186,-1, //0x3830 9, 9,-1,14, 0, 0, 0, 0, -1,74,-1,11, 11,-1, 0, 0, //0x3840 -1,-1, 7, 7, 7,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3850 Auctions [Zephyrus] - 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] + -1,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3860 Quests [Kevin] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3880 -1,-1, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x3890 Homunculus [albator] @@ -1405,6 +1405,36 @@ QUESTLOG SYSTEM FUNCTIONS ***************************************/ +int intif_request_questlog(TBL_PC *sd) +{ + WFIFOHEAD(inter_fd,6); + WFIFOW(inter_fd,0) = 0x3060; + WFIFOL(inter_fd,2) = sd->status.char_id; + WFIFOSET(inter_fd,6); + return 0; +} + +int intif_parse_questlog(int fd) +{ + + int num_quests = (RFIFOB(fd, 2)-8)/sizeof(struct quest); + int char_id = RFIFOL(fd, 4); + int i; + TBL_PC * sd = map_charid2sd(char_id); + + //User not online anymore + if(!sd) + return 0; + + for(i=0; iquest_log[i], RFIFOP(fd, i*sizeof(struct quest)+8), sizeof(struct quest)); + } + sd->num_quests = num_quests; + + return 0; +} + int intif_parse_questDelete(int fd) { quest_delete_ack(RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOB(fd, 10)); @@ -1434,17 +1464,15 @@ int intif_parse_questAdd(int fd) int intif_quest_add(int char_id, struct quest * qd) { - int sSize = sizeof(struct quest); - if(CheckForCharServer()) return 0; - WFIFOHEAD(inter_fd, sSize + 8); + WFIFOHEAD(inter_fd, sizeof(struct quest) + 8); WFIFOW(inter_fd,0) = 0x3061; - WFIFOW(inter_fd,2) = sSize + 8; + WFIFOW(inter_fd,2) = sizeof(struct quest) + 8; WFIFOL(inter_fd,4) = char_id; - memcpy(WFIFOP(inter_fd,8), qd, sSize); - WFIFOSET(inter_fd, sSize + 8); + memcpy(WFIFOP(inter_fd,8), qd, sizeof(struct quest)); + WFIFOSET(inter_fd, WFIFOW(inter_fd,2)); return 0; } @@ -1992,6 +2020,7 @@ int intif_parse(int fd) case 0x3843: intif_parse_GuildMasterChanged(fd); break; //Quest system + case 0x3860: intif_parse_questlog(fd); break; case 0x3861: intif_parse_questAdd(fd); break; case 0x3862: intif_parse_questDelete(fd); break; diff --git a/src/map/intif.h b/src/map/intif.h index 1827ec00a..c4fe34f20 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -76,6 +76,7 @@ int intif_homunculus_requestsave(int account_id, struct s_homunculus* sh); int intif_homunculus_requestdelete(int homun_id); /******QUEST SYTEM*******/ +int intif_request_questlog(struct map_session_data * sd); int intif_quest_delete(int char_id, int quest_id); int intif_quest_add(int char_id, struct quest * qd); diff --git a/src/map/pc.c b/src/map/pc.c index 32f102b6e..5fc764cb1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -374,7 +374,6 @@ int pc_makesavestatus(struct map_session_data *sd) memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point)); } - quest_make_savedata(sd); return 0; } @@ -866,9 +865,6 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1); } - //Get quest data out of char dat - quest_load_info(sd, st); - // Request all registries (auth is considered completed whence they arrive) intif_request_registry(sd,7); return true; @@ -982,6 +978,8 @@ int pc_reg_received(struct map_session_data *sd) intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox #endif + intif_request_questlog(sd); + if (!sd->state.connect_new && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually. sd->state.connect_new = 1; diff --git a/src/map/quest.c b/src/map/quest.c index 25c879105..51082532f 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -190,20 +190,3 @@ int quest_update_status(TBL_PC * sd, int quest_id, bool status) return 0; } - -int quest_load_info(TBL_PC * sd, struct mmo_charstatus * st) -{ - sd->num_quests = st->num_quests; - memcpy(sd->quest_log, st->quest_log, sizeof(st->quest_log)); - - return 0; -} - -int quest_make_savedata(TBL_PC * sd) -{ - sd->status.num_quests = sd->num_quests; - memcpy(sd->status.quest_log, sd->quest_log, sizeof(sd->quest_log)); - - return 0; -} - -- cgit v1.2.3-70-g09d2