summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-03-12 00:14:52 +0100
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-03-14 22:35:10 +0100
commit10312bc4329e16a4b4420131cb976ef9fa6a13f5 (patch)
tree812a0b6ec879bd9bace3b89f7e0fe8cffabb6cb3 /src/map
parent6f49858747acc7ee3767dd431bec32b919b81536 (diff)
downloadhercules-10312bc4329e16a4b4420131cb976ef9fa6a13f5.tar.gz
hercules-10312bc4329e16a4b4420131cb976ef9fa6a13f5.tar.bz2
hercules-10312bc4329e16a4b4420131cb976ef9fa6a13f5.tar.xz
hercules-10312bc4329e16a4b4420131cb976ef9fa6a13f5.zip
Remove obsolete auto-cast type validation from skill_check_condition_castbegin() function
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 8515cc3c9..89729c572 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14099,27 +14099,23 @@ 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) {
- if (sd->autocast.type == AUTOCAST_ABRA || sd->autocast.type == AUTOCAST_IMPROVISE) { // Abracadabra or Improvised Song was used.
- sd->autocast.type = AUTOCAST_NONE;
- } else {
- int i;
- // When a target was selected, consume items that were skipped in pc_use_item [Skotlex]
- if( (i = sd->itemindex) == -1 ||
- 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 = sd->itemindex = -1;
- return 0;
- }
+ int i = sd->itemindex;
- //Consume
- sd->itemid = sd->itemindex = -1;
- if (sd->status.inventory[i].expire_time == 0 && sd->inventory_data[i]->flag.delay_consume == 1) // Rental usable items are not consumed until expiration
- pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME);
+ 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.