summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 834a7f871..433b67b46 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -67,6 +67,8 @@ char motd_text[MOTD_LINE_SIZE][256]; // Message of the day buffer [Valaris]
struct duel duel_list[MAX_DUEL];
int duel_count = 0;
+extern int item_delays; // [Paradox924X]
+
//Links related info to the sd->hate_mob[]/sd->feel_map[] entries
const struct sg_data sg_info[3] = {
{ SG_SUN_ANGER, SG_SUN_BLESS, SG_SUN_COMFORT, "PC_FEEL_SUN", "PC_HATE_MOB_SUN", is_day_of_sun },
@@ -531,6 +533,11 @@ int pc_setinventorydata(struct map_session_data *sd)
for(i=0;i<MAX_INVENTORY;i++) {
id = sd->status.inventory[i].nameid;
sd->inventory_data[i] = id?itemdb_search(id):NULL;
+ if(sd->inventory_data[i] && sd->inventory_data[i]->delay > 0) { // Load delays
+ sd->item_delay[item_delays].nameid = sd->inventory_data[i]->nameid;
+ sd->item_delay[item_delays].tick = 0;
+ ++item_delays;
+ }
}
return 0;
}
@@ -3654,8 +3661,8 @@ int pc_isUseitem(struct map_session_data *sd,int n)
*------------------------------------------*/
int pc_useitem(struct map_session_data *sd,int n)
{
- unsigned int tick = gettick();
- int amount;
+ unsigned int delay, tick = gettick();
+ int amount, i, nameid;
struct script_code *script;
nullpo_ret(sd);
@@ -3681,6 +3688,16 @@ int pc_useitem(struct map_session_data *sd,int n)
))
return 0;
+ // Store information for later use before it is lost (via pc_delitem) [Paradox924X]
+ nameid = sd->inventory_data[n]->nameid;
+ delay = sd->inventory_data[n]->delay;
+
+ if( sd->inventory_data[n]->delay > 0 ) { // Check if there is a delay on this item [Paradox924X]
+ ARR_FIND(0, item_delays, i, sd->item_delay[i].nameid == nameid);
+ if( i < item_delays && DIFF_TICK(sd->item_delay[i].tick, tick) > 0 )
+ return 0; // Delay has not expired yet
+ }
+
//Since most delay-consume items involve using a "skill-type" target cursor,
//perform a skill-use check before going through. [Skotlex]
//resurrection was picked as testing skill, as a non-offensive, generic skill, it will do.
@@ -3725,6 +3742,8 @@ int pc_useitem(struct map_session_data *sd,int n)
sd->canuseitem_tick = tick + battle_config.item_use_interval;
if( itemdb_iscashfood(sd->status.inventory[n].nameid) )
sd->canusecashfood_tick = tick + battle_config.cashfood_use_interval;
+ if( delay > 0 && i < item_delays )
+ sd->item_delay[i].tick = tick + delay;
run_script(script,0,sd->bl.id,fake_nd->bl.id);
potion_flag = 0;