diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-15 02:04:07 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:20:35 +0200 |
commit | 70552c6111fef08700693de37ffe2b4beec1809f (patch) | |
tree | 36cec89307a581ffe60c709714c1a4c7f2e951bc /src | |
parent | dc4328d040269cdb32f50c729ada4fad392499b4 (diff) | |
download | hercules-70552c6111fef08700693de37ffe2b4beec1809f.tar.gz hercules-70552c6111fef08700693de37ffe2b4beec1809f.tar.bz2 hercules-70552c6111fef08700693de37ffe2b4beec1809f.tar.xz hercules-70552c6111fef08700693de37ffe2b4beec1809f.zip |
Add new field Intimacy.StarvingDelay to pet DB
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pet.c | 15 | ||||
-rw-r--r-- | src/map/pet.h | 1 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/map/pet.c b/src/map/pet.c index 5f2fb429f..649884468 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -271,6 +271,8 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data) } } + interval = pd->petDB->hungry_delay; + if (pd->pet.hungry < PET_HUNGER_STARVING) { pet_stop_attack(pd); @@ -280,13 +282,14 @@ static int pet_hungry(int tid, int64 tick, int id, intptr_t data) pd->status.speed = pd->db->status.speed; status_calc_pet(pd, SCO_NONE); clif->send_petdata(sd,pd,1,pd->pet.intimate); + + if (pd->petDB->starving_delay > 0) + interval = pd->petDB->starving_delay; } clif->send_petdata(sd,pd,2,pd->pet.hungry); - if(battle_config.pet_hungry_delay_rate != 100) - interval = (pd->petDB->hungry_delay*battle_config.pet_hungry_delay_rate)/100; - else - interval = pd->petDB->hungry_delay; + interval *= battle_config.pet_hungry_delay_rate / 100; + if(interval <= 0) interval = 1; pd->pet_hungry_timer = timer->add(tick+interval,pet->hungry,sd->bl.id,0); @@ -1424,6 +1427,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc pet->db[n].r_hungry = 10; pet->db[n].r_full = 100; pet->db[n].die = 20; + pet->db[n].starving_delay = min(20000, pet->db[n].hungry_delay); if ((t = libconfig->setting_get_member(it, "Intimacy"))) { if (config_setting_is_group(t)) { @@ -1563,6 +1567,9 @@ static bool pet_read_db_sub_intimacy(int idx, struct config_setting_t *t) if (libconfig->setting_lookup_int(t, "OwnerDeathDecrement", &i32)) pet->db[idx].die = cap_value(i32, PET_INTIMACY_NONE, PET_INTIMACY_MAX); + if (libconfig->setting_lookup_int(t, "StarvingDelay", &i32) == CONFIG_TRUE) + pet->db[idx].starving_delay = cap_value(1000 * i32, 0, pet->db[idx].hungry_delay); + return true; } diff --git a/src/map/pet.h b/src/map/pet.h index 7b653938e..98b6f3517 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -58,6 +58,7 @@ struct s_pet_db { int change_target_rate; int autofeed; int hunger_decrement; + int starving_delay; struct script_code *equip_script; struct script_code *pet_script; |