diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-14 23:59:51 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:20:35 +0200 |
commit | f71c45257cf0aa0d45c19045f4c91e9189cd25e2 (patch) | |
tree | 82f9494e28df70867dc99281d67a8498df788dce | |
parent | 484405005eba7399f435802443487e2b6ae1e163 (diff) | |
download | hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.gz hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.bz2 hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.tar.xz hercules-f71c45257cf0aa0d45c19045f4c91e9189cd25e2.zip |
Change EggItem field in pet DB to be mandatory
-rw-r--r-- | db/pre-re/pet_db.conf | 2 | ||||
-rw-r--r-- | db/re/pet_db.conf | 2 | ||||
-rw-r--r-- | src/map/pet.c | 20 |
3 files changed, 14 insertions, 10 deletions
diff --git a/db/pre-re/pet_db.conf b/db/pre-re/pet_db.conf index 28847bc78..d80434f46 100644 --- a/db/pre-re/pet_db.conf +++ b/db/pre-re/pet_db.conf @@ -35,9 +35,9 @@ pet_db:( // ================ Mandatory fields ============================== Id: ID (int) Name: "Pet Name" (string) + EggItem: Egg Id (string, defaults to 0) // ================ Optional fields =============================== TamingItem: Taming Item (string, defaults to 0) - EggItem: Egg Id (string, defaults to 0) AccessoryItem: Equipment Id (string, defaults to 0) FoodItem: Food Id (string, defaults to 0) FoodEffectiveness: hunger points (int, defaults to 0) diff --git a/db/re/pet_db.conf b/db/re/pet_db.conf index 17d3bad2c..3a1ceb5e0 100644 --- a/db/re/pet_db.conf +++ b/db/re/pet_db.conf @@ -35,9 +35,9 @@ pet_db:( // ================ Mandatory fields ============================== Id: ID (int) Name: "Pet Name" (string) + EggItem: Egg Id (string, defaults to 0) // ================ Optional fields =============================== TamingItem: Taming Item (string, defaults to 0) - EggItem: Egg Id (string, defaults to 0) AccessoryItem: Equipment Id (string, defaults to 0) FoodItem: Food Id (string, defaults to 0) FoodEffectiveness: hunger points (int, defaults to 0) diff --git a/src/map/pet.c b/src/map/pet.c index dbbce7e04..ba873dd4b 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1365,19 +1365,23 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc } safestrncpy(pet->db[n].jname, str, sizeof(pet->db[n].jname)); - if (libconfig->setting_lookup_string(it, "TamingItem", &str)) { - if (!(data = itemdb->name2id(str))) { - ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); - } else { - pet->db[n].itemID = data->nameid; - } + if (libconfig->setting_lookup_string(it, "EggItem", &str) == CONFIG_FALSE || *str == '\0') { + ShowWarning("pet_read_db_sub: Missing EggItem in pet %d of \"%s\", skipping.\n", pet->db[n].class_, source); + return 0; } - if (libconfig->setting_lookup_string(it, "EggItem", &str)) { + if ((data = itemdb->name2id(str)) == NULL) { + ShowWarning("pet_read_db_sub: Invalid EggItem '%s' in pet %d of \"%s\", skipping.\n", str, pet->db[n].class_, source); + return 0; + } + + pet->db[n].EggID = data->nameid; + + if (libconfig->setting_lookup_string(it, "TamingItem", &str)) { if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].EggID = data->nameid; + pet->db[n].itemID = data->nameid; } } |