PageRenderTime 71ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/src/map/quest.c

https://gitlab.com/evol/hercules
C | 672 lines | 412 code | 91 blank | 169 comment | 120 complexity | 3ceba256528781c254690b1f14981a1d MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.0
  1. /**
  2. * This file is part of Hercules.
  3. * http://herc.ws - http://github.com/HerculesWS/Hercules
  4. *
  5. * Copyright (C) 2012-2015 Hercules Dev Team
  6. * Copyright (C) Athena Dev Teams
  7. *
  8. * Hercules is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #define HERCULES_CORE
  22. #include "quest.h"
  23. #include "map/battle.h"
  24. #include "map/chrif.h"
  25. #include "map/clif.h"
  26. #include "map/intif.h"
  27. #include "map/itemdb.h"
  28. #include "map/log.h"
  29. #include "map/map.h"
  30. #include "map/mob.h"
  31. #include "map/npc.h"
  32. #include "map/party.h"
  33. #include "map/pc.h"
  34. #include "map/script.h"
  35. #include "map/unit.h"
  36. #include "common/cbasetypes.h"
  37. #include "common/conf.h"
  38. #include "common/memmgr.h"
  39. #include "common/nullpo.h"
  40. #include "common/random.h"
  41. #include "common/showmsg.h"
  42. #include "common/socket.h"
  43. #include "common/strlib.h"
  44. #include "common/timer.h"
  45. #include "common/utils.h"
  46. #include <stdarg.h>
  47. #include <stdio.h>
  48. #include <stdlib.h>
  49. #include <string.h>
  50. #include <time.h>
  51. struct quest_interface quest_s;
  52. struct quest_db *db_data[MAX_QUEST_DB]; ///< Quest database
  53. struct quest_interface *quest;
  54. /**
  55. * Searches a quest by ID.
  56. *
  57. * @param quest_id ID to lookup
  58. * @return Quest entry (equals to &quest->dummy if the ID is invalid)
  59. */
  60. struct quest_db *quest_db(int quest_id) {
  61. if (quest_id < 0 || quest_id >= MAX_QUEST_DB || quest->db_data[quest_id] == NULL)
  62. return &quest->dummy;
  63. return quest->db_data[quest_id];
  64. }
  65. /**
  66. * Sends quest info to the player on login.
  67. *
  68. * @param sd Player's data
  69. * @return 0 in case of success, nonzero otherwise (i.e. the player has no quests)
  70. */
  71. int quest_pc_login(struct map_session_data *sd)
  72. {
  73. #if PACKETVER < 20141022
  74. int i;
  75. #endif
  76. if(sd->avail_quests == 0)
  77. return 1;
  78. clif->quest_send_list(sd);
  79. #if PACKETVER < 20141022
  80. clif->quest_send_mission(sd);
  81. for( i = 0; i < sd->avail_quests; i++ ) {
  82. // TODO[Haru]: is this necessary? Does quest_send_mission not take care of this?
  83. clif->quest_update_objective(sd, &sd->quest_log[i]);
  84. }
  85. #endif
  86. return 0;
  87. }
  88. /**
  89. * Adds a quest to the player's list.
  90. *
  91. * New quest will be added as Q_ACTIVE.
  92. *
  93. * @param sd Player's data
  94. * @param quest_id ID of the quest to add.
  95. * @return 0 in case of success, nonzero otherwise
  96. */
  97. int quest_add(struct map_session_data *sd, int quest_id)
  98. {
  99. int n;
  100. struct quest_db *qi = quest->db(quest_id);
  101. if( qi == &quest->dummy ) {
  102. ShowError("quest_add: quest %d not found in DB.\n", quest_id);
  103. return -1;
  104. }
  105. if( quest->check(sd, quest_id, HAVEQUEST) >= 0 ) {
  106. ShowError("quest_add: Character %d already has quest %d.\n", sd->status.char_id, quest_id);
  107. return -1;
  108. }
  109. n = sd->avail_quests; // Insertion point
  110. sd->num_quests++;
  111. sd->avail_quests++;
  112. RECREATE(sd->quest_log, struct quest, sd->num_quests);
  113. if( sd->avail_quests != sd->num_quests ) {
  114. // The character has some completed quests, make room before them so that they will stay at the end of the array
  115. memmove(&sd->quest_log[n+1], &sd->quest_log[n], sizeof(struct quest)*(sd->num_quests-sd->avail_quests));
  116. }
  117. memset(&sd->quest_log[n], 0, sizeof(struct quest));
  118. sd->quest_log[n].quest_id = qi->id;
  119. if( qi->time )
  120. sd->quest_log[n].time = (unsigned int)(time(NULL) + qi->time);
  121. sd->quest_log[n].state = Q_ACTIVE;
  122. sd->save_quest = true;
  123. clif->quest_add(sd, &sd->quest_log[n]);
  124. clif->quest_update_objective(sd, &sd->quest_log[n]);
  125. if( map->save_settings&64 )
  126. chrif->save(sd,0);
  127. return 0;
  128. }
  129. /**
  130. * Replaces a quest in a player's list with another one.
  131. *
  132. * @param sd Player's data
  133. * @param qid1 Current quest to replace
  134. * @param qid2 New quest to add
  135. * @return 0 in case of success, nonzero otherwise
  136. */
  137. int quest_change(struct map_session_data *sd, int qid1, int qid2)
  138. {
  139. int i;
  140. struct quest_db *qi = quest->db(qid2);
  141. if( qi == &quest->dummy ) {
  142. ShowError("quest_change: quest %d not found in DB.\n", qid2);
  143. return -1;
  144. }
  145. if( quest->check(sd, qid2, HAVEQUEST) >= 0 ) {
  146. ShowError("quest_change: Character %d already has quest %d.\n", sd->status.char_id, qid2);
  147. return -1;
  148. }
  149. if( quest->check(sd, qid1, HAVEQUEST) < 0 ) {
  150. ShowError("quest_change: Character %d doesn't have quest %d.\n", sd->status.char_id, qid1);
  151. return -1;
  152. }
  153. ARR_FIND(0, sd->avail_quests, i, sd->quest_log[i].quest_id == qid1);
  154. if( i == sd->avail_quests ) {
  155. ShowError("quest_change: Character %d has completed quest %d.\n", sd->status.char_id, qid1);
  156. return -1;
  157. }
  158. memset(&sd->quest_log[i], 0, sizeof(struct quest));
  159. sd->quest_log[i].quest_id = qi->id;
  160. if( qi->time )
  161. sd->quest_log[i].time = (unsigned int)(time(NULL) + qi->time);
  162. sd->quest_log[i].state = Q_ACTIVE;
  163. sd->save_quest = true;
  164. clif->quest_delete(sd, qid1);
  165. clif->quest_add(sd, &sd->quest_log[i]);
  166. clif->quest_update_objective(sd, &sd->quest_log[i]);
  167. if( map->save_settings&64 )
  168. chrif->save(sd,0);
  169. return 0;
  170. }
  171. /**
  172. * Removes a quest from a player's list
  173. *
  174. * @param sd Player's data
  175. * @param quest_id ID of the quest to remove
  176. * @return 0 in case of success, nonzero otherwise
  177. */
  178. int quest_delete(struct map_session_data *sd, int quest_id)
  179. {
  180. int i;
  181. //Search for quest
  182. ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
  183. if(i == sd->num_quests) {
  184. ShowError("quest_delete: Character %d doesn't have quest %d.\n", sd->status.char_id, quest_id);
  185. return -1;
  186. }
  187. if( sd->quest_log[i].state != Q_COMPLETE )
  188. sd->avail_quests--;
  189. if( i < --sd->num_quests ) {
  190. // Compact the array
  191. memmove(&sd->quest_log[i], &sd->quest_log[i+1], sizeof(struct quest)*(sd->num_quests-i));
  192. }
  193. if( sd->num_quests == 0 ) {
  194. aFree(sd->quest_log);
  195. sd->quest_log = NULL;
  196. } else {
  197. RECREATE(sd->quest_log, struct quest, sd->num_quests);
  198. }
  199. sd->save_quest = true;
  200. clif->quest_delete(sd, quest_id);
  201. if( map->save_settings&64 )
  202. chrif->save(sd,0);
  203. return 0;
  204. }
  205. /**
  206. * Map iterator subroutine to update quest objectives for a party after killing a monster.
  207. *
  208. * @see map_foreachinrange
  209. * @param ap Argument list, expecting:
  210. * int Party ID
  211. * int Mob ID
  212. */
  213. int quest_update_objective_sub(struct block_list *bl, va_list ap)
  214. {
  215. struct map_session_data *sd = NULL;
  216. int party_id = va_arg(ap, int);
  217. int mob_id = va_arg(ap, int);
  218. nullpo_ret(bl);
  219. Assert_ret(bl->type == BL_PC);
  220. sd = BL_UCAST(BL_PC, bl);
  221. if( !sd->avail_quests )
  222. return 0;
  223. if( sd->status.party_id != party_id )
  224. return 0;
  225. quest->update_objective(sd, mob_id);
  226. return 1;
  227. }
  228. /**
  229. * Updates the quest objectives for a character after killing a monster, including the handling of quest-granted drops.
  230. *
  231. * @param sd Character's data
  232. * @param mob_id Monster ID
  233. */
  234. void quest_update_objective(struct map_session_data *sd, int mob_id)
  235. {
  236. int i,j;
  237. for (i = 0; i < sd->avail_quests; i++) {
  238. struct quest_db *qi = NULL;
  239. if (sd->quest_log[i].state != Q_ACTIVE) // Skip inactive quests
  240. continue;
  241. qi = quest->db(sd->quest_log[i].quest_id);
  242. for (j = 0; j < qi->objectives_count; j++) {
  243. if (qi->objectives[j].mob == mob_id && sd->quest_log[i].count[j] < qi->objectives[j].count) {
  244. sd->quest_log[i].count[j]++;
  245. sd->save_quest = true;
  246. clif->quest_update_objective(sd, &sd->quest_log[i]);
  247. }
  248. }
  249. // process quest-granted extra drop bonuses
  250. for (j = 0; j < qi->dropitem_count; j++) {
  251. struct quest_dropitem *dropitem = &qi->dropitem[j];
  252. struct item item;
  253. struct item_data *data = NULL;
  254. int temp;
  255. if (dropitem->mob_id != 0 && dropitem->mob_id != mob_id)
  256. continue;
  257. // TODO: Should this be affected by server rates?
  258. if (rnd()%10000 >= dropitem->rate)
  259. continue;
  260. if (!(data = itemdb->exists(dropitem->nameid)))
  261. continue;
  262. memset(&item,0,sizeof(item));
  263. item.nameid = dropitem->nameid;
  264. item.identify = itemdb->isidentified2(data);
  265. item.amount = 1;
  266. if((temp = pc->additem(sd, &item, 1, LOG_TYPE_OTHER)) != 0) { // TODO: We might want a new log type here?
  267. // Failed to obtain the item
  268. clif->additem(sd, 0, 0, temp);
  269. }
  270. }
  271. }
  272. }
  273. /**
  274. * Updates a quest's state.
  275. *
  276. * Only status of active and inactive quests can be updated. Completed quests can't (for now). [Inkfish]
  277. *
  278. * @param sd Character's data
  279. * @param quest_id Quest ID to update
  280. * @param qs New quest state
  281. * @return 0 in case of success, nonzero otherwise
  282. */
  283. int quest_update_status(struct map_session_data *sd, int quest_id, enum quest_state qs)
  284. {
  285. int i;
  286. ARR_FIND(0, sd->avail_quests, i, sd->quest_log[i].quest_id == quest_id);
  287. if( i == sd->avail_quests ) {
  288. ShowError("quest_update_status: Character %d doesn't have quest %d.\n", sd->status.char_id, quest_id);
  289. return -1;
  290. }
  291. sd->quest_log[i].state = qs;
  292. sd->save_quest = true;
  293. if( qs < Q_COMPLETE ) {
  294. clif->quest_update_status(sd, quest_id, qs == Q_ACTIVE ? true : false);
  295. return 0;
  296. }
  297. // The quest is complete, so it needs to be moved to the completed quests block at the end of the array.
  298. if( i < (--sd->avail_quests) ) {
  299. struct quest tmp_quest;
  300. memcpy(&tmp_quest, &sd->quest_log[i],sizeof(struct quest));
  301. memcpy(&sd->quest_log[i], &sd->quest_log[sd->avail_quests],sizeof(struct quest));
  302. memcpy(&sd->quest_log[sd->avail_quests], &tmp_quest,sizeof(struct quest));
  303. }
  304. clif->quest_delete(sd, quest_id);
  305. if( map->save_settings&64 )
  306. chrif->save(sd,0);
  307. return 0;
  308. }
  309. /**
  310. * Queries quest information for a character.
  311. *
  312. * @param sd Character's data
  313. * @param quest_id Quest ID
  314. * @param type Check type
  315. * @return -1 if the quest was not found, otherwise it depends on the type:
  316. * HAVEQUEST: The quest's state
  317. * PLAYTIME: 2 if the quest's timeout has expired
  318. * 1 if the quest was completed
  319. * 0 otherwise
  320. * HUNTING: 2 if the quest has not been marked as completed yet, and its objectives have been fulfilled
  321. * 1 if the quest's timeout has expired
  322. * 0 otherwise
  323. */
  324. int quest_check(struct map_session_data *sd, int quest_id, enum quest_check_type type)
  325. {
  326. int i;
  327. ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
  328. if (i == sd->num_quests)
  329. return -1;
  330. switch (type) {
  331. case HAVEQUEST:
  332. return sd->quest_log[i].state;
  333. case PLAYTIME:
  334. return (sd->quest_log[i].time < (unsigned int)time(NULL) ? 2 : sd->quest_log[i].state == Q_COMPLETE ? 1 : 0);
  335. case HUNTING:
  336. if( sd->quest_log[i].state == Q_INACTIVE || sd->quest_log[i].state == Q_ACTIVE ) {
  337. int j;
  338. struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
  339. ARR_FIND(0, qi->objectives_count, j, sd->quest_log[i].count[j] < qi->objectives[j].count);
  340. if (j == qi->objectives_count)
  341. return 2;
  342. if (sd->quest_log[i].time < (unsigned int)time(NULL))
  343. return 1;
  344. }
  345. return 0;
  346. default:
  347. ShowError("quest_check_quest: Unknown parameter %d",type);
  348. break;
  349. }
  350. return -1;
  351. }
  352. /**
  353. * Reads and parses an entry from the quest_db.
  354. *
  355. * @param cs The config setting containing the entry.
  356. * @param n The sequential index of the current config setting.
  357. * @param source The source configuration file.
  358. * @return The parsed quest entry.
  359. * @retval NULL in case of errors.
  360. */
  361. struct quest_db *quest_read_db_sub(config_setting_t *cs, int n, const char *source)
  362. {
  363. struct quest_db *entry = NULL;
  364. config_setting_t *t = NULL;
  365. int i32 = 0, quest_id;
  366. const char *str = NULL;
  367. /*
  368. * Id: Quest ID [int]
  369. * Name: Quest Name [string]
  370. * TimeLimit: Time Limit (seconds) [int, optional]
  371. * Targets: ( [array, optional]
  372. * {
  373. * MobId: Mob ID [int]
  374. * Count: [int]
  375. * },
  376. * ... (can repeated up to MAX_QUEST_OBJECTIVES times)
  377. * )
  378. * Drops: (
  379. * {
  380. * ItemId: Item ID to drop [int]
  381. * Rate: Drop rate [int]
  382. * MobId: Mob ID to match [int, optional]
  383. * },
  384. * ... (can be repeated)
  385. * )
  386. */
  387. if (!libconfig->setting_lookup_int(cs, "Id", &quest_id)) {
  388. ShowWarning("quest_read_db: Missing id in \"%s\", entry #%d, skipping.\n", source, n);
  389. return NULL;
  390. }
  391. if (quest_id < 0 || quest_id >= MAX_QUEST_DB) {
  392. ShowWarning("quest_read_db: Invalid quest ID '%d' in \"%s\", entry #%d (min: 0, max: %d), skipping.\n", quest_id, source, n, MAX_QUEST_DB);
  393. return NULL;
  394. }
  395. if (!libconfig->setting_lookup_string(cs, "Name", &str) || !*str) {
  396. ShowWarning("quest_read_db_sub: Missing Name in quest %d of \"%s\", skipping.\n", quest_id, source);
  397. return NULL;
  398. }
  399. CREATE(entry, struct quest_db, 1);
  400. entry->id = quest_id;
  401. //safestrncpy(entry->name, str, sizeof(entry->name));
  402. if (libconfig->setting_lookup_int(cs, "TimeLimit", &i32)) // This is an unsigned value, do not check for >= 0
  403. entry->time = (unsigned int)i32;
  404. if ((t=libconfig->setting_get_member(cs, "Targets")) && config_setting_is_list(t)) {
  405. int i, len = libconfig->setting_length(t);
  406. for (i = 0; i < len && entry->objectives_count < MAX_QUEST_OBJECTIVES; i++) {
  407. // Note: We ensure that objectives_count < MAX_QUEST_OBJECTIVES because
  408. // quest_log (as well as the client) expect this maximum size.
  409. config_setting_t *tt = libconfig->setting_get_elem(t, i);
  410. int mob_id = 0, count = 0;
  411. if (!tt)
  412. break;
  413. if (!config_setting_is_group(tt))
  414. continue;
  415. if (!libconfig->setting_lookup_int(tt, "MobId", &mob_id) || mob_id <= 0)
  416. continue;
  417. if (!libconfig->setting_lookup_int(tt, "Count", &count) || count <= 0)
  418. continue;
  419. RECREATE(entry->objectives, struct quest_objective, ++entry->objectives_count);
  420. entry->objectives[entry->objectives_count-1].mob = mob_id;
  421. entry->objectives[entry->objectives_count-1].count = count;
  422. }
  423. }
  424. if ((t=libconfig->setting_get_member(cs, "Drops")) && config_setting_is_list(t)) {
  425. int i, len = libconfig->setting_length(t);
  426. for (i = 0; i < len; i++) {
  427. config_setting_t *tt = libconfig->setting_get_elem(t, i);
  428. int mob_id = 0, nameid = 0, rate = 0;
  429. if (!tt)
  430. break;
  431. if (!config_setting_is_group(tt))
  432. continue;
  433. if (!libconfig->setting_lookup_int(tt, "MobId", &mob_id))
  434. mob_id = 0; // Zero = any monster
  435. if (mob_id < 0)
  436. continue;
  437. if (!libconfig->setting_lookup_int(tt, "ItemId", &nameid) || !itemdb->exists(nameid))
  438. continue;
  439. if (!libconfig->setting_lookup_int(tt, "Rate", &rate) || rate <= 0)
  440. continue;
  441. RECREATE(entry->dropitem, struct quest_dropitem, ++entry->dropitem_count);
  442. entry->dropitem[entry->dropitem_count-1].mob_id = mob_id;
  443. entry->dropitem[entry->dropitem_count-1].nameid = nameid;
  444. entry->dropitem[entry->dropitem_count-1].rate = rate;
  445. }
  446. }
  447. return entry;
  448. }
  449. /**
  450. * Loads quests from the quest db.
  451. *
  452. * @return Number of loaded quests, or -1 if the file couldn't be read.
  453. */
  454. int quest_read_db(void)
  455. {
  456. char filepath[256];
  457. config_t quest_db_conf;
  458. config_setting_t *qdb = NULL, *q = NULL;
  459. int i = 0, count = 0;
  460. const char *filename = "quest_db.conf";
  461. sprintf(filepath, "%s/%s", map->db_path, filename);
  462. if (libconfig->read_file(&quest_db_conf, filepath) || !(qdb = libconfig->setting_get_member(quest_db_conf.root, "quest_db"))) {
  463. ShowError("can't read %s\n", filepath);
  464. return -1;
  465. }
  466. while ((q = libconfig->setting_get_elem(qdb, i++))) {
  467. struct quest_db *entry = quest->read_db_sub(q, i-1, filepath);
  468. if (!entry)
  469. continue;
  470. if (quest->db_data[entry->id] != NULL) {
  471. ShowWarning("quest_read_db: Duplicate quest %d.\n", entry->id);
  472. if (quest->db_data[entry->id]->dropitem)
  473. aFree(quest->db_data[entry->id]->dropitem);
  474. if (quest->db_data[entry->id]->objectives)
  475. aFree(quest->db_data[entry->id]->objectives);
  476. aFree(quest->db_data[entry->id]);
  477. }
  478. quest->db_data[entry->id] = entry;
  479. count++;
  480. }
  481. libconfig->destroy(&quest_db_conf);
  482. ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
  483. return count;
  484. }
  485. /**
  486. * Map iterator to ensures a player has no invalid quest log entries.
  487. *
  488. * Any entries that are no longer in the db are removed.
  489. *
  490. * @see map->foreachpc
  491. * @param ap Ignored
  492. */
  493. int quest_reload_check_sub(struct map_session_data *sd, va_list ap) {
  494. int i, j;
  495. nullpo_ret(sd);
  496. j = 0;
  497. for (i = 0; i < sd->num_quests; i++) {
  498. struct quest_db *qi = quest->db(sd->quest_log[i].quest_id);
  499. if (qi == &quest->dummy) { // Remove no longer existing entries
  500. if (sd->quest_log[i].state != Q_COMPLETE) // And inform the client if necessary
  501. clif->quest_delete(sd, sd->quest_log[i].quest_id);
  502. continue;
  503. }
  504. if (i != j) {
  505. // Move entries if there's a gap to fill
  506. memcpy(&sd->quest_log[j], &sd->quest_log[i], sizeof(struct quest));
  507. }
  508. j++;
  509. }
  510. sd->num_quests = j;
  511. ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].state == Q_COMPLETE);
  512. sd->avail_quests = i;
  513. return 1;
  514. }
  515. /**
  516. * Clears the quest database for shutdown or reload.
  517. */
  518. void quest_clear_db(void) {
  519. int i;
  520. for (i = 0; i < MAX_QUEST_DB; i++) {
  521. if (quest->db_data[i]) {
  522. if (quest->db_data[i]->objectives)
  523. aFree(quest->db_data[i]->objectives);
  524. if (quest->db_data[i]->dropitem)
  525. aFree(quest->db_data[i]->dropitem);
  526. aFree(quest->db_data[i]);
  527. quest->db_data[i] = NULL;
  528. }
  529. }
  530. }
  531. /**
  532. * Initializes the quest interface.
  533. *
  534. * @param minimal Run in minimal mode (skips most of the loading)
  535. */
  536. void do_init_quest(bool minimal) {
  537. if (minimal)
  538. return;
  539. quest->read_db();
  540. }
  541. /**
  542. * Finalizes the quest interface before shutdown.
  543. */
  544. void do_final_quest(void) {
  545. quest->clear();
  546. }
  547. /**
  548. * Reloads the quest database.
  549. */
  550. void do_reload_quest(void) {
  551. quest->clear();
  552. quest->read_db();
  553. // Update quest data for players, to ensure no entries about removed quests are left over.
  554. map->foreachpc(&quest_reload_check_sub);
  555. }
  556. /**
  557. * Initializes default values for the quest interface.
  558. */
  559. void quest_defaults(void) {
  560. quest = &quest_s;
  561. quest->db_data = db_data;
  562. memset(&quest->db, 0, sizeof(quest->db));
  563. memset(&quest->dummy, 0, sizeof(quest->dummy));
  564. /* */
  565. quest->init = do_init_quest;
  566. quest->final = do_final_quest;
  567. quest->reload = do_reload_quest;
  568. /* */
  569. quest->db = quest_db;
  570. quest->pc_login = quest_pc_login;
  571. quest->add = quest_add;
  572. quest->change = quest_change;
  573. quest->delete = quest_delete;
  574. quest->update_objective_sub = quest_update_objective_sub;
  575. quest->update_objective = quest_update_objective;
  576. quest->update_status = quest_update_status;
  577. quest->check = quest_check;
  578. quest->clear = quest_clear_db;
  579. quest->read_db = quest_read_db;
  580. quest->read_db_sub = quest_read_db_sub;
  581. }