diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-17 16:15:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-17 16:15:51 +0300 |
commit | 0e55e85e9e9a6a4028a29e8c214b69cbc3a54ffe (patch) | |
tree | 7e6205674b8baf6c8f450a747dadb3ac705ab04f /src/emap/pc.c | |
parent | 6d6c12a1721f1432cb576606917dc68db2c9708b (diff) | |
download | evol-hercules-0e55e85e9e9a6a4028a29e8c214b69cbc3a54ffe.tar.gz evol-hercules-0e55e85e9e9a6a4028a29e8c214b69cbc3a54ffe.tar.bz2 evol-hercules-0e55e85e9e9a6a4028a29e8c214b69cbc3a54ffe.tar.xz evol-hercules-0e55e85e9e9a6a4028a29e8c214b69cbc3a54ffe.zip |
Add support for insert cards script.
Diffstat (limited to 'src/emap/pc.c')
-rw-r--r-- | src/emap/pc.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/emap/pc.c b/src/emap/pc.c index 705c3dc..9e599ee 100644 --- a/src/emap/pc.c +++ b/src/emap/pc.c @@ -522,3 +522,34 @@ int epc_takeitem_post(int retVal, struct map_session_data *sd, struct flooritem_ } return retVal; } + +int epc_insert_card_pre(struct map_session_data* sd, int *idx_card, int *idx_equip) +{ + if (!sd || *idx_equip < 0 || *idx_equip >= MAX_INVENTORY || + *idx_card < 0 || *idx_card >= MAX_INVENTORY) + { + tempN = 0; + tempId = 0; + tempAmount = 0; + return 0; + } + tempN = *idx_equip; + tempId = sd->status.inventory[*idx_equip].nameid; + tempAmount = sd->status.inventory[*idx_card].nameid; + return 1; +} + +int epc_insert_card_post(int retVal, struct map_session_data* sd, int *idx_card, int *idx_equip) +{ + if (retVal && *idx_equip == tempN && tempId) + { + struct item_data *item = itemdb->search(tempId); + if (!item) + return retVal; + struct ItemdExt *data = itemd_get(item); + if (!data) + return retVal; + script_run_card_script(sd, data->insertScript, tempId, tempAmount); + } + return retVal; +} |