summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-07-30 14:15:21 +0800
committerEmistry Haoyan <equinox1991@gmail.com>2019-08-26 22:28:23 +0800
commitd3205c2fac99c0ef42249664c98505c7adf324b4 (patch)
tree5e27d2d5c49277c88f2d19f36daaf68f63d42a83
parent307248a5eefca196660c75e06cb6d4d0b84e2c43 (diff)
downloadhercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.gz
hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.bz2
hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.tar.xz
hercules-d3205c2fac99c0ef42249664c98505c7adf324b4.zip
Update Siegfried Tokens support.
- allow player to revive if inventory consists of any type of siegfried tokens listed in the `ITMCHAIN_SIEGFRIED`.
-rw-r--r--db/pre-re/item_chain.conf6
-rw-r--r--db/re/item_chain.conf6
-rw-r--r--src/map/clif.c13
-rw-r--r--src/map/itemdb.c5
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/pc.c24
-rw-r--r--src/map/pc.h1
7 files changed, 50 insertions, 7 deletions
diff --git a/db/pre-re/item_chain.conf b/db/pre-re/item_chain.conf
index a2e4efff4..cdc92d92c 100644
--- a/db/pre-re/item_chain.conf
+++ b/db/pre-re/item_chain.conf
@@ -59,6 +59,12 @@ ITMCHAIN_ORE: {
Emperium: 5
}
+ITMCHAIN_SIEGFRIED: {
+ Token_Of_Siegfried: 1
+ F_Token_Of_Siegfried: 1
+ E_Token_Of_Siegfried: 1
+}
+
ITMCHAIN_GEM: {
Dark_Red_Jewel: 80
Violet_Jewel: 30
diff --git a/db/re/item_chain.conf b/db/re/item_chain.conf
index a2e4efff4..cdc92d92c 100644
--- a/db/re/item_chain.conf
+++ b/db/re/item_chain.conf
@@ -59,6 +59,12 @@ ITMCHAIN_ORE: {
Emperium: 5
}
+ITMCHAIN_SIEGFRIED: {
+ Token_Of_Siegfried: 1
+ F_Token_Of_Siegfried: 1
+ E_Token_Of_Siegfried: 1
+}
+
ITMCHAIN_GEM: {
Dark_Red_Jewel: 80
Violet_Jewel: 30
diff --git a/src/map/clif.c b/src/map/clif.c
index 1c245ed43..2be9619c8 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -16398,10 +16398,14 @@ static void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
{
if (pc_istrading(sd) || pc_isvending(sd))
return;
+
if (!pc_isdead(sd))
return;
- int item_position = pc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
+ if (sd->sc.data[SC_HELLPOWER]) //Cannot res while under the effect of SC_HELLPOWER.
+ return;
+
+ int item_position = pc->have_item_chain(sd, ECC_SIEGFRIED);
int hpsp = 100;
if (item_position == INDEX_NOT_FOUND) {
@@ -16411,18 +16415,15 @@ static void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
return;
}
- if (sd->sc.data[SC_HELLPOWER]) //Cannot res while under the effect of SC_HELLPOWER.
- return;
-
if (!status->revive(&sd->bl, hpsp, hpsp))
return;
if (item_position == INDEX_NOT_FOUND)
- status_change_end(&sd->bl,SC_LIGHT_OF_REGENE,INVALID_TIMER);
+ status_change_end(&sd->bl, SC_LIGHT_OF_REGENE, INVALID_TIMER);
else
pc->delitem(sd, item_position, 1, 0, DELITEM_SKILLUSE, LOG_TYPE_CONSUME);
- clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION, 4, 1);
+ clif->skill_nodamage(&sd->bl, &sd->bl, ALL_RESURRECTION, 4, 1);
}
/// Information about character's status values (ZC_ACK_STATUS_GM).
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 5c56794d8..bb2732b17 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1523,6 +1523,11 @@ static void itemdb_read_chains(void)
else
itemdb->chain_cache[ECC_ORE] = i;
+ if (!script->get_constant("ITMCHAIN_SIEGFRIED", &i))
+ ShowWarning("itemdb_read_chains: failed to find 'ITMCHAIN_SIEGFRIED' chain to link to cache!\n");
+ else
+ itemdb->chain_cache[ECC_SIEGFRIED] = 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 f66abe066..7da7609f1 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -139,7 +139,6 @@ enum item_itemid {
ITEMID_COATING_BOTTLE = 7139,
ITEMID_FRAGMENT_OF_CRYSTAL = 7321,
ITEMID_SKULL_ = 7420,
- ITEMID_TOKEN_OF_SIEGFRIED = 7621,
ITEMID_SPECIAL_ALLOY_TRAP = 7940,
ITEMID_CATNIP_FRUIT = 11602,
ITEMID_RED_POUCH_OF_SURPRISE = 12024,
@@ -359,6 +358,7 @@ enum geneticist_item_list {
//
enum e_chain_cache {
ECC_ORE,
+ ECC_SIEGFRIED,
/* */
ECC_MAX,
};
diff --git a/src/map/pc.c b/src/map/pc.c
index 24f71f47b..a2ed4fb8a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -12215,6 +12215,29 @@ static int pc_have_magnifier(struct map_session_data *sd)
}
/**
+ * checks if player have any item that listed in item chain
+ * @param sd map_session_data of Player
+ * @param chain_id unsigned short of item chain id
+ * @return index of inventory, INDEX_NOT_FOUND if it is not found
+ */
+static int pc_have_item_chain(struct map_session_data *sd, unsigned short chain_id)
+{
+ if (chain_id >= itemdb->chain_count) {
+ ShowError("itemdb_chain_item: unknown chain id %d\n", chain_id);
+ return INDEX_NOT_FOUND;
+ }
+
+ for (int n = 0; n < itemdb->chains[chain_id].qty; n++) {
+ struct item_chain_entry *entry = &itemdb->chains[chain_id].items[n];
+ int index = pc->search_inventory(sd, entry->id);
+ if (index != INDEX_NOT_FOUND)
+ return index;
+ }
+
+ return INDEX_NOT_FOUND;
+}
+
+/**
* Checks if player have basic skills learned.
* @param sd Player Data
* @param level Required Level of Novice Skill
@@ -12823,6 +12846,7 @@ void pc_defaults(void)
pc->update_idle_time = pc_update_idle_time;
pc->have_magnifier = pc_have_magnifier;
+ pc->have_item_chain = pc_have_item_chain;
pc->check_basicskill = pc_check_basicskill;
diff --git a/src/map/pc.h b/src/map/pc.h
index 8df02a891..49edea61b 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1184,6 +1184,7 @@ END_ZEROED_BLOCK; /* End */
void (*update_idle_time) (struct map_session_data* sd, enum e_battle_config_idletime type);
int (*have_magnifier) (struct map_session_data *sd);
+ int (*have_item_chain) (struct map_session_data *sd, unsigned short chain_id);
bool (*process_chat_message) (struct map_session_data *sd, const char *message);
int (*wis_message_to_gm) (const char *sender_name, int permission, const char *message);