summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-15 18:19:44 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-15 18:54:08 +0300
commit5c201b1f0df178d6551210afcec7876f21c73bfe (patch)
tree3a704fe8e58166b6e1a09ed8896b425367073d5d /src/map/script.c
parente48ddae488b467c169682d5ce926b28936afa7be (diff)
downloadevol-hercules-5c201b1f0df178d6551210afcec7876f21c73bfe.tar.gz
evol-hercules-5c201b1f0df178d6551210afcec7876f21c73bfe.tar.bz2
evol-hercules-5c201b1f0df178d6551210afcec7876f21c73bfe.tar.xz
evol-hercules-5c201b1f0df178d6551210afcec7876f21c73bfe.zip
Impliment script function getItemLink.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 1671f5c..c8b41ac 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -154,3 +154,49 @@ BUILDIN(shop)
clif->npcbuysell (sd, nd->bl.id);
return true;
}
+
+BUILDIN(getItemLink)
+{
+ struct item_data *i_data;
+ char *item_name;
+ struct script_data *data;
+ int item_id = 0;
+
+ if (script_isstringtype(st, 2))
+ {
+ i_data = itemdb->searchname (script_getstr(st, 2));
+ }
+ else
+ {
+ item_id = script_getnum (st, 2);
+ i_data = itemdb->search (item_id);
+ }
+
+ item_name = (char *) aCalloc (100, sizeof (char));
+ TBL_PC *sd = script->rid2sd(st)
+
+ if (sd)
+ {
+ if (i_data)
+// +++ after restore lang support need translate here
+// sprintf(item_name, "[@@%u|%s@@]", (unsigned)i_data->nameid, lang_pctrans (i_data->jname, sd));
+ sprintf(item_name, "[@@%u|%s@@]", (unsigned)i_data->nameid, i_data->jname);
+ else if (item_id > 0)
+ sprintf(item_name, "[@@%u|Unknown Item@@]", (unsigned)item_id);
+ else
+ sprintf(item_name, "[Unknown Item]");
+ }
+ else
+ {
+ if (i_data)
+// +++ after restore lang support need translate here
+// sprintf(item_name, "[%s]", lang_pctrans (i_data->jname, sd));
+ sprintf(item_name, "[%s]", lang_pctrans (i_data->jname, sd));
+ else
+ sprintf(item_name, "[Unknown Item]");
+ }
+
+ script_pushstr(st, item_name);
+
+ return true;
+}