summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-26 20:35:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-26 20:35:19 +0300
commit2a1492c2bdc85f2917775987d4f72660fcfed4b0 (patch)
tree8fb936eb86bcbeffd6d31b7ece9e540604f4dde3 /src
parent3f3657e0279b4f7b111906870e8b974359cc7463 (diff)
downloadplugin-2a1492c2bdc85f2917775987d4f72660fcfed4b0.tar.gz
plugin-2a1492c2bdc85f2917775987d4f72660fcfed4b0.tar.bz2
plugin-2a1492c2bdc85f2917775987d4f72660fcfed4b0.tar.xz
plugin-2a1492c2bdc85f2917775987d4f72660fcfed4b0.zip
Add script command setskin. For set npc dialog skin on client.
Diffstat (limited to 'src')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script.c12
-rw-r--r--src/emap/script.h1
-rw-r--r--src/emap/send.c17
-rw-r--r--src/emap/send.h3
5 files changed, 34 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 703b7d6..5251cbc 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -133,6 +133,7 @@ HPExport void plugin_init (void)
addScriptCommand("setcells", "siiiiis", setCells);
addScriptCommand("delcells", "s", delCells);
addScriptCommand("setmount", "i", setMount);
+ addScriptCommand("setskin", "s", setSkin);
do_init_langs();
diff --git a/src/emap/script.c b/src/emap/script.c
index d64f190..b8f54a0 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -1777,3 +1777,15 @@ BUILDIN(setMount)
send_pc_info(&sd->bl, &sd->bl, AREA);
return true;
}
+
+BUILDIN(setSkin)
+{
+ if (!st->oid)
+ return false;
+
+ getSD()
+
+ const char *skin = script_getstr(st, 2);
+ send_pc_skin(sd->fd, st->oid, skin);
+ return true;
+}
diff --git a/src/emap/script.h b/src/emap/script.h
index edbd010..5db3897 100644
--- a/src/emap/script.h
+++ b/src/emap/script.h
@@ -63,5 +63,6 @@ BUILDIN(chatJoin);
BUILDIN(checkNpcCell);
BUILDIN(setCells);
BUILDIN(delCells);
+BUILDIN(setSkin);
#endif // EVOL_MAP_SCRIPT
diff --git a/src/emap/send.c b/src/emap/send.c
index 815464a..3984421 100644
--- a/src/emap/send.c
+++ b/src/emap/send.c
@@ -436,3 +436,20 @@ void send_setwall_single(int fd, int m, int layer, int x1, int y1, int x2, int y
mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name,(char*)WFIFOP(fd, 18));
WFIFOSET(fd, 34);
}
+
+void send_pc_skin(int fd, int npcId, const char *const skin)
+{
+ if (!skin)
+ return;
+ struct SessionExt *data = session_get(fd);
+ if (!data || data->clientVersion < 15)
+ return;
+
+ const int sz = strlen(skin) + 9;
+ WFIFOHEAD (fd, sz);
+ WFIFOW(fd, 0) = 0xb1c;
+ WFIFOW(fd, 2) = sz;
+ WFIFOL(fd, 4) = npcId;
+ strcpy((char*)WFIFOP (fd, 8), skin);
+ WFIFOSET(fd, sz);
+}
diff --git a/src/emap/send.h b/src/emap/send.h
index 7634f1a..2d6ca56 100644
--- a/src/emap/send.h
+++ b/src/emap/send.h
@@ -45,5 +45,8 @@ void send_setwall_single(int fd,
int x1, int y1,
int x2, int y2,
int mask);
+void send_pc_skin(int fd,
+ int npcId,
+ const char *const skin);
#endif // EVOL_MAP_SEND