summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-02 15:40:15 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-02 15:40:15 +0300
commit53edb4dd94fda5157944dbd0fc619f92ce4db500 (patch)
tree9ec217484965bb8094d15eb66e29b1388333f6f3 /src/map/script.c
parent97b30eda6487c6a7fb7db61dc7af2b0ea006d71d (diff)
downloadevol-hercules-53edb4dd94fda5157944dbd0fc619f92ce4db500.tar.gz
evol-hercules-53edb4dd94fda5157944dbd0fc619f92ce4db500.tar.bz2
evol-hercules-53edb4dd94fda5157944dbd0fc619f92ce4db500.tar.xz
evol-hercules-53edb4dd94fda5157944dbd0fc619f92ce4db500.zip
add script function for check is unit walking.
New script function: isunitwalking([unitid])
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index fe014dd..02e34a4 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10,6 +10,7 @@
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
+#include "../../../common/timer.h"
#include "../../../map/chrif.h"
#include "../../../map/clif.h"
#include "../../../map/npc.h"
@@ -1118,3 +1119,30 @@ BUILDIN(clientCommand)
send_client_command(sd, command);
return true;
}
+
+BUILDIN(isUnitWalking)
+{
+ int id = 0;
+ if (script_hasdata(st, 2))
+ id = script_getnum(st, 2);
+ else
+ id = st->oid;
+ struct block_list *bl = map->id2bl(id);
+ if (!bl)
+ {
+ ShowWarning("invalid unit id\n");
+ script->reportsrc(st);
+ script_pushint(st, 0);
+ return false;
+ }
+ struct unit_data *ud = unit->bl2ud(bl);
+ if (!ud)
+ {
+ ShowWarning("invalid unit data\n");
+ script->reportsrc(st);
+ script_pushint(st, 0);
+ return false;
+ }
+ script_pushint(st, ud->walktimer != INVALID_TIMER);
+ return true;
+}