summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)