diff --git a/db/import-tmpl/quest_db.yml b/db/import-tmpl/quest_db.yml index 340fe380ad..1f7645470f 100644 --- a/db/import-tmpl/quest_db.yml +++ b/db/import-tmpl/quest_db.yml @@ -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) +# : 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 diff --git a/db/pre-re/quest_db.yml b/db/pre-re/quest_db.yml index fea2106340..1b8a4435ce 100644 --- a/db/pre-re/quest_db.yml +++ b/db/pre-re/quest_db.yml @@ -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) +# : 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 diff --git a/db/quest_db.yml b/db/quest_db.yml index 3eae160b7f..de15272086 100644 --- a/db/quest_db.yml +++ b/db/quest_db.yml @@ -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) +# : 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: diff --git a/db/re/quest_db.yml b/db/re/quest_db.yml index 384e5fc8ae..830beece66 100644 --- a/db/re/quest_db.yml +++ b/db/re/quest_db.yml @@ -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) +# : 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 diff --git a/doc/quest_db.txt b/doc/quest_db.txt new file mode 100644 index 0000000000..723ec0aa45 --- /dev/null +++ b/doc/quest_db.txt @@ -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. + : 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%) diff --git a/doc/yaml/db/quest_db.yml b/doc/yaml/db/quest_db.yml index e23d477320..1c7a0ad3a4 100644 --- a/doc/yaml/db/quest_db.yml +++ b/doc/yaml/db/quest_db.yml @@ -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) +# : 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%) ########################################################################### diff --git a/src/map/quest.cpp b/src/map/quest.cpp index cb05f74f35..8040677bdd 100644 --- a/src/map/quest.cpp +++ b/src/map/quest.cpp @@ -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(); 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 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]); diff --git a/src/map/quest.hpp b/src/map/quest.hpp index 522d1c30f3..0668cac760 100644 --- a/src/map/quest.hpp +++ b/src/map/quest.hpp @@ -35,6 +35,7 @@ struct s_quest_objective { e_element element; int16 mapid; std::string map_name; + std::vector mobs_allowed; }; struct s_quest_db { @@ -55,7 +56,7 @@ enum e_quest_check_type : uint8 { class QuestDatabase : public TypesafeYamlDatabase { public: - QuestDatabase() : TypesafeYamlDatabase("QUEST_DB", 2, 1) { + QuestDatabase() : TypesafeYamlDatabase("QUEST_DB", 3, 1) { } diff --git a/src/tool/csv2yaml.cpp b/src/tool/csv2yaml.cpp index c25d3d4301..35b13158bd 100644 --- a/src/tool/csv2yaml.cpp +++ b/src/tool/csv2yaml.cpp @@ -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;