diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-27 20:49:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-27 20:49:42 +0300 |
commit | dc861c49671c06034bfe496851fbe3d307b58b4d (patch) | |
tree | 76d1a08ce15a1ecd87da93a13fb345ee73da0b7f /src/emap/script_buildins.c | |
parent | d149f4bc57d1f46f84a2a68441a27271ce64674a (diff) | |
download | evol-hercules-dc861c49671c06034bfe496851fbe3d307b58b4d.tar.gz evol-hercules-dc861c49671c06034bfe496851fbe3d307b58b4d.tar.bz2 evol-hercules-dc861c49671c06034bfe496851fbe3d307b58b4d.tar.xz evol-hercules-dc861c49671c06034bfe496851fbe3d307b58b4d.zip |
Fix item options in script functions successRemoveCardsIndex and failRemoveCardsIndex.
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r-- | src/emap/script_buildins.c | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 810f94f..a636e21 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -1198,6 +1198,7 @@ BUILDIN(successRemoveCardsIndex) cardflag = 1; item_tmp.nameid = sd->status.inventory[i].card[c]; item_tmp.identify = 1; + sd->status.inventory[i].card[c] = 0; if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) { @@ -1210,29 +1211,10 @@ BUILDIN(successRemoveCardsIndex) if (cardflag == 1) { - //if card was remove replace item with no card - int flag, j; - struct item item_tmp; - memset(&item_tmp,0,sizeof(item_tmp)); - - item_tmp.nameid = sd->status.inventory[i].nameid; - item_tmp.identify = 1; - item_tmp.refine = sd->status.inventory[i].refine; - item_tmp.attribute = sd->status.inventory[i].attribute; - item_tmp.expire_time = sd->status.inventory[i].expire_time; - item_tmp.bound = sd->status.inventory[i].bound; - - for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++) - item_tmp.card[j] = sd->status.inventory[i].card[j]; - - pc->delitem(sd, i, 1, 0, DELITEM_MATERIALCHANGE, LOG_TYPE_SCRIPT); - if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) - { - //chk if can be spawn in inventory otherwise put on floor - clif->additem(sd, 0, 0, flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); - } - + pc->unequipitem(sd, i, PCUNEQUIPITEM_FORCE); + clif->delitem(sd, i, 1, DELITEM_MATERIALCHANGE); + clif->additem(sd, i, 1, 0); + pc->equipitem(sd, i, sd->status.inventory[i].equip); clif->misceffect(&sd->bl,3); } return true; @@ -1264,6 +1246,7 @@ BUILDIN(failedRemoveCardsIndex) if (sd->status.inventory[i].card[c] && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD) { cardflag = 1; + sd->status.inventory[i].card[c] = 0; if (typefail == 2) { // add cards to inventory, clear @@ -1275,7 +1258,7 @@ BUILDIN(failedRemoveCardsIndex) item_tmp.nameid = sd->status.inventory[i].card[c]; item_tmp.identify = 1; - if((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) + if ((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); @@ -1293,29 +1276,10 @@ BUILDIN(failedRemoveCardsIndex) } else if (typefail == 1) { - // destroy the card - int flag, j; - struct item item_tmp; - - memset(&item_tmp, 0, sizeof(item_tmp)); - - item_tmp.nameid = sd->status.inventory[i].nameid; - item_tmp.identify = 1; - item_tmp.refine = sd->status.inventory[i].refine; - item_tmp.attribute = sd->status.inventory[i].attribute; - item_tmp.expire_time = sd->status.inventory[i].expire_time; - item_tmp.bound = sd->status.inventory[i].bound; - - for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++) - item_tmp.card[j] = sd->status.inventory[i].card[j]; - - pc->delitem(sd, i, 1, 0, DELITEM_FAILREFINE, LOG_TYPE_SCRIPT); - - if((flag = pc->additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT))) - { - clif->additem(sd, 0, 0, flag); - map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); - } + pc->unequipitem(sd, i, PCUNEQUIPITEM_FORCE); + clif->delitem(sd, i, 1, DELITEM_MATERIALCHANGE); + clif->additem(sd, i, 1, 0); + pc->equipitem(sd, i, sd->status.inventory[i].equip); } clif->misceffect(&sd->bl, 2); } |