summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheraf <acheraf1998@gmail.com>2020-01-01 16:15:01 +0100
committerJesusaves <cpntb1@ymail.com>2021-02-15 17:37:49 -0300
commit1c49e9fdac93fee27ccd0a3078bd93a9c9a47d5f (patch)
tree61d0fbb7c09a30f1dc29d9a5bdb6dff09f0082e5
parent3d37243e8d397bb73f058692dbd90bebb7201eab (diff)
downloadhercules-1c49e9fdac93fee27ccd0a3078bd93a9c9a47d5f.tar.gz
hercules-1c49e9fdac93fee27ccd0a3078bd93a9c9a47d5f.tar.bz2
hercules-1c49e9fdac93fee27ccd0a3078bd93a9c9a47d5f.tar.xz
hercules-1c49e9fdac93fee27ccd0a3078bd93a9c9a47d5f.zip
Add support for auto exp insurance items
-rw-r--r--src/map/itemdb.c5
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/pc.c17
-rw-r--r--src/map/pc.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 5dc3d9317..b016af1c9 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1552,6 +1552,11 @@ static void itemdb_read_chains(void)
else
itemdb->chain_cache[ECC_SIEGFRIED] = i;
+ if (!script->get_constant("ITMCHAIN_NEO_INSURANCE", &i))
+ ShowWarning("itemdb_read_chains: failed to find 'ITMCHAIN_NEO_INSURANCE' chain to link to cache!\n");
+ else
+ itemdb->chain_cache[ECC_NEO_INSURANCE] = i;
+
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, config_filename);
}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 8785f8195..53d378e1a 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -359,6 +359,7 @@ enum geneticist_item_list {
enum e_chain_cache {
ECC_ORE,
ECC_SIEGFRIED,
+ ECC_NEO_INSURANCE,
/* */
ECC_MAX,
};
diff --git a/src/map/pc.c b/src/map/pc.c
index f862a739d..e9332ee46 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8188,6 +8188,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src)
&& pc->isDeathPenaltyJob(sd->job)
&& !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m)
&& !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY]
+ && !pc->auto_exp_insurance(sd)
) {
if (battle_config.death_penalty_base > 0) {
unsigned int base_penalty = 0;
@@ -12391,6 +12392,21 @@ static bool pc_expandInventory(struct map_session_data *sd, int adjustSize)
return true;
}
+static bool pc_auto_exp_insurance(struct map_session_data *sd)
+{
+ nullpo_retr(false, sd);
+
+ int item_position = pc->have_item_chain(sd, ECC_NEO_INSURANCE);
+ if (item_position == INDEX_NOT_FOUND)
+ return false;
+
+ pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME);
+#if PACKETVER >= 20100914
+ clif->msgtable(sd, MSG_NOTIFY_NEO_INSURANCE_ITEM_USE);
+#endif
+ return true;
+}
+
static void do_final_pc(void)
{
@@ -12797,4 +12813,5 @@ void pc_defaults(void)
pc->isDeathPenaltyJob = pc_isDeathPenaltyJob;
pc->has_second_costume = pc_has_second_costume;
pc->expandInventory = pc_expandInventory;
+ pc->auto_exp_insurance = pc_auto_exp_insurance;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 7a42be5be..cc8d83b65 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1196,6 +1196,7 @@ END_ZEROED_BLOCK; /* End */
bool (*isDeathPenaltyJob) (uint16 job);
bool (*has_second_costume) (struct map_session_data *sd);
bool (*expandInventory) (struct map_session_data *sd, int adjustSize);
+ bool (*auto_exp_insurance) (struct map_session_data *sd);
};
#ifdef HERCULES_CORE