summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-13 21:08:48 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-13 21:09:15 +0300
commitab731862f899dd87b84613ebf12a82cdc73e094f (patch)
treee0dff28ea24a942d0ad6d07783aadbccfc5022a7 /src/emap/script.c
parentf7cce6ac2d1c010af4865212dc6ddc2a7aea66a4 (diff)
downloadevol-hercules-ab731862f899dd87b84613ebf12a82cdc73e094f.tar.gz
evol-hercules-ab731862f899dd87b84613ebf12a82cdc73e094f.tar.bz2
evol-hercules-ab731862f899dd87b84613ebf12a82cdc73e094f.tar.xz
evol-hercules-ab731862f899dd87b84613ebf12a82cdc73e094f.zip
Add support for take (pickup) script for items taked from ground by player.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 962f28f..7eaa074 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -304,6 +304,20 @@ char *eget_val_npcscope_str(struct script_state* st, struct reg_db *n, struct sc
return NULL;
}
+void script_run_item_amount_script(TBL_PC *sd, struct script_code *itemScript, int itemId, int amount)
+{
+ if (!itemScript)
+ return;
+
+ script->current_item_id = itemId;
+ pc->setreg(sd, script->add_str("@itemId"), itemId);
+ pc->setreg(sd, script->add_str("@itemAmount"), amount);
+ script->run(itemScript, 0, sd->bl.id, npc->fake_nd->bl.id);
+ pc->setreg(sd, script->add_str("@itemId"), 0);
+ pc->setreg(sd, script->add_str("@itemAmount"), 0);
+ script->current_item_id = 0;
+}
+
uint32 MakeDWord(uint16 word0, uint16 word1)
{
return ((uint32)(word0)) | ((uint32)(word1 << 0x10));