summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-27 21:16:45 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-27 21:16:45 +0300
commit9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b (patch)
treecbaa0cca9fc6ba310f94722049f605b5606f2025 /src/emap/script.c
parentb1b7c5a06d59bd7c31e152c9981353b78d32a843 (diff)
downloadplugin-9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b.tar.gz
plugin-9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b.tar.bz2
plugin-9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b.tar.xz
plugin-9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b.zip
Allow get/set npc class by variable '.class'.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 95aa747..3d67429 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -65,11 +65,13 @@ void escript_set_reg_npc_num(struct script_state* st, struct reg_db *n, int64 *n
clif->clearunit_area(&nd->bl, CLR_OUTSIGHT);
nd->vd->sex = *val;
clif->spawn(&nd->bl);
+ hookStop();
}
else if (!strcmp(name, ".distance"))
{
getND();
nd->area_size = *val;
+ hookStop();
}
else if (!strcmp(name, ".dir"))
{
@@ -83,16 +85,27 @@ void escript_set_reg_npc_num(struct script_state* st, struct reg_db *n, int64 *n
nd->dir = newdir;
npc->enable(nd->name, 1);
+ hookStop();
}
else if (!strcmp(name, ".x"))
{
ShowWarning("you cant assign '.x'\n");
script->reportsrc(st);
+ hookStop();
}
else if (!strcmp(name, ".y"))
{
ShowWarning("you cant assign '.y'.\n");
script->reportsrc(st);
+ hookStop();
+ }
+ else if (!strcmp(name, ".class"))
+ {
+ getND();
+ int class_ = *val;
+ if (nd->class_ != class_)
+ npc->setclass(nd, class_);
+ hookStop();
}
}
@@ -136,6 +149,12 @@ int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, stru
hookStop();
return nd->bl.y;
}
+ else if (!strcmp(name, ".class"))
+ {
+ getNDReturn(0);
+ hookStop();
+ return nd->class_;
+ }
return 0;
}