summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-04-13 23:00:18 +0300
committerAndrei Karas <akaras@inbox.ru>2019-05-05 22:22:05 +0300
commitea7697ef7b2ef759d5fd612e919c029ea4a7fa05 (patch)
tree68326632e758690db1b5585afcec61bb857fc35e /src
parentcf28f0002c46e9c23e752b7e4b351de1e947f830 (diff)
downloadhercules-ea7697ef7b2ef759d5fd612e919c029ea4a7fa05.tar.gz
hercules-ea7697ef7b2ef759d5fd612e919c029ea4a7fa05.tar.bz2
hercules-ea7697ef7b2ef759d5fd612e919c029ea4a7fa05.tar.xz
hercules-ea7697ef7b2ef759d5fd612e919c029ea4a7fa05.zip
Extend setinitdata and getunitdata with UDT_GROUP flag
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c23
-rw-r--r--src/map/script.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 2c5e5237b..ccbe50157 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18961,6 +18961,20 @@ static BUILDIN(setunitdata)
case UDT_ELELEVEL:
setunitdata_check_bounds(4, 0, CHAR_MAX);
break;
+ case UDT_GROUP:
+ {
+ setunitdata_check_bounds(4, 0, INT_MAX);
+ struct unit_data *ud = unit->bl2ud2(bl);
+ if (ud == NULL) {
+ ShowError("buildin_setunitdata: ud is NULL!\n");
+ script_pushint(st, 0);
+ return false;
+ }
+ ud->groupId = script_getnum(st, 4);
+ clif->blname_ack(0, bl); // Send update to client.
+ script_pushint(st, 1);
+ return true;
+ }
default:
break;
}
@@ -19909,6 +19923,15 @@ static BUILDIN(getunitdata)
return true;// no player attached
}
}
+ } else if (type == UDT_GROUP) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if (ud == NULL) {
+ ShowError("buildin_setunitdata: ud is NULL!\n");
+ script_pushint(st, -1);
+ return false;
+ }
+ script_pushint(st, ud->groupId);
+ return true;
}
#define getunitdata_sub(idx__,var__) script->setd_sub(st,NULL,name,(idx__),(void *)h64BPTRSIZE((int)(var__)),data->ref);
diff --git a/src/map/script.h b/src/map/script.h
index 008da9c3c..4c1cc168d 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -431,6 +431,7 @@ enum script_unit_data_types {
UDT_STATPOINT,
UDT_ROBE,
UDT_BODY2,
+ UDT_GROUP,
UDT_MAX
};