diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-21 23:22:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-21 23:22:55 +0300 |
commit | 4333293820d5c7de27e9e760dfeaadbc1686f2c3 (patch) | |
tree | 8b85e0447407cfe6cb58a935c3c27d3dc6c9ed09 /src/emap/script.c | |
parent | 36fb4cda271bda394b7e5e3b5911c6d9858aa8f8 (diff) | |
download | plugin-4333293820d5c7de27e9e760dfeaadbc1686f2c3.tar.gz plugin-4333293820d5c7de27e9e760dfeaadbc1686f2c3.tar.bz2 plugin-4333293820d5c7de27e9e760dfeaadbc1686f2c3.tar.xz plugin-4333293820d5c7de27e9e760dfeaadbc1686f2c3.zip |
Add script function failedrefindex and some macro.
New function: failedrefindex index
index - inventory item index
Example:
failedrefindex .@itemid;
Diffstat (limited to 'src/emap/script.c')
-rw-r--r-- | src/emap/script.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c index 56dcc29..88b9f34 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -1263,3 +1263,20 @@ BUILDIN(isUnitWalking) script_pushint(st, ud->walktimer != INVALID_TIMER); return true; } + +BUILDIN(failedRefIndex) +{ + getSD() + getInventoryIndex(2) + + if (sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0) + return false; + + sd->status.inventory[n].refine = 0; + if (sd->status.inventory[n].equip) + pc->unequipitem(sd, n, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); + clif->refine(sd->fd, 1, n, sd->status.inventory[n].refine); + pc->delitem(sd, n, 1, 0, DELITEM_FAILREFINE, LOG_TYPE_SCRIPT); + clif->misceffect(&sd->bl, 2); + return true; +} |