From 5ba29be2a31a4a60c7be61aba3a6050119eb4b14 Mon Sep 17 00:00:00 2001 From: Atemo Date: Mon, 20 Jul 2020 18:59:50 +0200 Subject: [PATCH] Added support for race/size/element/min level/max level quest objectives (#5191) * Added support for race/size/element/min level/max level quest objectives * Enabled Butler for the Richards hunting quests (ep16.1) Co-authored-by: Aleos Thanks to @attackjom, @Balferian ! Took some parts from https://github.com/idathena/trunk/commit/b67c688e791d303a1dfe949bf0bd2b00b7b332ad#diff-f3653b71c45029581a98314726e4d8f5 thanks to @exneval ! --- db/import-tmpl/quest_db.yml | 14 +- db/pre-re/quest_db.yml | 14 +- db/quest_db.yml | 14 +- db/re/quest_db.yml | 64 ++++++++- doc/yaml/db/quest_db.yml | 14 +- npc/re/quests/quests_16_1.txt | 4 - src/map/clif.cpp | 122 +++++++++++++---- src/map/clif.hpp | 2 +- src/map/mob.cpp | 4 +- src/map/mob.hpp | 2 +- src/map/quest.cpp | 246 ++++++++++++++++++++++++++++------ src/map/quest.hpp | 8 +- 12 files changed, 419 insertions(+), 89 deletions(-) diff --git a/db/import-tmpl/quest_db.yml b/db/import-tmpl/quest_db.yml index e426d78209..dc4bceafaf 100644 --- a/db/import-tmpl/quest_db.yml +++ b/db/import-tmpl/quest_db.yml @@ -30,8 +30,18 @@ # Specify without "+" for the exact time the quest expires using "d" (optionnal), [0-23]"h" (required), [0-59]"mn" (optionnal), [0-59]"s" (optionnal) format. # Please note the number before "d" only shift the exact timer to the given day(s). # Targets: Quest objective target. (Default: null) -# - Mob Monster to kill. -# Count Amount of monsters to kill. +# 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). Valids race are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All. +# Size Monster size target (default All). Valids size are Small, Medium, Large, All. +# Element Monster element target (default All). Valids 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) # Drops: Quest item drop targets. (Default: null) # - Mob Monster to kill. 0 will apply to all monsters. (Default: 0) # Item Item to drop. diff --git a/db/pre-re/quest_db.yml b/db/pre-re/quest_db.yml index ddff8d5925..4e84b4f78b 100644 --- a/db/pre-re/quest_db.yml +++ b/db/pre-re/quest_db.yml @@ -30,8 +30,18 @@ # Specify without "+" for the exact time the quest expires using "d" (optionnal), [0-23]"h" (required), [0-59]"mn" (optionnal), [0-59]"s" (optionnal) format. # Please note the number before "d" only shift the exact timer to the given day(s). # Targets: Quest objective target. (Default: null) -# - Mob Monster to kill. -# Count Amount of monsters to kill. +# 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). Valids race are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All. +# Size Monster size target (default All). Valids size are Small, Medium, Large, All. +# Element Monster element target (default All). Valids 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) # Drops: Quest item drop targets. (Default: null) # - Mob Monster to kill. 0 will apply to all monsters. (Default: 0) # Item Item to drop. diff --git a/db/quest_db.yml b/db/quest_db.yml index 9aff01e03d..d80a4a5ed8 100644 --- a/db/quest_db.yml +++ b/db/quest_db.yml @@ -30,8 +30,18 @@ # Specify without "+" for the exact time the quest expires using "d" (optionnal), [0-23]"h" (required), [0-59]"mn" (optionnal), [0-59]"s" (optionnal) format. # Please note the number before "d" only shift the exact timer to the given day(s). # Targets: Quest objective target. (Default: null) -# - Mob Monster to kill. -# Count Amount of monsters to kill. +# 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). Valids race are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All. +# Size Monster size target (default All). Valids size are Small, Medium, Large, All. +# Element Monster element target (default All). Valids 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) # Drops: Quest item drop targets. (Default: null) # - Mob Monster to kill. 0 will apply to all monsters. (Default: 0) # Item Item to drop. diff --git a/db/re/quest_db.yml b/db/re/quest_db.yml index d5c8bb5b66..00a8f5b355 100644 --- a/db/re/quest_db.yml +++ b/db/re/quest_db.yml @@ -30,8 +30,18 @@ # Specify without "+" for the exact time the quest expires using "d" (optionnal), [0-23]"h" (required), [0-59]"mn" (optionnal), [0-59]"s" (optionnal) format. # Please note the number before "d" only shift the exact timer to the given day(s). # Targets: Quest objective target. (Default: null) -# - Mob Monster to kill. -# Count Amount of monsters to kill. +# 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). Valids race are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All. +# Size Monster size target (default All). Valids size are Small, Medium, Large, All. +# Element Monster element target (default All). Valids 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) # Drops: Quest item drop targets. (Default: null) # - Mob Monster to kill. 0 will apply to all monsters. (Default: 0) # Item Item to drop. @@ -2245,24 +2255,74 @@ Body: Title: The Royal Richard - Id: 5404 Title: "[Repeat]Warrior Discipline-Human" + Targets: + - Id: 1 + Count: 50 + Race: DemiHuman + MinLevel: 140 - Id: 5405 Title: "[Repeat]Warrior Discipline-Animal" + Targets: + - Id: 1 + Count: 50 + Race: Brute + MinLevel: 140 - Id: 5406 Title: "[Repeat]Warrior Discipline-Insect" + Targets: + - Id: 1 + Count: 50 + Race: Insect + MinLevel: 140 - Id: 5407 Title: "[Repeat]Warrior Discipline-Fish" + Targets: + - Id: 1 + Count: 50 + Race: Fish + MinLevel: 140 - Id: 5408 Title: "[Repeat]Warrior Discipline-Plant" + Targets: + - Id: 1 + Count: 50 + Race: Plant + MinLevel: 140 - Id: 5409 Title: "[Repeat]Warrior Discipline-Devil" + Targets: + - Id: 1 + Count: 50 + Race: Demon + MinLevel: 140 - Id: 5410 Title: "[Repeat]Warrior Discipline-Angel" + Targets: + - Id: 1 + Count: 50 + Race: Angel + MinLevel: 140 - Id: 5411 Title: "[Repeat]Warrior Discipline-Immortal" + Targets: + - Id: 1 + Count: 50 + Race: Undead + MinLevel: 140 - Id: 5412 Title: "[Repeat]Warrior Discipline-Intangible" + Targets: + - Id: 1 + Count: 50 + Race: Formless + MinLevel: 140 - Id: 5413 Title: "[Repeat]Warrior Discipline-Dragon" + Targets: + - Id: 1 + Count: 50 + Race: Dragon + MinLevel: 140 - Id: 5414 Title: "[Stand by]Warrior Discipline" TimeLimit: 4h diff --git a/doc/yaml/db/quest_db.yml b/doc/yaml/db/quest_db.yml index 4f2fe56861..f7abed29c1 100644 --- a/doc/yaml/db/quest_db.yml +++ b/doc/yaml/db/quest_db.yml @@ -13,8 +13,18 @@ # Specify without "+" for the exact time the quest expires using "d" (optionnal), [0-23]"h" (required), [0-59]"mn" (optionnal), [0-59]"s" (optionnal) format. # Please note the number before "d" only shift the exact timer to the given day(s). # Targets: Quest objective target. (Default: null) -# - Mob Monster to kill. -# Count Amount of monsters to kill. +# 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). Valids race are Angel, Brute, DemiHuman, Demon, Dragon, Fish, Formless, Insect, Plant, Undead, All. +# Size Monster size target (default All). Valids size are Small, Medium, Large, All. +# Element Monster element target (default All). Valids 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) # Drops: Quest item drop targets. (Default: null) # - Mob Monster to kill. 0 will apply to all monsters. (Default: 0) # Item Item to drop. diff --git a/npc/re/quests/quests_16_1.txt b/npc/re/quests/quests_16_1.txt index c39a59f96c..4575a5fb02 100644 --- a/npc/re/quests/quests_16_1.txt +++ b/npc/re/quests/quests_16_1.txt @@ -8622,10 +8622,6 @@ prt_cas_q,80,80,4 script Butler for the Richards 1_M_LIBRARYMASTER,{ next; } if (checkquest(.@quest_list[.@i],HUNTING) == 2) { - // todo src side - mes "This quest isn't enabled for now."; - close; - if (isbegin_quest(5403) == 1) completequest 5403;// The Royal Richard erasequest .@quest_list[.@i]; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index b6d29b590c..1a535792d3 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -17048,12 +17048,55 @@ static void clif_quest_len(int def_len, int info_len, int avail_quests, int *lim (*len_out) = ((*limit_out) * info_len) + def_len; } +std::string clif_mobtype_name(e_race race, e_size size, e_element element) { + std::string race_name, size_name, ele_name; + + switch(race) { + case RC_FORMLESS: race_name = "Formless"; break; + case RC_UNDEAD: race_name = "Undead"; break; + case RC_BRUTE: race_name = "Brute"; break; + case RC_PLANT: race_name = "Plant"; break; + case RC_INSECT: race_name = "Insect"; break; + case RC_FISH: race_name = "Fish"; break; + case RC_DEMON: race_name = "Demon"; break; + case RC_DEMIHUMAN: race_name = "Demihuman"; break; + case RC_ANGEL: race_name = "Angel"; break; + case RC_DRAGON: race_name = "Dragon"; break; + case RC_ALL: race_name = ""; break; + default: race_name = "unknown"; break; + } + switch(size) { + case SZ_SMALL: size_name = "Small"; break; + case SZ_MEDIUM: size_name = "Medium"; break; + case SZ_BIG: size_name = "Large"; break; + case SZ_ALL: size_name = ""; break; + default: size_name = "unknown"; break; + } + switch(element) { + case ELE_NEUTRAL: ele_name = "Neutral Element"; break; + case ELE_WATER: ele_name = "Water Element"; break; + case ELE_EARTH: ele_name = "Earth Element"; break; + case ELE_FIRE: ele_name = "Fire Element"; break; + case ELE_WIND: ele_name = "Wind Element"; break; + case ELE_POISON: ele_name = "Poison Element"; break; + case ELE_HOLY: ele_name = "Holy Element"; break; + case ELE_DARK: ele_name = "Shadow Element"; break; + case ELE_GHOST: ele_name = "Ghost Element"; break; + case ELE_UNDEAD: ele_name = "Undead Element"; break; + case ELE_ALL: ele_name = ""; break; + default: ele_name = "unknown"; break; + } + return (race_name + (race_name.size() && size_name.size() ? ", " + size_name : size_name) + ((race_name.size() || size_name.size()) && ele_name.size() ? ", " + ele_name : ele_name)); +} + /// Sends list of all quest states /// 02b1 .W .L { .L .B }*num (ZC_ALL_QUEST_LIST) /// 097a .W .L { .L .B .L