diff options
author | AnnieRuru <jeankofannie2@gmail.com> | 2019-04-11 00:50:28 +0800 |
---|---|---|
committer | AnnieRuru <jeankofannie2@gmail.com> | 2019-04-11 00:50:28 +0800 |
commit | 797464b89910c4a04d0381a831001f4a7591ad28 (patch) | |
tree | 4cc92f83692637566d3b8bbb84204a1dcf033c9b /src/map/script.c | |
parent | 55567b93ee5b287c632ff18327df6408f0cf4692 (diff) | |
download | hercules-797464b89910c4a04d0381a831001f4a7591ad28.tar.gz hercules-797464b89910c4a04d0381a831001f4a7591ad28.tar.bz2 hercules-797464b89910c4a04d0381a831001f4a7591ad28.tar.xz hercules-797464b89910c4a04d0381a831001f4a7591ad28.zip |
Add 3 pc variables just for the input limit ...
sd->npc_amount_min and sd->npc_amount_max to limit input range
and sd->npc_input_capped_range because the documentation ask for it
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/map/script.c b/src/map/script.c index 2a4cbd4f2..391fb34c4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6983,10 +6983,13 @@ static BUILDIN(input) // first invocation, display npc input box sd->state.menu_or_input = 1; st->state = RERUNLINE; - if (is_string_variable(name)) + if (is_string_variable(name)) { clif->scriptinputstr(sd, st->oid); - else + } else { + sd->npc_amount_min = min; + sd->npc_amount_max = max; clif->scriptinput(sd, st->oid); + } } else { // take received text/value and store it in the designated variable sd->state.menu_or_input = 0; @@ -6997,7 +7000,7 @@ static BUILDIN(input) } else { int amount = sd->npc_amount; script->set_reg(st, sd, uid, name, (const void *)h64BPTRSIZE(cap_value(amount,min,max)), script_getref(st,2)); - script_pushint(st, (amount > max ? 1 : amount < min ? -1 : 0)); + script_pushint(st, sd->npc_input_capped_range); } st->state = RUN; } |