summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-15 21:01:23 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-16 00:03:27 +0300
commitc269e2bb15cfc91fa4e66077f769841fb86ca6ed (patch)
tree7a9100b212c0448718a472b96e5a66324e9d98ae /src/map/script.c
parent5c201b1f0df178d6551210afcec7876f21c73bfe (diff)
downloadevol-hercules-c269e2bb15cfc91fa4e66077f769841fb86ca6ed.tar.gz
evol-hercules-c269e2bb15cfc91fa4e66077f769841fb86ca6ed.tar.bz2
evol-hercules-c269e2bb15cfc91fa4e66077f769841fb86ca6ed.tar.xz
evol-hercules-c269e2bb15cfc91fa4e66077f769841fb86ca6ed.zip
Impliment script command requestLang.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c
index c8b41ac..1250d1b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -164,7 +164,7 @@ BUILDIN(getItemLink)
if (script_isstringtype(st, 2))
{
- i_data = itemdb->searchname (script_getstr(st, 2));
+ i_data = itemdb->search_name (script_getstr(st, 2));
}
else
{
@@ -173,7 +173,7 @@ BUILDIN(getItemLink)
}
item_name = (char *) aCalloc (100, sizeof (char));
- TBL_PC *sd = script->rid2sd(st)
+ TBL_PC *sd = script->rid2sd(st);
if (sd)
{
@@ -191,7 +191,7 @@ BUILDIN(getItemLink)
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));
+ sprintf(item_name, "[%s]", i_data->jname);
else
sprintf(item_name, "[Unknown Item]");
}
@@ -200,3 +200,57 @@ BUILDIN(getItemLink)
return true;
}
+
+BUILDIN(requestLang)
+{
+ getSD();
+ struct script_data* data;
+ int64 uid;
+ const char* name;
+ int min;
+ int max;
+
+ data = script_getdata(st, 2);
+ if (!data_isreference(data))
+ {
+ ShowError("script:requestlang: not a variable\n");
+ script->reportdata(data);
+ st->state = END;
+ return false;
+ }
+ uid = reference_getuid(data);
+ name = reference_getname(data);
+ min = (script_hasdata(st,3) ? script_getnum(st,3) : script->config.input_min_value);
+ max = (script_hasdata(st,4) ? script_getnum(st,4) : script->config.input_max_value);
+
+ if (is_string_variable(name))
+ return false;
+
+ if (!sd->state.menu_or_input)
+ {
+ // first invocation, display npc input box
+ sd->state.menu_or_input = 1;
+ st->state = RERUNLINE;
+
+ // send lang request
+ send_npccommand(script->rid2sd(st), st->oid, 0);
+ clif->scriptinputstr(sd, st->oid);
+ }
+ else
+ {
+ // take received text/value and store it in the designated variable
+ sd->state.menu_or_input = 0;
+
+ int lng = -1;
+ if (*sd->npc_str)
+ {
+ lng = 3;
+// +++ after restore lang support need translate here
+// lng = lang_getId(sd->npc_str);
+ }
+ script->set_reg(st, sd, uid, name, (void*)h64BPTRSIZE(lng), script_getref(st,2));
+ st->state = RUN;
+ }
+ return true;
+}
+