diff options
author | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-09-12 02:43:02 +0000 |
---|---|---|
committer | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-09-12 02:43:02 +0000 |
commit | 1739298348c4d8c9052c05b7ac9a528e34de14d4 (patch) | |
tree | 43a8290fe0b32c6b303cfe0b4f3893be7893978a | |
parent | 19842e42ba718181671aa80a0dec83b0f680a209 (diff) | |
download | hercules-1739298348c4d8c9052c05b7ac9a528e34de14d4.tar.gz hercules-1739298348c4d8c9052c05b7ac9a528e34de14d4.tar.bz2 hercules-1739298348c4d8c9052c05b7ac9a528e34de14d4.tar.xz hercules-1739298348c4d8c9052c05b7ac9a528e34de14d4.zip |
* Clarified the names of some questlog functions and eventually implemented kill counts updating.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14056 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | src/map/clif.c | 50 | ||||
-rw-r--r-- | src/map/clif.h | 11 | ||||
-rw-r--r-- | src/map/quest.c | 22 |
4 files changed, 51 insertions, 34 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index df1bc7635..eec89a530 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,8 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +09/09/12 + * Clarified the names of some questlog functions and eventually implemented kill counts updating. [Inkfish] 09/09/04 * QuestLog Fix. [Inkfish] - mob id no longer stores in sql. diff --git a/src/map/clif.c b/src/map/clif.c index 515d7642a..f05209d96 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12585,9 +12585,8 @@ void clif_parse_EquipTick(int fd, struct map_session_data* sd) /*========================================== * Questlog System [Kevin] [Inkfish] *------------------------------------------*/ -//Send simple list of quests upon login -//* 02B1 <packet_len>.W <ignored>.L { <quest_id>.L <state>.B }.5B* -void clif_send_questlog(struct map_session_data * sd) +//* 02B1 <packet_len>.W <quest_num>.L { <quest_id>.L <state>.B }.5B* +void clif_quest_send_list(struct map_session_data * sd) { int fd = sd->fd; int i; @@ -12608,9 +12607,8 @@ void clif_send_questlog(struct map_session_data * sd) } -//Send objective info on login -//* 02B2 <packet_len>.W <ignored>.L { <quest_id>.L <ignored>.L <time>.L <num mobs>.W {<ignored>.L <mob count>.W <Mob Name>.24B}.30B[3] }.104B* -void clif_send_questlog_info(struct map_session_data * sd) +//* 02B2 <packet_len>.W <quest_num>.L { <quest_id>.L <start time>.L <expire time>.L <num mobs>.W {<mob id>.L <mob count>.W <Mob Name>.24B}.30B[3] }.104B* +void clif_quest_send_mission(struct map_session_data * sd) { int fd = sd->fd; int i, j; @@ -12625,11 +12623,13 @@ void clif_send_questlog_info(struct map_session_data * sd) for( i = 0; i < sd->avail_quests; i++ ) { WFIFOL(fd, i*104+8) = sd->quest_log[i].quest_id; + WFIFOL(fd, i*104+12) = sd->quest_log[i].time - quest_db[sd->quest_index[i]].time; WFIFOL(fd, i*104+16) = sd->quest_log[i].time; WFIFOW(fd, i*104+20) = quest_db[sd->quest_index[i]].num_objectives; for( j = 0 ; j < quest_db[sd->quest_index[i]].num_objectives; j++ ) { + WFIFOL(fd, i*104+22+j*30) = quest_db[sd->quest_index[i]].mob[j]; WFIFOW(fd, i*104+26+j*30) = sd->quest_log[i].count[j]; mob = mob_db(quest_db[sd->quest_index[i]].mob[j]); memcpy(WFIFOP(fd, i*104+28+j*30), mob?mob->jname:"NULL", NAME_LENGTH); @@ -12639,24 +12639,24 @@ void clif_send_questlog_info(struct map_session_data * sd) WFIFOSET(fd, len); } -//Send info when objective info needs an update -//* 02B3 <quest_id>.L <state>.B <ignored>.L <time>.L <num mobs>.W {<ignored>.L <mob count>.W <Mob Name>.24B}.30B[3] -void clif_send_quest_info(struct map_session_data * sd, struct quest * qd, int index) +//* 02B3 <quest_id>.L <state>.B <start time>.L <expire time>.L <num mobs>.W {<mob id>.L <mob count>.W <Mob Name>.24B}.30B[3] +void clif_quest_add(struct map_session_data * sd, struct quest * qd, int index) { int fd = sd->fd; int i; - //int len = MAX_QUEST_OBJECTIVES*30+17; struct mob_db *mob; WFIFOHEAD(fd, packet_len(0x02B3)); WFIFOW(fd, 0) = 0x02B3; WFIFOL(fd, 2) = qd->quest_id; WFIFOB(fd, 6) = qd->state; + WFIFOB(fd, 7) = qd->time - quest_db[index].time; WFIFOL(fd, 11) = qd->time; WFIFOW(fd, 15) = quest_db[index].num_objectives; for( i = 0; i < quest_db[index].num_objectives; i++ ) { + WFIFOL(fd, i*30+17) = quest_db[index].mob[i]; WFIFOW(fd, i*30+21) = qd->count[i]; mob = mob_db(quest_db[index].mob[i]); memcpy(WFIFOP(fd, i*30+23), mob?mob->jname:"NULL", NAME_LENGTH); @@ -12665,9 +12665,8 @@ void clif_send_quest_info(struct map_session_data * sd, struct quest * qd, int i WFIFOSET(fd, packet_len(0x02B3)); } -//Send delete msg //* 02B4 <quest_id>.L -void clif_send_quest_delete(struct map_session_data * sd, int quest_id) +void clif_quest_delete(struct map_session_data * sd, int quest_id) { int fd = sd->fd; @@ -12677,17 +12676,36 @@ void clif_send_quest_delete(struct map_session_data * sd, int quest_id) WFIFOSET(fd, packet_len(0x02B4)); } -// * 02B5 <packet_len>.W <ignored>.L { }.10B* <-- UNKOWN PACKET +//* 02b5 <packet_len>.w <mob_num>.w { <quest_id>.d <mob_id>.d <count>.w }.mob_num +void clif_quest_update_objective(struct map_session_data * sd, struct quest * qd, int index) +{ + int fd = sd->fd; + int i; + int len = quest_db[index].num_objectives*10+6; + + WFIFOHEAD(fd, len); + WFIFOW(fd, 0) = 0x02B5; + WFIFOW(fd, 2) = len; + WFIFOW(fd, 4) = quest_db[index].num_objectives; + + for( i = 0; i < quest_db[index].num_objectives; i++ ) + { + WFIFOL(fd, i*10+6) = qd->quest_id; + WFIFOL(fd, i*10+10) = quest_db[index].mob[i]; + WFIFOW(fd, i*10+14) = qd->count[i]; + } + + WFIFOSET(fd, len); +} -// * 02B6 <quest_id>.L <state>.B +//* 02B6 <quest_id>.L <state>.B void clif_parse_questStateAck(int fd, struct map_session_data * sd) { quest_update_status(sd, RFIFOL(fd,2), RFIFOB(fd,6)?Q_ACTIVE:Q_INACTIVE); } -//Change active state of the quest //* 02B7 <quest_id>.L <state_to>.B -void clif_send_quest_status(struct map_session_data * sd, int quest_id, bool active) +void clif_quest_update_status(struct map_session_data * sd, int quest_id, bool active) { int fd = sd->fd; diff --git a/src/map/clif.h b/src/map/clif.h index 18ab320ef..5a3df7ffb 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -432,11 +432,12 @@ void clif_viewequip_fail(struct map_session_data* sd); void clif_equipcheckbox(struct map_session_data* sd); //quest system [Kevin] [Inkfish] -void clif_send_questlog(struct map_session_data * sd); -void clif_send_questlog_info(struct map_session_data * sd); -void clif_send_quest_info(struct map_session_data * sd, struct quest * qd, int index); -void clif_send_quest_delete(struct map_session_data * sd, int quest_id); -void clif_send_quest_status(struct map_session_data * sd, int quest_id, bool active); +void clif_quest_send_list(struct map_session_data * sd); +void clif_quest_send_mission(struct map_session_data * sd); +void clif_quest_add(struct map_session_data * sd, struct quest * qd, int index); +void clif_quest_delete(struct map_session_data * sd, int quest_id); +void clif_quest_update_status(struct map_session_data * sd, int quest_id, bool active); +void clif_quest_update_objective(struct map_session_data * sd, struct quest * qd, int index); int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type); int do_final_clif(void); diff --git a/src/map/quest.c b/src/map/quest.c index 61d6fda36..03a74214f 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -50,8 +50,8 @@ int quest_pc_login(TBL_PC * sd) if(sd->avail_quests == 0) return 1; - clif_send_questlog(sd); - clif_send_questlog_info(sd); + clif_quest_send_list(sd); + clif_quest_send_mission(sd); return 0; } @@ -93,7 +93,7 @@ int quest_add(TBL_PC * sd, int quest_id) sd->num_quests++; sd->avail_quests++; - clif_send_quest_info(sd, &sd->quest_log[i], sd->quest_index[i]); + clif_quest_add(sd, &sd->quest_log[i], sd->quest_index[i]); if( save_settings&64 ) chrif_save(sd,0); @@ -139,8 +139,8 @@ int quest_change(TBL_PC * sd, int qid1, int qid2) sd->quest_index[i] = j; - clif_send_quest_delete(sd, qid1); - clif_send_quest_info(sd, &sd->quest_log[i], sd->quest_index[i]); + clif_quest_delete(sd, qid1); + clif_quest_add(sd, &sd->quest_log[i], sd->quest_index[i]); if( save_settings&64 ) chrif_save(sd,0); @@ -170,7 +170,7 @@ int quest_delete(TBL_PC * sd, int quest_id) memset(&sd->quest_log[sd->num_quests], 0, sizeof(struct quest)); sd->quest_index[sd->num_quests] = 0; - clif_send_quest_delete(sd, quest_id); + clif_quest_delete(sd, quest_id); if( save_settings&64 ) chrif_save(sd,0); @@ -191,11 +191,7 @@ void quest_update_objective(TBL_PC * sd, int mob) if( quest_db[sd->quest_index[i]].mob[j] == mob && sd->quest_log[i].count[j] < quest_db[sd->quest_index[i]].count[j] ) { sd->quest_log[i].count[j]++; - - // Should figure out the real packet. - //clif_send_quest_delete(sd, sd->quest_log[i].quest_id); - //clif_send_quest_info(sd, &sd->quest_log[i]); - //break; + clif_quest_update_objective(sd,&sd->quest_log[i],sd->quest_index[i]); } } } @@ -216,7 +212,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) if( status < Q_COMPLETE ) { - clif_send_quest_status(sd, quest_id, (bool)status); + clif_quest_update_status(sd, quest_id, (bool)status); return 0; } @@ -228,7 +224,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) memcpy(&sd->quest_log[sd->avail_quests], &tmp_quest,sizeof(struct quest)); } - clif_send_quest_delete(sd, quest_id); + clif_quest_delete(sd, quest_id); if( save_settings&64 ) chrif_save(sd,0); |