summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorDastgir <dastgirp@gmail.com>2018-06-05 12:10:05 +0530
committerAsheraf <acheraf1998@gmail.com>2018-06-25 21:21:27 +0100
commit9a95d3c61f8195c326ed430323074ef8ec23273c (patch)
tree5a8c81a39bfb437d4d6d18bca44881617d73cda1 /src/map/pet.c
parent7c9860b275ee1c1d39bad2ca2551da82bd525267 (diff)
downloadhercules-9a95d3c61f8195c326ed430323074ef8ec23273c.tar.gz
hercules-9a95d3c61f8195c326ed430323074ef8ec23273c.tar.bz2
hercules-9a95d3c61f8195c326ed430323074ef8ec23273c.tar.xz
hercules-9a95d3c61f8195c326ed430323074ef8ec23273c.zip
Implemented Pet Autofeeding
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map/pet.c b/src/map/pet.c
index 4bac79dc8..4e3503b05 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -233,6 +233,13 @@ int pet_hungry(int tid, int64 tick, int id, intptr_t data) {
return 1; //You lost the pet already, the rest is irrelevant.
pd->pet.hungry--;
+ /* Pet Autofeed */
+ if (battle_config.feature_enable_homun_autofeed != 0) {
+ if (pd->petDB->autofeed == 1 && pd->pet.autofeed == 1 && pd->pet.hungry <= 25) {
+ pet->food(sd, pd);
+ }
+ }
+
if( pd->pet.hungry < 0 )
{
pet_stop_attack(pd);
@@ -1359,6 +1366,9 @@ int pet_read_db_sub(struct config_setting_t *it, int n, const char *source)
if (libconfig->setting_lookup_int(it, "ChangeTargetRate", &i32))
pet->db[n].change_target_rate = i32;
+ if ((t = libconfig->setting_get_member(it, "AutoFeed")) && (i32 = libconfig->setting_get_bool(t)))
+ pet->db[n].autofeed = i32;
+
if (libconfig->setting_lookup_string(it, "PetScript", &str))
pet->db[n].pet_script = *str ? script->parse(str, source, -pet->db[n].class_, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;