summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-13 16:19:28 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-15 11:37:44 +0200
commite6e23a2b707784ae905ebcc23d05d2318718b8bf (patch)
tree83a385ab5e4e5d81fc12fa4714b77c28dac11181
parentd6acc51bdca27720078fc751f20ac0a10d4d1c26 (diff)
downloadtmwa-e6e23a2b707784ae905ebcc23d05d2318718b8bf.tar.gz
tmwa-e6e23a2b707784ae905ebcc23d05d2318718b8bf.tar.bz2
tmwa-e6e23a2b707784ae905ebcc23d05d2318718b8bf.tar.xz
tmwa-e6e23a2b707784ae905ebcc23d05d2318718b8bf.zip
Allow item ID as parameter to builtin getitemlink
In addition to item name. Alternative to https://git.themanaworld.org/legacy/serverdata/-/merge_requests/808
-rw-r--r--src/map/script-fun.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index fee39d6..91beb96 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -4366,9 +4366,14 @@ void builtin_getitemlink(ScriptState *st)
struct script_data *data;
AString buf;
data = &AARG(0);
- ZString name = conv_str(st, data);
+ Option<P<struct item_data>> item_data_ = None;
+
+ get_val(st, data);
+ if (data->is<ScriptDataStr>())
+ item_data_ = itemdb_searchname(conv_str(st, data));
+ else
+ item_data_ = itemdb_exists(wrap<ItemNameId>(conv_num(st, data)));
- Option<P<struct item_data>> item_data_ = itemdb_searchname(name);
OMATCH_BEGIN (item_data_)
{
OMATCH_CASE_SOME (item_data)