From 7c6e21a9057b07929b55de23ae67299434edb6db Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Thu, 12 Mar 2020 17:22:36 +0100 Subject: Remove IT_DELAYCONSUME related auto-cast code First of all: In official servers, skill casting item are consumed immediately and thus IT_DELAYCONSUME should not be used for those items And additionally these code blocks are obsolete, because of the way how skill casting items work. * If the item won't check the skill's requirements, the code block to delete the item of type IT_DELAYCONSUME isn't even executed. * If the item does check the skill's requirements, the check is done prior to the skill casting which would be the same as using IT_USABLE. --- src/map/pc.c | 5 ----- src/map/skill.c | 19 ------------------- 2 files changed, 24 deletions(-) (limited to 'src') diff --git a/src/map/pc.c b/src/map/pc.c index e181b5f89..5d87d017d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5295,11 +5295,6 @@ static int pc_useitem(struct map_session_data *sd, int n) if(sd->catch_target_class != -1) //Abort pet catching. sd->catch_target_class = -1; - // Unset auto-cast related data for items of type IT_DELAYCONSUME or the item won't be consumed. - // TODO: Check if this is still required. [Kenpachi] - if (sd->inventory_data[n]->flag.delay_consume != 0) - sd->autocast.type = AUTOCAST_NONE; - amount = sd->status.inventory[n].amount; //Check if the item is to be consumed immediately [Skotlex] if (sd->inventory_data[n]->flag.delay_consume || sd->inventory_data[n]->flag.keepafteruse) diff --git a/src/map/skill.c b/src/map/skill.c index 6fc1b80a2..e779e9859 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14095,25 +14095,6 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s if( !sc->count ) sc = NULL; - // TODO: Check if the validation of delayed consume is still required. (See the delayed consume related TODO in pc_useitem().) - if (sd->autocast.type == AUTOCAST_ITEM) { - int i = sd->itemindex; - - if (i == INDEX_NOT_FOUND || sd->status.inventory[i].nameid != sd->itemid || sd->inventory_data[i] == NULL - || sd->status.inventory[i].amount < 1) { // Something went wrong. Item exploit? - sd->itemid = INDEX_NOT_FOUND; - sd->itemindex = INDEX_NOT_FOUND; - return 0; - } - - // Consume the item. Rental usable items are not consumed until expiration. - if (sd->status.inventory[i].expire_time == 0 && sd->inventory_data[i]->flag.delay_consume == 1) - pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); - - sd->itemid = INDEX_NOT_FOUND; - sd->itemindex = INDEX_NOT_FOUND; - } - if (pc_is90overweight(sd) && sd->autocast.type != AUTOCAST_ITEM) { // Skill casting items ignore the overweight restriction. clif->skill_fail(sd, skill_id, USESKILL_FAIL_WEIGHTOVER, 0, 0); return 0; -- cgit v1.2.3-60-g2f50