Mob quest target (#7071)

* Added functionality to select monsters that increase the quest counter
* Removed the extra conditions on Id
* Added an example in quest_db.yml for MapMobTargets
* Clean-up the docs
* Added the possibility to define "All" to Location

Thanks to @aleos89 !
This commit is contained in:
Atemo 2022-07-14 19:00:48 +02:00 committed by GitHub
parent 0fa3e6a672
commit f6bc10bfb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 223 additions and 164 deletions

View File

@ -22,37 +22,29 @@
# Quest Settings
#
###########################################################################
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Use a number following by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
# Specify with "+" for how long until the quest expires.
# Specify without "+" for the exact time the quest expires using "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional) format.
# Please note the number before "d" only shift the exact timer to the given day(s).
# Targets: Quest objective target. (Default: null)
# The target can be a couple of node Mob/Count or of Id/Race/Size/Element/MinLevel/MaxLevel.
# If Mob is supplied, Count is required and the other fields are ignored.
# If Id is supplied, at least one other field of Race/Size/Element/MinLevel/MaxLevel is required.
# If Id is supplied, Count is required for each new entry.
# - Mob Monster to kill (aegis monster name).
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target (default All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
# Size Monster size target (default All). Valid sizes are Small, Medium, Large, All.
# Element Monster element target (default All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default any location)
# On normal maps only kills of permanently spawned monsters increase the counter.
# On instance maps all monster kills increase the counter.
# MapName Displayed map name in quest UI. (Default: empty string)
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Targets: Quest objective target. (Default: null)
# - Mob Name of monster to kill.
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target. (Default: All)
# Size Monster size target. (Default: All)
# Element Monster element target. (Default: All)
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default: All)
# MapName Displayed map name in quest UI. (Default: empty string)
# MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used. (Default: all monsters)
# <name>: <bool> Monster name and whether the monster is added or removed from the list.
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
###########################################################################
Header:
Type: QUEST_DB
Version: 2
Version: 3

View File

@ -22,40 +22,32 @@
# Quest Settings
#
###########################################################################
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Use a number following by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
# Specify with "+" for how long until the quest expires.
# Specify without "+" for the exact time the quest expires using "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional) format.
# Please note the number before "d" only shift the exact timer to the given day(s).
# Targets: Quest objective target. (Default: null)
# The target can be a couple of node Mob/Count or of Id/Race/Size/Element/MinLevel/MaxLevel.
# If Mob is supplied, Count is required and the other fields are ignored.
# If Id is supplied, at least one other field of Race/Size/Element/MinLevel/MaxLevel is required.
# If Id is supplied, Count is required for each new entry.
# - Mob Monster to kill (aegis monster name).
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target (default All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
# Size Monster size target (default All). Valid sizes are Small, Medium, Large, All.
# Element Monster element target (default All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default any location)
# On normal maps only kills of permanently spawned monsters increase the counter.
# On instance maps all monster kills increase the counter.
# MapName Displayed map name in quest UI. (Default: empty string)
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Targets: Quest objective target. (Default: null)
# - Mob Name of monster to kill.
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target. (Default: All)
# Size Monster size target. (Default: All)
# Element Monster element target. (Default: All)
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default: All)
# MapName Displayed map name in quest UI. (Default: empty string)
# MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used. (Default: all monsters)
# <name>: <bool> Monster name and whether the monster is added or removed from the list.
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
###########################################################################
Header:
Type: QUEST_DB
Version: 2
Version: 3
Body:
- Id: 1000

View File

@ -22,40 +22,32 @@
# Quest Settings
#
###########################################################################
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Use a number following by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
# Specify with "+" for how long until the quest expires.
# Specify without "+" for the exact time the quest expires using "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional) format.
# Please note the number before "d" only shift the exact timer to the given day(s).
# Targets: Quest objective target. (Default: null)
# The target can be a couple of node Mob/Count or of Id/Race/Size/Element/MinLevel/MaxLevel.
# If Mob is supplied, Count is required and the other fields are ignored.
# If Id is supplied, at least one other field of Race/Size/Element/MinLevel/MaxLevel is required.
# If Id is supplied, Count is required for each new entry.
# - Mob Monster to kill (aegis monster name).
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target (default All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
# Size Monster size target (default All). Valid sizes are Small, Medium, Large, All.
# Element Monster element target (default All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default any location)
# On normal maps only kills of permanently spawned monsters increase the counter.
# On instance maps all monster kills increase the counter.
# MapName Displayed map name in quest UI. (Default: empty string)
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Targets: Quest objective target. (Default: null)
# - Mob Name of monster to kill.
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target. (Default: All)
# Size Monster size target. (Default: All)
# Element Monster element target. (Default: All)
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default: All)
# MapName Displayed map name in quest UI. (Default: empty string)
# MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used. (Default: all monsters)
# <name>: <bool> Monster name and whether the monster is added or removed from the list.
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
###########################################################################
Header:
Type: QUEST_DB
Version: 2
Version: 3
Footer:
Imports:

View File

@ -22,40 +22,32 @@
# Quest Settings
#
###########################################################################
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Use a number following by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
# Specify with "+" for how long until the quest expires.
# Specify without "+" for the exact time the quest expires using "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional) format.
# Please note the number before "d" only shift the exact timer to the given day(s).
# Targets: Quest objective target. (Default: null)
# The target can be a couple of node Mob/Count or of Id/Race/Size/Element/MinLevel/MaxLevel.
# If Mob is supplied, Count is required and the other fields are ignored.
# If Id is supplied, at least one other field of Race/Size/Element/MinLevel/MaxLevel is required.
# If Id is supplied, Count is required for each new entry.
# - Mob Monster to kill (aegis monster name).
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target (default All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
# Size Monster size target (default All). Valid sizes are Small, Medium, Large, All.
# Element Monster element target (default All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default any location)
# On normal maps only kills of permanently spawned monsters increase the counter.
# On instance maps all monster kills increase the counter.
# MapName Displayed map name in quest UI. (Default: empty string)
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Targets: Quest objective target. (Default: null)
# - Mob Name of monster to kill.
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target. (Default: All)
# Size Monster size target. (Default: All)
# Element Monster element target. (Default: All)
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default: All)
# MapName Displayed map name in quest UI. (Default: empty string)
# MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used. (Default: all monsters)
# <name>: <bool> Monster name and whether the monster is added or removed from the list.
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
###########################################################################
Header:
Type: QUEST_DB
Version: 2
Version: 3
Body:
- Id: 1000
@ -2841,6 +2833,17 @@ Body:
- Id: 5929
Title: "[Standby] Subjugation-Turtle Island Dungeon"
TimeLimit: 4h
- Id: 5930
Title: Subjugation-Yanggeochon
Targets:
- Id: 1
Count: 80
Location: tur_dun03
MapMobTargets:
ASSULTER: true
PERMETER: true
FREEZER: true
HEATER: true
- Id: 5931
Title: "[Standby] Subjugation-Yanggeochon"
TimeLimit: 4h

57
doc/quest_db.txt Normal file
View File

@ -0,0 +1,57 @@
//===== rAthena Documentation ================================
//= Quest Database Structure
//===== By: ==================================================
//= rAthena Dev Team
//===== Last Updated: ========================================
//= 20220629
//===== Description: =========================================
//= Explanation of the quest_db.yml file and structure.
//============================================================
---------------------------------------
Id: Quest ID.
---------------------------------------
Title: Quest title.
---------------------------------------
TimeLimit: Amount of time before the quest expires.
Use a number followed by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
Specifying with "+" will mark how long until the quest expires.
Specifying without "+" will mark the exact time the quest expires. Format: "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional).
Please note the number before "d" only shifts the exact timer to the given day(s).
---------------------------------------
Targets: Quest objective target.
The target can be a combination of Mob/Count or of Id/Count and other fields.
If Mob is supplied, Count is required and the other fields are ignored.
If Id is supplied, Count is required for each new entry.
- Mob Name of monster to kill (aegis monster name).
Count Amount of monsters to kill. Set to 0 to skip the target on import.
Id Unique target index for the quest Id. Requires a positive number.
Race Monster race target. (Default: All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
Size Monster size target. (Default: All). Valid sizes are Small, Medium, Large, All.
Element Monster element target. (Default: All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import.
MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import.
Location Map name where kills are counted.
MapName Displayed map name in quest UI.
MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used.
<name>: <bool> Monster name and whether the monster is added or removed from the list.
---------------------------------------
Drops: Quest item drop targets.
- Mob Monster to kill. 0 will apply to all monsters.
Item Item to drop (aegis item name).
Count Amount of items that will drop. Non-stackable items default to 1.
Rate Item drop rate. (10000 = 100%)

View File

@ -5,33 +5,25 @@
# Quest Settings
#
###########################################################################
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Use a number following by "d" for day(s), "h" for hour(s), "mn" for minute(s), and "s" for second(s).
# Specify with "+" for how long until the quest expires.
# Specify without "+" for the exact time the quest expires using "d" (optional), [0-23]"h" (required), [0-59]"mn" (optional), [0-59]"s" (optional) format.
# Please note the number before "d" only shift the exact timer to the given day(s).
# Targets: Quest objective target. (Default: null)
# The target can be a couple of node Mob/Count or of Id/Race/Size/Element/MinLevel/MaxLevel.
# If Mob is supplied, Count is required and the other fields are ignored.
# If Id is supplied, at least one other field of Race/Size/Element/MinLevel/MaxLevel is required.
# If Id is supplied, Count is required for each new entry.
# - Mob Monster to kill (aegis monster name).
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target (default All). Valid races are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All.
# Size Monster size target (default All). Valid sizes are Small, Medium, Large, All.
# Element Monster element target (default All). Valid elements are Dark, Earth, Fire, Ghost, Holy, Neutral, Poison, Undead, Water, Wind, All.
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default any location)
# On normal maps only kills of permanently spawned monsters increase the counter.
# On instance maps all monster kills increase the counter.
# MapName Displayed map name in quest UI. (Default: empty string)
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
# - Id Quest ID.
# Title Quest title.
# TimeLimit Amount of time before the quest expires. (Default: 0)
# Targets: Quest objective target. (Default: null)
# - Mob Name of monster to kill.
# Count Amount of monsters to kill. Set to 0 to skip the target on import.
# Id Unique target index for the quest Id. Requires a positive number.
# Race Monster race target. (Default: All)
# Size Monster size target. (Default: All)
# Element Monster element target. (Default: All)
# MinLevel Minimum monster level target. If not supplied but MaxLevel defined, MinLevel is 1. Set to 0 to ignore MinLevel on import. (Default: 0)
# MaxLevel Maximum monster level target. Set to 0 to ignore MaxLevel on import. (Default: 0)
# Location Map name where kills are counted. (Default: All)
# MapName Displayed map name in quest UI. (Default: empty string)
# MapMobTargets List of monster names. Only names in the list will increase the kill counter. Only active when Id is used. (Default: all monsters)
# <name>: <bool> Monster name and whether the monster is added or removed from the list.
# Drops: Quest item drop targets. (Default: null)
# - Mob Monster to kill. 0 will apply to all monsters. (Default: 0)
# Item Item to drop.
# Count Amount of items that will drop. Non-stackable items default to 1. (Default: 1)
# Rate Item drop rate. (10000 = 100%)
###########################################################################

View File

@ -26,6 +26,8 @@
#include "party.hpp"
#include "pc.hpp"
using namespace rathena;
static int split_exact_quest_time(char* modif_p, int* day, int* hour, int* minute, int *second);
const std::string QuestDatabase::getDefaultLocation() {
@ -162,13 +164,6 @@ uint64 QuestDatabase::parseBodyNode(const ryml::NodeRef& node) {
return 0;
}
if (!this->nodeExists(targetNode, "Mob") && !this->nodeExists(targetNode, "MinLevel") && !this->nodeExists(targetNode, "MaxLevel") &&
!this->nodeExists(targetNode, "Race") && !this->nodeExists(targetNode, "Size") && !this->nodeExists(targetNode, "Element") &&
!this->nodeExists(targetNode, "Location") && !this->nodeExists(targetNode, "MapName")) {
this->invalidWarning(targetNode, "Targets is missing required field, skipping.\n");
return 0;
}
target = std::make_shared<s_quest_objective>();
target->index = index;
target->mob_id = mob_id;
@ -279,7 +274,7 @@ uint64 QuestDatabase::parseBodyNode(const ryml::NodeRef& node) {
uint16 mapindex = mapindex_name2idx(location.c_str(), nullptr);
if (mapindex == 0) {
if (mapindex == 0 && strcmpi(location.c_str(), "All") != 0) {
this->invalidWarning(targetNode["Location"], "Map \"%s\" not found.\n", location.c_str());
return 0;
}
@ -296,6 +291,35 @@ uint64 QuestDatabase::parseBodyNode(const ryml::NodeRef& node) {
target->map_name = map_name;
}
if (this->nodeExists(targetNode, "MapMobTargets")) {
const auto& MapMobTargetsNode = targetNode["MapMobTargets"];
for (const auto& MapMobTargetsIt : MapMobTargetsNode) {
std::string mob_name;
c4::from_chars(MapMobTargetsIt.key(), &mob_name);
std::shared_ptr<s_mob_db> mob = mobdb_search_aegisname(mob_name.c_str());
if (!mob) {
this->invalidWarning(MapMobTargetsNode[MapMobTargetsIt.key()], "Mob %s does not exist, skipping.\n", mob_name.c_str());
continue;
}
bool active;
if (!this->asBool(MapMobTargetsNode, mob_name, active))
return 0;
if (!active) {
util::vector_erase_if_exists(target->mobs_allowed, mob->id);
continue;
}
if (!util::vector_exists( target->mobs_allowed, mob->id ))
target->mobs_allowed.push_back(mob->id);
}
}
// if max_level is set, min_level is 1
if (target->min_level == 0 && target->max_level > 0)
target->min_level = 1;
@ -708,11 +732,13 @@ void quest_update_objective(struct map_session_data *sd, struct mob_data* md)
continue;
// Process quest objectives
uint8 total_check = 7; // Must pass all checks
for (int j = 0; j < qi->objectives.size(); j++) {
uint8 objective_check = 0; // Must pass all 6 checks
uint8 objective_check = 0;
if (qi->objectives[j]->mob_id == md->mob_id)
objective_check = 6;
objective_check = total_check;
else if (qi->objectives[j]->mob_id == 0) {
if (qi->objectives[j]->min_level == 0 || qi->objectives[j]->min_level <= md->level)
objective_check++;
@ -724,17 +750,21 @@ void quest_update_objective(struct map_session_data *sd, struct mob_data* md)
objective_check++;
if (qi->objectives[j]->element == ELE_ALL || qi->objectives[j]->element == md->status.def_ele)
objective_check++;
if (qi->objectives[j]->mapid < 0 || (qi->objectives[j]->mapid == sd->bl.m && md->spawn != nullptr))
if (qi->objectives[j]->mapid < 0)
objective_check++;
else if (qi->objectives[j]->mapid >= 0) {
else if (qi->objectives[j]->mapid == sd->bl.m)
objective_check++;
else {
struct map_data *mapdata = map_getmapdata(sd->bl.m);
if (mapdata->instance_id && mapdata->instance_src_map == qi->objectives[j]->mapid)
objective_check++;
}
if (qi->objectives[j]->mobs_allowed.empty() || util::vector_exists( qi->objectives[j]->mobs_allowed, md->mob_id ))
objective_check++;
}
if (objective_check == 6 && sd->quest_log[i].count[j] < qi->objectives[j]->count) {
if (objective_check == total_check && sd->quest_log[i].count[j] < qi->objectives[j]->count) {
sd->quest_log[i].count[j]++;
sd->save_quest = true;
clif_quest_update_objective(sd, &sd->quest_log[i]);

View File

@ -35,6 +35,7 @@ struct s_quest_objective {
e_element element;
int16 mapid;
std::string map_name;
std::vector<uint16> mobs_allowed;
};
struct s_quest_db {
@ -55,7 +56,7 @@ enum e_quest_check_type : uint8 {
class QuestDatabase : public TypesafeYamlDatabase<uint32, s_quest_db> {
public:
QuestDatabase() : TypesafeYamlDatabase("QUEST_DB", 2, 1) {
QuestDatabase() : TypesafeYamlDatabase("QUEST_DB", 3, 1) {
}

View File

@ -288,7 +288,7 @@ int do_init( int argc, char** argv ){
return 0;
}
if (!process("QUEST_DB", 2, root_paths, "quest_db", [](const std::string &path, const std::string &name_ext) -> bool {
if (!process("QUEST_DB", 3, root_paths, "quest_db", [](const std::string &path, const std::string &name_ext) -> bool {
return sv_readdb(path.c_str(), name_ext.c_str(), ',', 3 + MAX_QUEST_OBJECTIVES * 2 + MAX_QUEST_DROPS * 3, 100, -1, &quest_read_db, false);
})) {
return 0;