rathena/src/map/quest.hpp
Aleos 2f326bf04a
Converted Quest Database to YAML (#4064)
* Changes TimeLimit format to be human readable.
* Converts title to string.
* Converts objectives and drop items to vectors.
* General clean ups and optimizations.
* Got rid of dummy_quest.
* Added TXT to YAML converter.
Thanks to @Atemo and @Normynator!
Co-authored-by: atemo <capucrath@gmail.com>
2020-03-30 13:17:19 -04:00

77 lines
1.9 KiB
C++

// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef QUEST_HPP
#define QUEST_HPP
#include <string>
#include "../common/cbasetypes.hpp"
#include "../common/database.hpp"
#include "../common/strlib.hpp"
#include "map.hpp"
struct map_session_data;
struct s_quest_dropitem {
uint16 nameid;
uint16 count;
uint16 rate;
uint16 mob_id;
//uint8 bound;
//bool isAnnounced;
//bool isGUID;
};
struct s_quest_objective {
uint16 mob_id;
uint16 count;
};
struct s_quest_db {
int32 id;
time_t time;
bool time_at;
std::vector<std::shared_ptr<s_quest_objective>> objectives;
std::vector<std::shared_ptr<s_quest_dropitem>> dropitem;
std::string name;
};
// Questlog check types
enum e_quest_check_type : uint8 {
HAVEQUEST, ///< Query the state of the given quest
PLAYTIME, ///< Check if the given quest has been completed or has yet to expire
HUNTING, ///< Check if the given hunting quest's requirements have been met
};
class QuestDatabase : public TypesafeYamlDatabase<uint32, s_quest_db> {
public:
QuestDatabase() : TypesafeYamlDatabase("QUEST_DB", 1) {
}
const std::string getDefaultLocation();
uint64 parseBodyNode(const YAML::Node& node);
bool reload();
};
extern QuestDatabase quest_db;
int quest_pc_login(struct map_session_data *sd);
int quest_add(struct map_session_data *sd, int quest_id);
int quest_delete(struct map_session_data *sd, int quest_id);
int quest_change(struct map_session_data *sd, int qid1, int qid2);
int quest_update_objective_sub(struct block_list *bl, va_list ap);
void quest_update_objective(struct map_session_data *sd, int mob_id);
int quest_update_status(struct map_session_data *sd, int quest_id, e_quest_state status);
int quest_check(struct map_session_data *sd, int quest_id, e_quest_check_type type);
std::shared_ptr<s_quest_db> quest_search(int quest_id);
void do_init_quest(void);
void do_final_quest(void);
#endif /* QUEST_HPP */