summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-06-15 09:50:25 -0400
committergumi <git@gumi.ca>2018-06-15 10:28:24 -0400
commitdef62fb51d473886e92545e0477c1184ed30f888 (patch)
treee475eb7a8ac78aef564df12a5626469893b54e00 /src
parenta1e86508ed517be79d27c9bc0e725e5b1df9cd50 (diff)
downloadhercules-def62fb51d473886e92545e0477c1184ed30f888.tar.gz
hercules-def62fb51d473886e92545e0477c1184ed30f888.tar.bz2
hercules-def62fb51d473886e92545e0477c1184ed30f888.tar.xz
hercules-def62fb51d473886e92545e0477c1184ed30f888.zip
add buildin_setparam
Co-authored-by: "Wolfie" <ryan.tana55@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index f74debabb..78dd63fdc 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8628,6 +8628,43 @@ BUILDIN(readparam)
return true;
}
+BUILDIN(setparam)
+{
+ int type;
+ struct map_session_data *sd;
+ struct script_data *data = script_getdata(st, 2);
+ int val = script_getnum(st, 3);
+
+ if (data_isreference(data) && reference_toparam(data)) {
+ type = reference_getparamtype(data);
+ } else {
+ type = script->conv_num(st, data);
+ }
+
+ if (script_hasdata(st, 4)) {
+ if (script_isstringtype(st, 4)) {
+ sd = script->nick2sd(st, script_getstr(st, 4));
+ } else {
+ sd = script->id2sd(st, script_getnum(st, 4));
+ }
+ } else {
+ sd = script->rid2sd(st);
+ }
+
+ if (sd == NULL) {
+ script_pushint(st, 0);
+ return true;
+ }
+
+ if (pc->setparam(sd, type, val) == 0) {
+ script_pushint(st, 0);
+ return false;
+ }
+
+ script_pushint(st, 1);
+ return true;
+}
+
/*==========================================
* Return charid identification
* return by @num :
@@ -24391,6 +24428,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(checkweight,"vi*"),
BUILDIN_DEF(checkweight2,"rr"),
BUILDIN_DEF(readparam,"i?"),
+ BUILDIN_DEF(setparam,"ii?"),
BUILDIN_DEF(getcharid,"i?"),
BUILDIN_DEF(getnpcid,"i?"),
BUILDIN_DEF(getpartyname,"i"),