From 70552c6111fef08700693de37ffe2b4beec1809f Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sat, 15 Feb 2020 02:04:07 +0100 Subject: Add new field Intimacy.StarvingDelay to pet DB --- db/pre-re/pet_db.conf | 1 + db/re/pet_db.conf | 1 + src/map/pet.c | 15 +++++++++++---- src/map/pet.h | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/db/pre-re/pet_db.conf b/db/pre-re/pet_db.conf index a2a143b9e..101fb3912 100644 --- a/db/pre-re/pet_db.conf +++ b/db/pre-re/pet_db.conf @@ -48,6 +48,7 @@ pet_db:( FeedIncrement: feeding intimacy (int, defaults to 10) OverFeedDecrement: overfeeding intimacy (int, defaults to 100) OwnerDeathDecrement: owner die intimacy (int, defaults to 20) + StarvingDelay: starving time (int, defaults to 20) } CaptureRate: capture rate (int, defaults to 1000) Speed: speed (int, defaults to 150) diff --git a/db/re/pet_db.conf b/db/re/pet_db.conf index 9f980481b..d4203ab43 100644 --- a/db/re/pet_db.conf +++ b/db/re/pet_db.conf @@ -48,6 +48,7 @@ pet_db:( FeedIncrement: feeding intimacy (int, defaults to 10) OverFeedDecrement: overfeeding intimacy (int, defaults to 100) OwnerDeathDecrement: owner die intimacy (int, defaults to 20) + StarvingDelay: starving time (int, defaults to 20) } CaptureRate: capture rate (int, defaults to 1000) Speed: speed (int, defaults to 150) 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; -- cgit v1.2.3-60-g2f50