summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-10-18 00:42:51 +0300
committerAndrei Karas <akaras@inbox.ru>2018-10-22 01:44:46 +0300
commitcf24c2af665191a9ae397ddf58badb1638a8a5bd (patch)
tree39d5730c970f64368898642e335e17492d31dc09
parent0f2757e098043922dd1d87bf8133ee3426097f61 (diff)
downloadhercules-cf24c2af665191a9ae397ddf58badb1638a8a5bd.tar.gz
hercules-cf24c2af665191a9ae397ddf58badb1638a8a5bd.tar.bz2
hercules-cf24c2af665191a9ae397ddf58badb1638a8a5bd.tar.xz
hercules-cf24c2af665191a9ae397ddf58badb1638a8a5bd.zip
Add script command itempreview for update preview window with given item.
-rw-r--r--doc/script_commands.txt8
-rw-r--r--src/map/script.c12
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index a80a8f2fa..4812a2cf2 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -10215,3 +10215,11 @@ account_id - (optional) AID to perform on (default to attached player).
returns progress on success and false on failure
---------------------------------------
+
+*itempreview(<index>)
+
+Update already opened preview window with item from
+ inventory with given index.
+Works for 20181017 RE and main clients or newer.
+
+---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index 212c11687..e7a2fdb14 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -24816,6 +24816,16 @@ static BUILDIN(changecamera)
return true;
}
+// update preview window to given item
+static BUILDIN(itempreview)
+{
+ struct map_session_data *sd = script_rid2sd(st);
+ if (sd == NULL)
+ return false;
+ clif->item_preview(sd, script_getnum(st, 2));
+ return true;
+}
+
/**
* Adds a built-in script function.
*
@@ -25550,6 +25560,8 @@ static void script_parse_builtin(void)
// camera
BUILDIN_DEF(camerainfo, ""),
BUILDIN_DEF(changecamera, "iii?"),
+
+ BUILDIN_DEF(itempreview, "i"),
};
int i, len = ARRAYLENGTH(BUILDIN);
RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up