summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-15 14:36:53 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-15 14:36:53 +0300
commit709a4632333657ac6e12c427843d07d3198f68d7 (patch)
treecc6e1e0276df0e0fe5ffa2f85e1e17c150543147 /src/map
parent8fe6b497e0bce5999973321fbde89ff080647c8b (diff)
downloadevol-hercules-709a4632333657ac6e12c427843d07d3198f68d7.tar.gz
evol-hercules-709a4632333657ac6e12c427843d07d3198f68d7.tar.bz2
evol-hercules-709a4632333657ac6e12c427843d07d3198f68d7.tar.xz
evol-hercules-709a4632333657ac6e12c427843d07d3198f68d7.zip
Impliment script command setcamnpc.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/script.c39
-rw-r--r--src/map/script.h1
3 files changed, 41 insertions, 1 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 06002de..f399acf 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -42,7 +42,7 @@ HPExport void plugin_init (void)
session = GET_SYMBOL("session");
sockt = GET_SYMBOL("sockt");
- addScriptCommand("setcamnpc", "*", dummy);
+ addScriptCommand("setcamnpc", "*", setCamNpc);
addScriptCommand("restorecam", "", dummy);
addScriptCommand("npctalk3", "s", dummy);
addScriptCommand("closedialog", "", dummy);
diff --git a/src/map/script.c b/src/map/script.c
index 1d0f036..585dfec 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11,9 +11,12 @@
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
#include "../../../map/clif.h"
+#include "../../../map/npc.h"
#include "../../../map/pc.h"
#include "../../../map/script.h"
+#include "map/script.h"
+#include "map/send.h"
#include "map/session.h"
#include "map/sessionext.h"
@@ -63,3 +66,39 @@ BUILDIN(setLang)
getData();
data->language = script_getnum(st, 2);
}
+
+BUILDIN(setCamNpc)
+{
+ TBL_PC *sd = script->rid2sd(st);
+ if (!sd)
+ return 1;
+
+ struct npc_data *nd = NULL;
+
+ int x = 0;
+ int y = 0;
+
+ if (script_hasdata(st, 2))
+ {
+ nd = npc->name2id (script_getstr(st, 2));
+ }
+ else
+ {
+ if (!st->oid)
+ return 1;
+
+ nd = (struct npc_data *) map->id2bl (st->oid);
+ }
+ if (!nd || sd->bl.m != nd->bl.m)
+ return 1;
+
+ if (script_hasdata(st, 3) && script_hasdata(st, 4))
+ {
+ x = script_getnum(st, 3);
+ y = script_getnum(st, 4);
+ }
+
+ send_npccommand2(script->rid2sd (st), st->oid, 2, nd->bl.id, x, y);
+
+ return 0;
+}
diff --git a/src/map/script.h b/src/map/script.h
index 0d0bbda..32a5bec 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -8,5 +8,6 @@ BUILDIN(l);
BUILDIN(getClientVersion);
BUILDIN(getLang);
BUILDIN(setLang);
+BUILDIN(setCamNpc);
#endif // EVOL_MAP_SCRIPT